From b5e8f14e3eefc5da995b332788d3203cee204883 Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 25 Mar 2016 15:18:35 -0700 Subject: Remove FX_DWORD from core/ and delete definition Review URL: https://codereview.chromium.org/1832173003 --- core/fxcrt/include/fx_basic.h | 52 +++++++++++++++++++------------------- core/fxcrt/include/fx_ext.h | 16 ++++++------ core/fxcrt/include/fx_safe_types.h | 2 +- core/fxcrt/include/fx_stream.h | 6 ++--- core/fxcrt/include/fx_string.h | 6 ++--- core/fxcrt/include/fx_system.h | 23 ++++++++--------- core/fxcrt/include/fx_ucd.h | 22 ++++++++-------- core/fxcrt/include/fx_xml.h | 16 ++++++------ 8 files changed, 71 insertions(+), 72 deletions(-) (limited to 'core/fxcrt/include') diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h index 4f2e83c20b..8a7afda137 100644 --- a/core/fxcrt/include/fx_basic.h +++ b/core/fxcrt/include/fx_basic.h @@ -87,7 +87,7 @@ class CFX_ByteTextBuf : public CFX_BinaryBuf { CFX_ByteStringC GetByteString() const; CFX_ByteTextBuf& operator<<(int i); - CFX_ByteTextBuf& operator<<(FX_DWORD i); + CFX_ByteTextBuf& operator<<(uint32_t i); CFX_ByteTextBuf& operator<<(double f); CFX_ByteTextBuf& operator<<(const CFX_ByteStringC& lpsz); CFX_ByteTextBuf& operator<<(const CFX_ByteTextBuf& buf); @@ -124,7 +124,7 @@ class CFX_ArchiveSaver { CFX_ArchiveSaver& operator<<(int i); - CFX_ArchiveSaver& operator<<(FX_DWORD i); + CFX_ArchiveSaver& operator<<(uint32_t i); CFX_ArchiveSaver& operator<<(FX_FLOAT i); @@ -151,13 +151,13 @@ class CFX_ArchiveSaver { }; class CFX_ArchiveLoader { public: - CFX_ArchiveLoader(const uint8_t* pData, FX_DWORD dwSize); + CFX_ArchiveLoader(const uint8_t* pData, uint32_t dwSize); CFX_ArchiveLoader& operator>>(uint8_t& i); CFX_ArchiveLoader& operator>>(int& i); - CFX_ArchiveLoader& operator>>(FX_DWORD& i); + CFX_ArchiveLoader& operator>>(uint32_t& i); CFX_ArchiveLoader& operator>>(FX_FLOAT& i); @@ -169,14 +169,14 @@ class CFX_ArchiveLoader { FX_BOOL IsEOF(); - FX_BOOL Read(void* pBuf, FX_DWORD dwSize); + FX_BOOL Read(void* pBuf, uint32_t dwSize); protected: - FX_DWORD m_LoadingPos; + uint32_t m_LoadingPos; const uint8_t* m_pLoadingBuf; - FX_DWORD m_LoadingSize; + uint32_t m_LoadingSize; }; #endif // PDF_ENABLE_XFA @@ -189,7 +189,7 @@ class CFX_FileBufferArchive { bool Flush(); int32_t AppendBlock(const void* pBuf, size_t size); int32_t AppendByte(uint8_t byte); - int32_t AppendDWord(FX_DWORD i); + int32_t AppendDWord(uint32_t i); int32_t AppendString(const CFX_ByteStringC& lpsz); // |pFile| must outlive the CFX_FileBufferArchive. @@ -222,7 +222,7 @@ class CFX_UTF8Decoder { void Input(uint8_t byte); - void AppendChar(FX_DWORD ch); + void AppendChar(uint32_t ch); void ClearStatus() { m_PendingBytes = 0; } @@ -231,7 +231,7 @@ class CFX_UTF8Decoder { protected: int m_PendingBytes; - FX_DWORD m_PendingChar; + uint32_t m_PendingChar; CFX_WideTextBuf m_Buffer; }; @@ -631,14 +631,14 @@ class CFX_MapPtrToPtr { void*& rKey, void*& rValue) const; - FX_DWORD GetHashTableSize() const { return m_nHashTableSize; } + uint32_t GetHashTableSize() const { return m_nHashTableSize; } - void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow = TRUE); + void InitHashTable(uint32_t hashSize, FX_BOOL bAllocNow = TRUE); protected: CAssoc** m_pHashTable; - FX_DWORD m_nHashTableSize; + uint32_t m_nHashTableSize; int m_nCount; @@ -648,13 +648,13 @@ class CFX_MapPtrToPtr { int m_nBlockSize; - FX_DWORD HashKey(void* key) const; + uint32_t HashKey(void* key) const; CAssoc* NewAssoc(); void FreeAssoc(CAssoc* pAssoc); - CAssoc* GetAssocAt(void* key, FX_DWORD& hash) const; + CAssoc* GetAssocAt(void* key, uint32_t& hash) const; }; template @@ -792,8 +792,8 @@ class CFX_PrivateData { if (!module_id) { return FALSE; } - FX_DWORD nCount = m_DataList.GetSize(); - for (FX_DWORD n = 0; n < nCount; n++) { + uint32_t nCount = m_DataList.GetSize(); + for (uint32_t n = 0; n < nCount; n++) { if (m_DataList[n].m_pModuleId == module_id) { pData = m_DataList[n].m_pData; return TRUE; @@ -815,28 +815,28 @@ class CFX_PrivateData { class CFX_BitStream { public: - void Init(const uint8_t* pData, FX_DWORD dwSize); + void Init(const uint8_t* pData, uint32_t dwSize); - FX_DWORD GetBits(FX_DWORD nBits); + uint32_t GetBits(uint32_t nBits); void ByteAlign(); FX_BOOL IsEOF() { return m_BitPos >= m_BitSize; } - void SkipBits(FX_DWORD nBits) { m_BitPos += nBits; } + void SkipBits(uint32_t nBits) { m_BitPos += nBits; } void Rewind() { m_BitPos = 0; } - FX_DWORD GetPos() const { return m_BitPos; } + uint32_t GetPos() const { return m_BitPos; } - FX_DWORD BitsRemaining() const { + uint32_t BitsRemaining() const { return m_BitSize >= m_BitPos ? m_BitSize - m_BitPos : 0; } protected: - FX_DWORD m_BitPos; + uint32_t m_BitPos; - FX_DWORD m_BitSize; + uint32_t m_BitSize; const uint8_t* m_pData; }; @@ -1091,8 +1091,8 @@ typedef CFX_ListArrayTemplate, class IFX_Unknown { public: virtual ~IFX_Unknown() {} - virtual FX_DWORD Release() = 0; - virtual FX_DWORD AddRef() = 0; + virtual uint32_t Release() = 0; + virtual uint32_t AddRef() = 0; }; #define FX_IsOdd(a) ((a)&1) #endif // PDF_ENABLE_XFA diff --git a/core/fxcrt/include/fx_ext.h b/core/fxcrt/include/fx_ext.h index 2a39530c07..8492bc96aa 100644 --- a/core/fxcrt/include/fx_ext.h +++ b/core/fxcrt/include/fx_ext.h @@ -75,28 +75,28 @@ inline int FXSYS_toDecimalDigit(const FX_WCHAR c) { return std::iswdigit(c) ? c - L'0' : 0; } -FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, +uint32_t FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); -FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, +uint32_t FX_HashCode_String_GetW(const FX_WCHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); -void* FX_Random_MT_Start(FX_DWORD dwSeed); +void* FX_Random_MT_Start(uint32_t dwSeed); -FX_DWORD FX_Random_MT_Generate(void* pContext); +uint32_t FX_Random_MT_Generate(void* pContext); void FX_Random_MT_Close(void* pContext); -void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount); +void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount); -void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount); +void FX_Random_GenerateMT(uint32_t* pBuffer, int32_t iCount); -void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount); +void FX_Random_GenerateCrypto(uint32_t* pBuffer, int32_t iCount); #ifdef PDF_ENABLE_XFA typedef struct FX_GUID { - FX_DWORD data1; + uint32_t data1; uint16_t data2; uint16_t data3; uint8_t data4[8]; diff --git a/core/fxcrt/include/fx_safe_types.h b/core/fxcrt/include/fx_safe_types.h index 47eb55ddd5..84ea55a685 100644 --- a/core/fxcrt/include/fx_safe_types.h +++ b/core/fxcrt/include/fx_safe_types.h @@ -11,7 +11,7 @@ #include "core/fxcrt/include/fx_system.h" #include "third_party/base/numerics/safe_math.h" -typedef pdfium::base::CheckedNumeric FX_SAFE_DWORD; +typedef pdfium::base::CheckedNumeric FX_SAFE_DWORD; typedef pdfium::base::CheckedNumeric FX_SAFE_INT32; typedef pdfium::base::CheckedNumeric FX_SAFE_SIZE_T; typedef pdfium::base::CheckedNumeric FX_SAFE_FILESIZE; diff --git a/core/fxcrt/include/fx_stream.h b/core/fxcrt/include/fx_stream.h index 4b77796821..ba72994f36 100644 --- a/core/fxcrt/include/fx_stream.h +++ b/core/fxcrt/include/fx_stream.h @@ -114,8 +114,8 @@ class IFX_FileStream : public IFX_FileRead, public IFX_FileWrite { FX_BOOL Flush() override = 0; }; -IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes); -IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, FX_DWORD dwModes); +IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, uint32_t dwModes); +IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, uint32_t dwModes); #ifdef PDF_ENABLE_XFA class IFX_FileAccess { @@ -124,7 +124,7 @@ class IFX_FileAccess { virtual void Release() = 0; virtual IFX_FileAccess* Retain() = 0; virtual void GetPath(CFX_WideString& wsPath) = 0; - virtual IFX_FileStream* CreateFileStream(FX_DWORD dwModes) = 0; + virtual IFX_FileStream* CreateFileStream(uint32_t dwModes) = 0; }; IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath); #endif // PDF_ENABLE_XFA diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h index 4bca083dd0..e5f9466b21 100644 --- a/core/fxcrt/include/fx_string.h +++ b/core/fxcrt/include/fx_string.h @@ -89,7 +89,7 @@ class CFX_ByteStringC { return !(*this == other); } - FX_DWORD GetID(FX_STRSIZE start_pos = 0) const; + uint32_t GetID(FX_STRSIZE start_pos = 0) const; const uint8_t* GetPtr() const { return m_Ptr; } @@ -296,13 +296,13 @@ class CFX_ByteString { CFX_WideString UTF8Decode() const; - FX_DWORD GetID(FX_STRSIZE start_pos = 0) const; + uint32_t GetID(FX_STRSIZE start_pos = 0) const; #define FXFORMAT_SIGNED 1 #define FXFORMAT_HEX 2 #define FXFORMAT_CAPITAL 4 - static CFX_ByteString FormatInteger(int i, FX_DWORD flags = 0); + static CFX_ByteString FormatInteger(int i, uint32_t flags = 0); static CFX_ByteString FormatFloat(FX_FLOAT f, int precision = 0); protected: diff --git a/core/fxcrt/include/fx_system.h b/core/fxcrt/include/fx_system.h index 1d51aec543..22fdef2014 100644 --- a/core/fxcrt/include/fx_system.h +++ b/core/fxcrt/include/fx_system.h @@ -68,7 +68,6 @@ extern "C" { #endif typedef void* FX_POSITION; // Keep until fxcrt containers gone -typedef uint32_t FX_DWORD; // Keep - "an efficient type" typedef float FX_FLOAT; // Keep, allow upgrade to doubles. typedef double FX_DOUBLE; // Keep, allow downgrade to floats. typedef int FX_BOOL; // Keep, sadly not always 0 or 1. @@ -209,25 +208,25 @@ extern "C" { #else int FXSYS_GetACP(void); char* FXSYS_itoa(int value, char* str, int radix); -int FXSYS_WideCharToMultiByte(FX_DWORD codepage, - FX_DWORD dwFlags, +int FXSYS_WideCharToMultiByte(uint32_t codepage, + uint32_t dwFlags, const wchar_t* wstr, int wlen, char* buf, int buflen, const char* default_str, int* pUseDefault); -int FXSYS_MultiByteToWideChar(FX_DWORD codepage, - FX_DWORD dwFlags, +int FXSYS_MultiByteToWideChar(uint32_t codepage, + uint32_t dwFlags, const char* bstr, int blen, wchar_t* buf, int buflen); -FX_DWORD FXSYS_GetFullPathName(const char* filename, - FX_DWORD buflen, +uint32_t FXSYS_GetFullPathName(const char* filename, + uint32_t buflen, char* buf, char** filepart); -FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize); +uint32_t FXSYS_GetModuleFileName(void* hModule, char* buf, uint32_t bufsize); char* FXSYS_strlwr(char* str); char* FXSYS_strupr(char* str); int FXSYS_stricmp(const char*, const char*); @@ -254,11 +253,11 @@ wchar_t* FXSYS_wcsupr(wchar_t* str); #define FXSYS_fmod(a, b) (FX_FLOAT) fmod(a, b) #define FXSYS_abs abs #define FXDWORD_GET_LSBFIRST(p) \ - ((static_cast(p[3]) << 24) | (static_cast(p[2]) << 16) | \ - (static_cast(p[1]) << 8) | (static_cast(p[0]))) + ((static_cast(p[3]) << 24) | (static_cast(p[2]) << 16) | \ + (static_cast(p[1]) << 8) | (static_cast(p[0]))) #define FXDWORD_GET_MSBFIRST(p) \ - ((static_cast(p[0]) << 24) | (static_cast(p[1]) << 16) | \ - (static_cast(p[2]) << 8) | (static_cast(p[3]))) + ((static_cast(p[0]) << 24) | (static_cast(p[1]) << 16) | \ + (static_cast(p[2]) << 8) | (static_cast(p[3]))) #define FXSYS_HIBYTE(word) ((uint8_t)((word) >> 8)) #define FXSYS_LOBYTE(word) ((uint8_t)(word)) #define FXSYS_HIWORD(dword) ((uint16_t)((dword) >> 16)) diff --git a/core/fxcrt/include/fx_ucd.h b/core/fxcrt/include/fx_ucd.h index f2e4215aa8..90f89486f1 100644 --- a/core/fxcrt/include/fx_ucd.h +++ b/core/fxcrt/include/fx_ucd.h @@ -35,7 +35,7 @@ enum FX_BIDICLASS { FX_BIDICLASS_N = FX_BIDICLASS_ON, }; -extern const FX_DWORD kTextLayoutCodeProperties[]; +extern const uint32_t kTextLayoutCodeProperties[]; extern const size_t kTextLayoutCodePropertiesSize; extern const uint16_t kFXTextLayoutVerticalMirror[]; @@ -44,7 +44,7 @@ extern const size_t kFXTextLayoutVerticalMirrorSize; extern const uint16_t kFXTextLayoutBidiMirror[]; extern const size_t kFXTextLayoutBidiMirrorSize; -FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch); +uint32_t FX_GetUnicodeProperties(FX_WCHAR wch); FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical); #ifdef PDF_ENABLE_XFA @@ -110,7 +110,7 @@ enum FX_CHARTYPE { FX_BOOL FX_IsCtrlCode(FX_WCHAR ch); FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, - FX_DWORD dwProps, + uint32_t dwProps, FX_BOOL bRTL, FX_BOOL bVertical); class CFX_Char { @@ -124,7 +124,7 @@ class CFX_Char { m_iCharWidth(0), m_iHorizontalScale(100), m_iVertialScale(100) {} - CFX_Char(uint16_t wCharCode, FX_DWORD dwCharProps) + CFX_Char(uint16_t wCharCode, uint32_t dwCharProps) : m_wCharCode(wCharCode), m_nBreakType(0), m_nRotation(0), @@ -133,12 +133,12 @@ class CFX_Char { m_iCharWidth(0), m_iHorizontalScale(100), m_iVertialScale(100) {} - FX_DWORD GetCharType() const { return m_dwCharProps & FX_CHARTYPEBITSMASK; } + uint32_t GetCharType() const { return m_dwCharProps & FX_CHARTYPEBITSMASK; } uint16_t m_wCharCode; uint8_t m_nBreakType; int8_t m_nRotation; - FX_DWORD m_dwCharProps; - FX_DWORD m_dwCharStyles; + uint32_t m_dwCharProps; + uint32_t m_dwCharStyles; int32_t m_iCharWidth; int32_t m_iHorizontalScale; int32_t m_iVertialScale; @@ -154,7 +154,7 @@ class CFX_TxtChar : public CFX_Char { m_iBidiPos(0), m_iBidiOrder(0), m_pUserData(NULL) {} - FX_DWORD m_dwStatus; + uint32_t m_dwStatus; int16_t m_iBidiClass; int16_t m_iBidiLevel; int16_t m_iBidiPos; @@ -175,15 +175,15 @@ class CFX_RTFChar : public CFX_Char { m_dwLayoutStyles(0), m_dwIdentity(0), m_pUserData(NULL) {} - FX_DWORD m_dwStatus; + uint32_t m_dwStatus; int32_t m_iFontSize; int32_t m_iFontHeight; int16_t m_iBidiClass; int16_t m_iBidiLevel; int16_t m_iBidiPos; int16_t m_iBidiOrder; - FX_DWORD m_dwLayoutStyles; - FX_DWORD m_dwIdentity; + uint32_t m_dwLayoutStyles; + uint32_t m_dwIdentity; IFX_Unknown* m_pUserData; }; typedef CFX_ArrayTemplate CFX_RTFCharArray; diff --git a/core/fxcrt/include/fx_xml.h b/core/fxcrt/include/fx_xml.h index 66add1befc..3e22883c7f 100644 --- a/core/fxcrt/include/fx_xml.h +++ b/core/fxcrt/include/fx_xml.h @@ -71,7 +71,7 @@ class CXML_Element { CFX_ByteString GetNamespace(FX_BOOL bQualified = FALSE) const; CFX_ByteString GetNamespaceURI(const CFX_ByteStringC& qName) const; CXML_Element* GetParent() const { return m_pParent; } - FX_DWORD CountAttrs() const { return m_AttrMap.GetSize(); } + uint32_t CountAttrs() const { return m_AttrMap.GetSize(); } void GetAttrByIndex(int index, CFX_ByteString& space, CFX_ByteString& name, @@ -129,26 +129,26 @@ class CXML_Element { return attr; } - FX_DWORD CountChildren() const { return m_Children.size(); } - ChildType GetChildType(FX_DWORD index) const; - CFX_WideString GetContent(FX_DWORD index) const; - CXML_Element* GetElement(FX_DWORD index) const; + uint32_t CountChildren() const { return m_Children.size(); } + ChildType GetChildType(uint32_t index) const; + CFX_WideString GetContent(uint32_t index) const; + CXML_Element* GetElement(uint32_t index) const; CXML_Element* GetElement(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const { return GetElement(space, tag, 0); } - FX_DWORD CountElements(const CFX_ByteStringC& space, + uint32_t CountElements(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const; CXML_Element* GetElement(const CFX_ByteStringC& space, const CFX_ByteStringC& tag, int index) const; - FX_DWORD FindElement(CXML_Element* pChild) const; + uint32_t FindElement(CXML_Element* pChild) const; void SetTag(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagname); void SetTag(const CFX_ByteStringC& qTagName); void RemoveChildren(); - void RemoveChild(FX_DWORD index); + void RemoveChild(uint32_t index); protected: struct ChildRecord { -- cgit v1.2.3