From 62a70f90c49cf7714c960186eb063ad55333e6f3 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 21 Mar 2016 15:00:20 -0700 Subject: Remove FX_WORD in favor of uint16_t. It isn't buying us anthing, and it looks strange in a struct when other uint types are already present. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1821043003 . --- xfa/fxfa/app/xfa_ffwidget.cpp | 2 +- xfa/fxfa/app/xfa_fontmgr.cpp | 6 +++--- xfa/fxfa/app/xfa_fontmgr.h | 10 +++++----- xfa/fxfa/parser/xfa_basic_data.cpp | 2 +- xfa/fxfa/parser/xfa_basic_data.h | 2 +- xfa/fxfa/parser/xfa_basic_imp.cpp | 10 +++++----- xfa/fxfa/parser/xfa_basic_imp.h | 4 ++-- xfa/fxfa/parser/xfa_localemgr.cpp | 10 +++++----- xfa/fxfa/parser/xfa_localemgr.h | 8 ++++---- xfa/fxfa/parser/xfa_localevalue.cpp | 26 +++++++++++++------------- xfa/fxfa/parser/xfa_object.h | 4 ++-- xfa/fxfa/parser/xfa_object_imp.cpp | 4 +++- xfa/fxfa/parser/xfa_parser_imp.cpp | 2 +- xfa/fxfa/parser/xfa_parser_imp.h | 4 ++-- 14 files changed, 48 insertions(+), 46 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index d585e279ce..37d363f443 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -1310,7 +1310,7 @@ static void XFA_BOX_GetFillPath(CXFA_Box box, const CXFA_StrokeArray& strokes, CFX_RectF rtWidget, CFX_Path& fillPath, - FX_WORD dwFlags) { + uint16_t dwFlags) { if (box.IsArc() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) { CXFA_Edge edge = box.GetEdge(0); FX_FLOAT fThickness = edge.GetThickness(); diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index 5fc3ce97aa..25a291f093 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1765,7 +1765,7 @@ CXFA_DefFontMgr::~CXFA_DefFontMgr() { IFX_Font* CXFA_DefFontMgr::GetFont(IXFA_Doc* hDoc, const CFX_WideStringC& wsFontFamily, FX_DWORD dwFontStyles, - FX_WORD wCodePage) { + uint16_t wCodePage) { CFX_WideString wsFontName = wsFontFamily; IFX_FontMgr* pFDEFontMgr = static_cast(hDoc)->GetApp()->GetFDEFontMgr(); @@ -1809,7 +1809,7 @@ IFX_Font* CXFA_DefFontMgr::GetFont(IXFA_Doc* hDoc, IFX_Font* CXFA_DefFontMgr::GetDefaultFont(IXFA_Doc* hDoc, const CFX_WideStringC& wsFontFamily, FX_DWORD dwFontStyles, - FX_WORD wCodePage) { + uint16_t wCodePage) { IFX_FontMgr* pFDEFontMgr = ((CXFA_FFDoc*)hDoc)->GetApp()->GetFDEFontMgr(); IFX_Font* pFont = pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); @@ -2021,7 +2021,7 @@ CXFA_FontMgr::~CXFA_FontMgr() { IFX_Font* CXFA_FontMgr::GetFont(IXFA_Doc* hDoc, const CFX_WideStringC& wsFontFamily, FX_DWORD dwFontStyles, - FX_WORD wCodePage) { + uint16_t wCodePage) { FX_DWORD dwHash = FX_HashCode_String_GetW(wsFontFamily.GetPtr(), wsFontFamily.GetLength(), FALSE); CFX_ByteString bsKey; diff --git a/xfa/fxfa/app/xfa_fontmgr.h b/xfa/fxfa/app/xfa_fontmgr.h index 44360796e9..09d42931a5 100644 --- a/xfa/fxfa/app/xfa_fontmgr.h +++ b/xfa/fxfa/app/xfa_fontmgr.h @@ -20,8 +20,8 @@ struct XFA_FONTINFO { FX_DWORD dwFontNameHash; const FX_WCHAR* pPsName; const FX_WCHAR* pReplaceFont; - FX_WORD dwStyles; - FX_WORD wCodePage; + uint16_t dwStyles; + uint16_t wCodePage; }; class CXFA_DefFontMgr : public IXFA_FontMgr { @@ -33,11 +33,11 @@ class CXFA_DefFontMgr : public IXFA_FontMgr { IFX_Font* GetFont(IXFA_Doc* hDoc, const CFX_WideStringC& wsFontFamily, FX_DWORD dwFontStyles, - FX_WORD wCodePage = 0xFFFF) override; + uint16_t wCodePage = 0xFFFF) override; IFX_Font* GetDefaultFont(IXFA_Doc* hDoc, const CFX_WideStringC& wsFontFamily, FX_DWORD dwFontStyles, - FX_WORD wCodePage = 0xFFFF) override; + uint16_t wCodePage = 0xFFFF) override; protected: CFX_PtrArray m_CacheFonts; @@ -83,7 +83,7 @@ class CXFA_FontMgr { IFX_Font* GetFont(IXFA_Doc* hDoc, const CFX_WideStringC& wsFontFamily, FX_DWORD dwFontStyles, - FX_WORD wCodePage = 0xFFFF); + uint16_t wCodePage = 0xFFFF); void LoadDocFonts(IXFA_Doc* hDoc); void ReleaseDocFonts(IXFA_Doc* hDoc); diff --git a/xfa/fxfa/parser/xfa_basic_data.cpp b/xfa/fxfa/parser/xfa_basic_data.cpp index 58e71debd3..f8a26dc1cd 100644 --- a/xfa/fxfa/parser/xfa_basic_data.cpp +++ b/xfa/fxfa/parser/xfa_basic_data.cpp @@ -2242,7 +2242,7 @@ const XFA_ELEMENTHIERARCHY g_XFAElementChildrenIndex[] = { {228, 0}, {228, 2}, {230, 0}, {230, 0}, {230, 0}, {230, 0}, {230, 0}, {230, 0}, {230, 0}, {230, 0}, {230, 10}, }; -const FX_WORD g_XFAElementChildrenData[] = { +const uint16_t g_XFAElementChildrenData[] = { XFA_ELEMENT_Extras, XFA_ELEMENT_SubformSet, XFA_ELEMENT_BreakBefore, diff --git a/xfa/fxfa/parser/xfa_basic_data.h b/xfa/fxfa/parser/xfa_basic_data.h index 8d36650a87..9bc6dcb23b 100644 --- a/xfa/fxfa/parser/xfa_basic_data.h +++ b/xfa/fxfa/parser/xfa_basic_data.h @@ -26,7 +26,7 @@ extern const XFA_ELEMENTINFO g_XFAElementData[]; extern const int32_t g_iXFAElementCount; extern const XFA_ELEMENTHIERARCHY g_XFAElementChildrenIndex[]; -extern const FX_WORD g_XFAElementChildrenData[]; +extern const uint16_t g_XFAElementChildrenData[]; extern const XFA_ELEMENTHIERARCHY g_XFAElementAttributeIndex[]; extern const uint8_t g_XFAElementAttributeData[]; diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp index a6d4fc069a..61e2ab629b 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.cpp +++ b/xfa/fxfa/parser/xfa_basic_imp.cpp @@ -213,7 +213,7 @@ const XFA_ELEMENTINFO* XFA_GetElementByName(const CFX_WideStringC& wsName) { const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_ELEMENT eName) { return (eName < g_iXFAElementCount) ? (g_XFAElementData + eName) : NULL; } -const FX_WORD* XFA_GetElementChildren(XFA_ELEMENT eElement, int32_t& iCount) { +const uint16_t* XFA_GetElementChildren(XFA_ELEMENT eElement, int32_t& iCount) { if (eElement >= g_iXFAElementCount) { return NULL; } @@ -252,11 +252,11 @@ const XFA_ELEMENTINFO* XFA_GetChildOfElement(XFA_ELEMENT eElement, XFA_ELEMENT eChild, FX_DWORD dwPacket) { int32_t iCount = 0; - const FX_WORD* pChild = XFA_GetElementChildren(eElement, iCount); + const uint16_t* pChild = XFA_GetElementChildren(eElement, iCount); if (pChild == NULL || iCount < 1) { return NULL; } - CFX_DSPATemplate search; + CFX_DSPATemplate search; int32_t index = search.Lookup(eChild, pChild, iCount); if (index < 0) { return NULL; @@ -604,9 +604,9 @@ int32_t CXFA_WideTextRead::ReadString(FX_WCHAR* pStr, bEOS = IsEOF(); return iMaxLength; } -FX_WORD CXFA_WideTextRead::GetCodePage() const { +uint16_t CXFA_WideTextRead::GetCodePage() const { return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; } -FX_WORD CXFA_WideTextRead::SetCodePage(FX_WORD wCodePage) { +uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { return GetCodePage(); } diff --git a/xfa/fxfa/parser/xfa_basic_imp.h b/xfa/fxfa/parser/xfa_basic_imp.h index 7e67d2b96e..d0440face1 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.h +++ b/xfa/fxfa/parser/xfa_basic_imp.h @@ -48,8 +48,8 @@ class CXFA_WideTextRead : public IFX_Stream { virtual FX_BOOL SetLength(int32_t iLength) { return FALSE; } virtual int32_t GetBOM(uint8_t bom[4]) const { return 0; } - virtual FX_WORD GetCodePage() const; - virtual FX_WORD SetCodePage(FX_WORD wCodePage); + virtual uint16_t GetCodePage() const; + virtual uint16_t SetCodePage(uint16_t wCodePage); virtual void Lock() {} virtual void Unlock() {} diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp index c3ec203fa0..05706d4eb2 100644 --- a/xfa/fxfa/parser/xfa_localemgr.cpp +++ b/xfa/fxfa/parser/xfa_localemgr.cpp @@ -1060,8 +1060,8 @@ static IFX_Locale* XFA_GetLocaleFromBuffer(const uint8_t* pBuf, int nBufLen) { } return NULL; } -static FX_WORD XFA_GetLanguage(CFX_WideString wsLanguage) { - FX_WORD dwLangueID = XFA_LANGID_en_US; +static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) { + uint16_t dwLangueID = XFA_LANGID_en_US; if (wsLanguage.GetLength() < 2) { return dwLangueID; } @@ -1147,7 +1147,7 @@ CXFA_LocaleMgr::~CXFA_LocaleMgr() { void CXFA_LocaleMgr::Release() { delete this; } -FX_WORD CXFA_LocaleMgr::GetDefLocaleID() { +uint16_t CXFA_LocaleMgr::GetDefLocaleID() { return m_dwDeflcid; } IFX_Locale* CXFA_LocaleMgr::GetDefLocale() { @@ -1163,7 +1163,7 @@ IFX_Locale* CXFA_LocaleMgr::GetDefLocale() { m_XMLLocaleArray.Add(m_pDefLocale); return m_pDefLocale; } -IFX_Locale* CXFA_LocaleMgr::GetLocale(FX_WORD lcid) { +IFX_Locale* CXFA_LocaleMgr::GetLocale(uint16_t lcid) { IFX_Locale* pLocal = NULL; switch (lcid) { case XFA_LANGID_zh_CN: @@ -1236,7 +1236,7 @@ IFX_Locale* CXFA_LocaleMgr::GetLocaleByName( return pLocale; } } - FX_WORD dwLangueID = XFA_GetLanguage(wsLocaleName); + uint16_t dwLangueID = XFA_GetLanguage(wsLocaleName); IFX_Locale* pLocale = GetLocale(dwLangueID); if (pLocale) m_XMLLocaleArray.Add(pLocale); diff --git a/xfa/fxfa/parser/xfa_localemgr.h b/xfa/fxfa/parser/xfa_localemgr.h index e296fc4663..a30d0cc1ad 100644 --- a/xfa/fxfa/parser/xfa_localemgr.h +++ b/xfa/fxfa/parser/xfa_localemgr.h @@ -35,9 +35,9 @@ class CXFA_LocaleMgr : public IFX_LocaleMgr { public: CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid); virtual void Release(); - virtual FX_WORD GetDefLocaleID(); + virtual uint16_t GetDefLocaleID(); virtual IFX_Locale* GetDefLocale(); - virtual IFX_Locale* GetLocale(FX_WORD lcid); + virtual IFX_Locale* GetLocale(uint16_t lcid); virtual IFX_Locale* GetLocaleByName(const CFX_WideStringC& wsLocaleName); ~CXFA_LocaleMgr(); void SetDefLocale(IFX_Locale* pLocale); @@ -48,8 +48,8 @@ class CXFA_LocaleMgr : public IFX_LocaleMgr { CFX_PtrArray m_XMLLocaleArray; IFX_Locale* m_pDefLocale; CFX_WideString m_wsConfigLocale; - FX_WORD m_dwDeflcid; - FX_WORD m_dwLocaleFlags; + uint16_t m_dwDeflcid; + uint16_t m_dwLocaleFlags; }; class IXFA_TimeZoneProvider { diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp index 8b3efa5951..b7ee9d48ad 100644 --- a/xfa/fxfa/parser/xfa_localevalue.cpp +++ b/xfa/fxfa/parser/xfa_localevalue.cpp @@ -591,16 +591,16 @@ FX_BOOL CXFA_LocaleValue::ValidateCanonicalValue(const CFX_WideString& wsValue, } FX_BOOL CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate, CFX_Unitime& unDate) { - const FX_WORD LastDay[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; - const FX_WORD wCountY = 4, wCountM = 2, wCountD = 2; + const uint16_t LastDay[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + const uint16_t wCountY = 4, wCountM = 2, wCountD = 2; int nLen = wsDate.GetLength(); if (nLen < wCountY || nLen > wCountY + wCountM + wCountD + 2) { return FALSE; } const bool bSymbol = wsDate.Find(0x2D) != -1; - FX_WORD wYear = 0; - FX_WORD wMonth = 0; - FX_WORD wDay = 0; + uint16_t wYear = 0; + uint16_t wMonth = 0; + uint16_t wDay = 0; const FX_WCHAR* pDate = (const FX_WCHAR*)wsDate; int nIndex = 0, nStart = 0; while (pDate[nIndex] != '\0' && nIndex < wCountY) { @@ -678,15 +678,15 @@ FX_BOOL CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) { int nLen = wsTime.GetLength(); if (nLen < 2) return FALSE; - const FX_WORD wCountH = 2; - const FX_WORD wCountM = 2; - const FX_WORD wCountS = 2; - const FX_WORD wCountF = 3; + const uint16_t wCountH = 2; + const uint16_t wCountM = 2; + const uint16_t wCountS = 2; + const uint16_t wCountF = 3; const bool bSymbol = wsTime.Find(':') != -1; - FX_WORD wHour = 0; - FX_WORD wMinute = 0; - FX_WORD wSecond = 0; - FX_WORD wFraction = 0; + uint16_t wHour = 0; + uint16_t wMinute = 0; + uint16_t wSecond = 0; + uint16_t wFraction = 0; const FX_WCHAR* pTime = (const FX_WCHAR*)wsTime; int nIndex = 0; int nStart = 0; diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h index 96dfeee39e..e50d6ab46f 100644 --- a/xfa/fxfa/parser/xfa_object.h +++ b/xfa/fxfa/parser/xfa_object.h @@ -585,7 +585,7 @@ class CXFA_Node : public CXFA_Object { XFA_ATTRIBUTE eAttribute); protected: - CXFA_Node(CXFA_Document* pDoc, FX_WORD ePacket, XFA_ELEMENT eElement); + CXFA_Node(CXFA_Document* pDoc, uint16_t ePacket, XFA_ELEMENT eElement); ~CXFA_Node(); friend class CXFA_Document; CXFA_Node* Deprecated_GetPrevSibling(); @@ -640,7 +640,7 @@ class CXFA_Node : public CXFA_Object { CXFA_Node* m_pParent; IFDE_XMLNode* m_pXMLNode; XFA_ELEMENT m_eNodeClass; - FX_WORD m_ePacket; + uint16_t m_ePacket; FX_DWORD m_dwNameHash; CXFA_Node* m_pAuxNode; XFA_MAPMODULEDATA* m_pMapModuleData; diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index f65e304066..368e919e11 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -85,7 +85,9 @@ static XFA_MAPDATABLOCKCALLBACKINFO deleteWideStringCallBack = { static XFA_OBJECTTYPE XFA_GetElementObjectType(XFA_ELEMENT eElement) { return (XFA_OBJECTTYPE)XFA_GetElementByID(eElement)->eObjectType; } -CXFA_Node::CXFA_Node(CXFA_Document* pDoc, FX_WORD ePacket, XFA_ELEMENT eElement) +CXFA_Node::CXFA_Node(CXFA_Document* pDoc, + uint16_t ePacket, + XFA_ELEMENT eElement) : CXFA_Object(pDoc, XFA_GetElementObjectType(eElement)), m_pNext(nullptr), m_pChild(nullptr), diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index f27e3a6c0f..638ce8b248 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -73,7 +73,7 @@ int32_t CXFA_SimpleParser::StartParse(IFX_FileRead* pStream, if (m_pStream == NULL) { return XFA_PARSESTATUS_StreamErr; } - FX_WORD wCodePage = m_pStream->GetCodePage(); + uint16_t wCodePage = m_pStream->GetCodePage(); if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE && wCodePage != FX_CODEPAGE_UTF8) { m_pStream->SetCodePage(FX_CODEPAGE_UTF8); diff --git a/xfa/fxfa/parser/xfa_parser_imp.h b/xfa/fxfa/parser/xfa_parser_imp.h index 136cae6744..f01ffa2123 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.h +++ b/xfa/fxfa/parser/xfa_parser_imp.h @@ -119,8 +119,8 @@ class CXFA_XMLParser : public IFDE_XMLParser { FX_FILESIZE m_nStart[2]; size_t m_nSize[2]; FX_FILESIZE m_nElementStart; - FX_WORD m_dwCheckStatus; - FX_WORD m_dwCurrentCheckStatus; + uint16_t m_dwCheckStatus; + uint16_t m_dwCurrentCheckStatus; protected: IFDE_XMLNode* m_pRoot; -- cgit v1.2.3