diff options
author | tsepez <tsepez@chromium.org> | 2016-03-25 15:18:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-25 15:18:36 -0700 |
commit | b5e8f14e3eefc5da995b332788d3203cee204883 (patch) | |
tree | 34fc80504d2034013b18f30df1b0f6f1a94e2d70 /core/fxcrt | |
parent | 6d18bd3b8ec82ae3c24a439f5c7925786a0e2d8b (diff) | |
download | pdfium-b5e8f14e3eefc5da995b332788d3203cee204883.tar.xz |
Remove FX_DWORD from core/ and delete definitionchromium/2695chromium/2694chromium/2693chromium/2692
Review URL: https://codereview.chromium.org/1832173003
Diffstat (limited to 'core/fxcrt')
29 files changed, 197 insertions, 198 deletions
diff --git a/core/fxcrt/extension.h b/core/fxcrt/extension.h index 1789de33aa..a9f3c23d29 100644 --- a/core/fxcrt/extension.h +++ b/core/fxcrt/extension.h @@ -15,8 +15,8 @@ class IFXCRT_FileAccess { public: virtual ~IFXCRT_FileAccess() {} - virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) = 0; - virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) = 0; + virtual FX_BOOL Open(const CFX_ByteStringC& fileName, uint32_t dwMode) = 0; + virtual FX_BOOL Open(const CFX_WideStringC& fileName, uint32_t dwMode) = 0; virtual void Close() = 0; virtual void Release() = 0; virtual FX_FILESIZE GetSize() const = 0; @@ -51,7 +51,7 @@ class CFX_CRTFileAccess : public IFX_FileAccess { void GetPath(CFX_WideString& wsPath) override { wsPath = m_path; } - IFX_FileStream* CreateFileStream(FX_DWORD dwModes) override { + IFX_FileStream* CreateFileStream(uint32_t dwModes) override { return FX_CreateFileStream(m_path, dwModes); } @@ -63,7 +63,7 @@ class CFX_CRTFileAccess : public IFX_FileAccess { protected: CFX_WideString m_path; - FX_DWORD m_RefCount; + uint32_t m_RefCount; }; #endif // PDF_ENABLE_XFA @@ -87,7 +87,7 @@ class CFX_CRTFileStream final : public IFX_FileStream { protected: IFXCRT_FileAccess* m_pFile; - FX_DWORD m_dwCount; + uint32_t m_dwCount; }; #define FX_MEMSTREAM_BlockSize (64 * 1024) @@ -129,7 +129,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream { return this; } void Release() override { - FX_DWORD nCount = --m_dwCount; + uint32_t nCount = --m_dwCount; if (nCount) { return; } @@ -282,12 +282,12 @@ class CFX_MemoryStream final : public IFX_MemoryStream { protected: CFX_ArrayTemplate<uint8_t*> m_Blocks; - FX_DWORD m_dwCount; + uint32_t m_dwCount; size_t m_nTotalSize; size_t m_nCurSize; size_t m_nCurPos; size_t m_nGrowSize; - FX_DWORD m_dwFlags; + uint32_t m_dwFlags; FX_BOOL ExpandBlocks(size_t size) { if (m_nCurSize < size) { m_nCurSize = size; @@ -320,12 +320,12 @@ struct FX_MTRANDOMCONTEXT { mti = MT_N + 1; bHaveSeed = FALSE; } - FX_DWORD mti; + uint32_t mti; FX_BOOL bHaveSeed; - FX_DWORD mt[MT_N]; + uint32_t mt[MT_N]; }; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount); +FX_BOOL FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount); #endif #ifdef __cplusplus } diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp index 10113c9d5e..95fa8f52a0 100644 --- a/core/fxcrt/fx_arabic.cpp +++ b/core/fxcrt/fx_arabic.cpp @@ -149,7 +149,7 @@ IFX_ArabicChar* IFX_ArabicChar::Create() { return new CFX_ArabicChar; } FX_BOOL CFX_ArabicChar::IsArabicChar(FX_WCHAR wch) const { - FX_DWORD dwRet = + uint32_t dwRet = kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK; return dwRet >= FX_CHARTYPE_ArabicAlef; } diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp index 191694e415..ab9299694e 100644 --- a/core/fxcrt/fx_basic_bstring.cpp +++ b/core/fxcrt/fx_basic_bstring.cpp @@ -11,14 +11,14 @@ #include "core/fxcrt/include/fx_basic.h" #include "third_party/base/numerics/safe_math.h" -static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) { +static int _Buffer_itoa(char* buf, int i, uint32_t flags) { if (i == 0) { buf[0] = '0'; return 1; } char buf1[32]; int buf_pos = 31; - FX_DWORD u = i; + uint32_t u = i; if ((flags & FXFORMAT_SIGNED) && i < 0) { u = -i; } @@ -43,7 +43,7 @@ static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) { } return len; } -CFX_ByteString CFX_ByteString::FormatInteger(int i, FX_DWORD flags) { +CFX_ByteString CFX_ByteString::FormatInteger(int i, uint32_t flags) { char buf[32]; return CFX_ByteStringC(buf, _Buffer_itoa(buf, i, flags)); } @@ -1012,17 +1012,17 @@ void CFX_ByteString::TrimLeft(FX_CHAR chTarget) { void CFX_ByteString::TrimLeft() { TrimLeft("\x09\x0a\x0b\x0c\x0d\x20"); } -FX_DWORD CFX_ByteString::GetID(FX_STRSIZE start_pos) const { +uint32_t CFX_ByteString::GetID(FX_STRSIZE start_pos) const { return CFX_ByteStringC(*this).GetID(start_pos); } -FX_DWORD CFX_ByteStringC::GetID(FX_STRSIZE start_pos) const { +uint32_t CFX_ByteStringC::GetID(FX_STRSIZE start_pos) const { if (m_Length == 0) { return 0; } if (start_pos < 0 || start_pos >= m_Length) { return 0; } - FX_DWORD strid = 0; + uint32_t strid = 0; if (start_pos + 4 > m_Length) { for (FX_STRSIZE i = 0; i < m_Length - start_pos; i++) { strid = strid * 256 + m_Ptr[start_pos + i]; diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp index aa899b6c17..28c8ac0f32 100644 --- a/core/fxcrt/fx_basic_buffer.cpp +++ b/core/fxcrt/fx_basic_buffer.cpp @@ -116,7 +116,7 @@ CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(int i) { return *this; } -CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(FX_DWORD i) { +CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(uint32_t i) { char buf[32]; FXSYS_itoa(i, buf, 10); AppendBlock(buf, FXSYS_strlen(buf)); @@ -208,11 +208,11 @@ CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(int i) { } return *this; } -CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(FX_DWORD i) { +CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(uint32_t i) { if (m_pStream) { - m_pStream->WriteBlock(&i, sizeof(FX_DWORD)); + m_pStream->WriteBlock(&i, sizeof(uint32_t)); } else { - m_SavingBuf.AppendBlock(&i, sizeof(FX_DWORD)); + m_SavingBuf.AppendBlock(&i, sizeof(uint32_t)); } return *this; } @@ -257,7 +257,7 @@ void CFX_ArchiveSaver::Write(const void* pData, FX_STRSIZE dwSize) { m_SavingBuf.AppendBlock(pData, dwSize); } } -CFX_ArchiveLoader::CFX_ArchiveLoader(const uint8_t* pData, FX_DWORD dwSize) { +CFX_ArchiveLoader::CFX_ArchiveLoader(const uint8_t* pData, uint32_t dwSize) { m_pLoadingBuf = pData; m_LoadingPos = 0; m_LoadingSize = dwSize; @@ -276,8 +276,8 @@ CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(int& i) { Read(&i, sizeof(int)); return *this; } -CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(FX_DWORD& i) { - Read(&i, sizeof(FX_DWORD)); +CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(uint32_t& i) { + Read(&i, sizeof(uint32_t)); return *this; } CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(FX_FLOAT& i) { @@ -308,7 +308,7 @@ CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(CFX_WideString& str) { encoded.GetLength() / sizeof(unsigned short)); return *this; } -FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) { +FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, uint32_t dwSize) { if (m_LoadingPos + dwSize > m_LoadingSize) { return FALSE; } @@ -318,7 +318,7 @@ FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) { } #endif // PDF_ENABLE_XFA -void CFX_BitStream::Init(const uint8_t* pData, FX_DWORD dwSize) { +void CFX_BitStream::Init(const uint8_t* pData, uint32_t dwSize) { m_pData = pData; m_BitSize = dwSize * 8; m_BitPos = 0; @@ -330,7 +330,7 @@ void CFX_BitStream::ByteAlign() { } m_BitPos += 8 - mod; } -FX_DWORD CFX_BitStream::GetBits(FX_DWORD nBits) { +uint32_t CFX_BitStream::GetBits(uint32_t nBits) { if (nBits > m_BitSize || m_BitPos + nBits > m_BitSize) { return 0; } @@ -339,9 +339,9 @@ FX_DWORD CFX_BitStream::GetBits(FX_DWORD nBits) { m_BitPos++; return bit; } - FX_DWORD byte_pos = m_BitPos / 8; - FX_DWORD bit_pos = m_BitPos % 8, bit_left = nBits; - FX_DWORD result = 0; + uint32_t byte_pos = m_BitPos / 8; + uint32_t bit_pos = m_BitPos % 8, bit_left = nBits; + uint32_t result = 0; if (bit_pos) { if (8 - bit_pos >= bit_left) { result = @@ -412,7 +412,7 @@ int32_t CFX_FileBufferArchive::AppendByte(uint8_t byte) { return AppendBlock(&byte, 1); } -int32_t CFX_FileBufferArchive::AppendDWord(FX_DWORD i) { +int32_t CFX_FileBufferArchive::AppendDWord(uint32_t i) { char buf[32]; FXSYS_itoa(i, buf, 10); return AppendBlock(buf, (size_t)FXSYS_strlen(buf)); diff --git a/core/fxcrt/fx_basic_gcc.cpp b/core/fxcrt/fx_basic_gcc.cpp index c29c9956e2..1b2f01ec89 100644 --- a/core/fxcrt/fx_basic_gcc.cpp +++ b/core/fxcrt/fx_basic_gcc.cpp @@ -107,8 +107,8 @@ extern "C" { int FXSYS_GetACP() { return 0; } -FX_DWORD FXSYS_GetFullPathName(const FX_CHAR* filename, - FX_DWORD buflen, +uint32_t FXSYS_GetFullPathName(const FX_CHAR* filename, + uint32_t buflen, FX_CHAR* buf, FX_CHAR** filepart) { int srclen = FXSYS_strlen(filename); @@ -118,8 +118,8 @@ FX_DWORD FXSYS_GetFullPathName(const FX_CHAR* filename, FXSYS_strcpy(buf, filename); return srclen; } -FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize) { - return (FX_DWORD)-1; +uint32_t FXSYS_GetModuleFileName(void* hModule, char* buf, uint32_t bufsize) { + return (uint32_t)-1; } #ifdef __cplusplus } @@ -212,8 +212,8 @@ char* FXSYS_itoa(int value, char* str, int radix) { #ifdef __cplusplus extern "C" { #endif -int FXSYS_WideCharToMultiByte(FX_DWORD codepage, - FX_DWORD dwFlags, +int FXSYS_WideCharToMultiByte(uint32_t codepage, + uint32_t dwFlags, const FX_WCHAR* wstr, int wlen, FX_CHAR* buf, @@ -231,8 +231,8 @@ int FXSYS_WideCharToMultiByte(FX_DWORD codepage, } return len; } -int FXSYS_MultiByteToWideChar(FX_DWORD codepage, - FX_DWORD dwFlags, +int FXSYS_MultiByteToWideChar(uint32_t codepage, + uint32_t dwFlags, const FX_CHAR* bstr, int blen, FX_WCHAR* buf, diff --git a/core/fxcrt/fx_basic_maps.cpp b/core/fxcrt/fx_basic_maps.cpp index 935c998deb..660306b11a 100644 --- a/core/fxcrt/fx_basic_maps.cpp +++ b/core/fxcrt/fx_basic_maps.cpp @@ -28,8 +28,8 @@ CFX_MapPtrToPtr::~CFX_MapPtrToPtr() { RemoveAll(); ASSERT(m_nCount == 0); } -FX_DWORD CFX_MapPtrToPtr::HashKey(void* key) const { - return ((FX_DWORD)(uintptr_t)key) >> 4; +uint32_t CFX_MapPtrToPtr::HashKey(void* key) const { + return ((uint32_t)(uintptr_t)key) >> 4; } void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, void*& rKey, @@ -38,7 +38,7 @@ void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, CAssoc* pAssocRet = (CAssoc*)rNextPosition; ASSERT(pAssocRet); if (pAssocRet == (CAssoc*)-1) { - for (FX_DWORD nBucket = 0; nBucket < m_nHashTableSize; nBucket++) { + for (uint32_t nBucket = 0; nBucket < m_nHashTableSize; nBucket++) { pAssocRet = m_pHashTable[nBucket]; if (pAssocRet) break; @@ -46,7 +46,7 @@ void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, ASSERT(pAssocRet); } CAssoc* pAssocNext = pAssocRet->pNext; - for (FX_DWORD nBucket = (HashKey(pAssocRet->key) % m_nHashTableSize) + 1; + for (uint32_t nBucket = (HashKey(pAssocRet->key) % m_nHashTableSize) + 1; nBucket < m_nHashTableSize && !pAssocNext; nBucket++) { pAssocNext = m_pHashTable[nBucket]; } @@ -55,7 +55,7 @@ void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, rValue = pAssocRet->value; } FX_BOOL CFX_MapPtrToPtr::Lookup(void* key, void*& rValue) const { - FX_DWORD nHash; + uint32_t nHash; CAssoc* pAssoc = GetAssocAt(key, nHash); if (!pAssoc) { return FALSE; @@ -64,7 +64,7 @@ FX_BOOL CFX_MapPtrToPtr::Lookup(void* key, void*& rValue) const { return TRUE; } void* CFX_MapPtrToPtr::GetValueAt(void* key) const { - FX_DWORD nHash; + uint32_t nHash; CAssoc* pAssoc = GetAssocAt(key, nHash); if (!pAssoc) { return NULL; @@ -72,7 +72,7 @@ void* CFX_MapPtrToPtr::GetValueAt(void* key) const { return pAssoc->value; } void*& CFX_MapPtrToPtr::operator[](void* key) { - FX_DWORD nHash; + uint32_t nHash; CAssoc* pAssoc; if ((pAssoc = GetAssocAt(key, nHash)) == NULL) { if (!m_pHashTable) { @@ -86,7 +86,7 @@ void*& CFX_MapPtrToPtr::operator[](void* key) { return pAssoc->value; } CFX_MapPtrToPtr::CAssoc* CFX_MapPtrToPtr::GetAssocAt(void* key, - FX_DWORD& nHash) const { + uint32_t& nHash) const { nHash = HashKey(key) % m_nHashTableSize; if (!m_pHashTable) { return NULL; @@ -118,7 +118,7 @@ CFX_MapPtrToPtr::CAssoc* CFX_MapPtrToPtr::NewAssoc() { pAssoc->value = 0; return pAssoc; } -void CFX_MapPtrToPtr::InitHashTable(FX_DWORD nHashSize, FX_BOOL bAllocNow) { +void CFX_MapPtrToPtr::InitHashTable(uint32_t nHashSize, FX_BOOL bAllocNow) { ASSERT(m_nCount == 0); ASSERT(nHashSize > 0); FX_Free(m_pHashTable); diff --git a/core/fxcrt/fx_basic_plex.cpp b/core/fxcrt/fx_basic_plex.cpp index 805f059063..99cc700dbf 100644 --- a/core/fxcrt/fx_basic_plex.cpp +++ b/core/fxcrt/fx_basic_plex.cpp @@ -8,8 +8,8 @@ #include "core/fxcrt/plex.h" CFX_Plex* CFX_Plex::Create(CFX_Plex*& pHead, - FX_DWORD nMax, - FX_DWORD cbElement) { + uint32_t nMax, + uint32_t cbElement) { CFX_Plex* p = (CFX_Plex*)FX_Alloc(uint8_t, sizeof(CFX_Plex) + nMax * cbElement); p->pNext = pHead; diff --git a/core/fxcrt/fx_basic_utf.cpp b/core/fxcrt/fx_basic_utf.cpp index 08b9ca6ba6..e1996999f8 100644 --- a/core/fxcrt/fx_basic_utf.cpp +++ b/core/fxcrt/fx_basic_utf.cpp @@ -10,7 +10,7 @@ void CFX_UTF8Decoder::Clear() { m_Buffer.Clear(); m_PendingBytes = 0; } -void CFX_UTF8Decoder::AppendChar(FX_DWORD ch) { +void CFX_UTF8Decoder::AppendChar(uint32_t ch) { m_Buffer.AppendChar((FX_WCHAR)ch); } void CFX_UTF8Decoder::Input(uint8_t byte) { @@ -44,20 +44,20 @@ void CFX_UTF8Decoder::Input(uint8_t byte) { } } void CFX_UTF8Encoder::Input(FX_WCHAR unicode) { - if ((FX_DWORD)unicode < 0x80) { + if ((uint32_t)unicode < 0x80) { m_Buffer.AppendChar(unicode); } else { - if ((FX_DWORD)unicode >= 0x80000000) { + if ((uint32_t)unicode >= 0x80000000) { return; } int nbytes = 0; - if ((FX_DWORD)unicode < 0x800) { + if ((uint32_t)unicode < 0x800) { nbytes = 2; - } else if ((FX_DWORD)unicode < 0x10000) { + } else if ((uint32_t)unicode < 0x10000) { nbytes = 3; - } else if ((FX_DWORD)unicode < 0x200000) { + } else if ((uint32_t)unicode < 0x200000) { nbytes = 4; - } else if ((FX_DWORD)unicode < 0x4000000) { + } else if ((uint32_t)unicode < 0x4000000) { nbytes = 5; } else { nbytes = 6; diff --git a/core/fxcrt/fx_bidi.cpp b/core/fxcrt/fx_bidi.cpp index 30b1a6df07..d8a8f88a64 100644 --- a/core/fxcrt/fx_bidi.cpp +++ b/core/fxcrt/fx_bidi.cpp @@ -13,7 +13,7 @@ CFX_BidiChar::CFX_BidiChar() : m_CurrentSegment({0, 0, NEUTRAL}), m_LastSegment({0, 0, NEUTRAL}) {} bool CFX_BidiChar::AppendChar(FX_WCHAR wch) { - FX_DWORD dwProps = FX_GetUnicodeProperties(wch); + uint32_t dwProps = FX_GetUnicodeProperties(wch); int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; Direction direction = NEUTRAL; switch (iBidiCls) { diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index 99190859b8..7e8029baba 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp @@ -29,7 +29,7 @@ IFX_FileStream* CFX_CRTFileStream::Retain() { } void CFX_CRTFileStream::Release() { - FX_DWORD nCount = --m_dwCount; + uint32_t nCount = --m_dwCount; if (!nCount) { delete this; } @@ -82,7 +82,7 @@ IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) { } #endif // PDF_ENABLE_XFA -IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes) { +IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, uint32_t dwModes) { IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(); if (!pFA) { return NULL; @@ -94,7 +94,7 @@ IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes) { return new CFX_CRTFileStream(pFA); } IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, - FX_DWORD dwModes) { + uint32_t dwModes) { IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(); if (!pFA) { return NULL; @@ -217,7 +217,7 @@ int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count) { } return ch1 - ch2; } -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) { FXSYS_assert(pStr); @@ -225,7 +225,7 @@ FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, iLength = (int32_t)FXSYS_strlen(pStr); } const FX_CHAR* pStrEnd = pStr + iLength; - FX_DWORD dwHashCode = 0; + uint32_t dwHashCode = 0; if (bIgnoreCase) { while (pStr < pStrEnd) { dwHashCode = 31 * dwHashCode + FXSYS_tolower(*pStr++); @@ -237,7 +237,7 @@ FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, } return dwHashCode; } -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) { FXSYS_assert(pStr); @@ -245,7 +245,7 @@ FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, iLength = (int32_t)FXSYS_wcslen(pStr); } const FX_WCHAR* pStrEnd = pStr + iLength; - FX_DWORD dwHashCode = 0; + uint32_t dwHashCode = 0; if (bIgnoreCase) { while (pStr < pStrEnd) { dwHashCode = 1313 * dwHashCode + FXSYS_tolower(*pStr++); @@ -258,29 +258,29 @@ FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, return dwHashCode; } -void* FX_Random_MT_Start(FX_DWORD dwSeed) { +void* FX_Random_MT_Start(uint32_t dwSeed) { FX_MTRANDOMCONTEXT* pContext = FX_Alloc(FX_MTRANDOMCONTEXT, 1); pContext->mt[0] = dwSeed; - FX_DWORD& i = pContext->mti; - FX_DWORD* pBuf = pContext->mt; + uint32_t& i = pContext->mti; + uint32_t* pBuf = pContext->mt; for (i = 1; i < MT_N; i++) { pBuf[i] = (1812433253UL * (pBuf[i - 1] ^ (pBuf[i - 1] >> 30)) + i); } pContext->bHaveSeed = TRUE; return pContext; } -FX_DWORD FX_Random_MT_Generate(void* pContext) { +uint32_t FX_Random_MT_Generate(void* pContext) { FXSYS_assert(pContext); FX_MTRANDOMCONTEXT* pMTC = static_cast<FX_MTRANDOMCONTEXT*>(pContext); - FX_DWORD v; - static FX_DWORD mag[2] = {0, MT_Matrix_A}; - FX_DWORD& mti = pMTC->mti; - FX_DWORD* pBuf = pMTC->mt; + uint32_t v; + static uint32_t mag[2] = {0, MT_Matrix_A}; + uint32_t& mti = pMTC->mti; + uint32_t* pBuf = pMTC->mt; if ((int)mti < 0 || mti >= MT_N) { if (mti > MT_N && !pMTC->bHaveSeed) { return 0; } - FX_DWORD kk; + uint32_t kk; for (kk = 0; kk < MT_N - MT_M; kk++) { v = (pBuf[kk] & MT_Upper_Mask) | (pBuf[kk + 1] & MT_Lower_Mask); pBuf[kk] = pBuf[kk + MT_M] ^ (v >> 1) ^ mag[v & 1]; @@ -304,8 +304,8 @@ void FX_Random_MT_Close(void* pContext) { FXSYS_assert(pContext); FX_Free(pContext); } -void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount) { - FX_DWORD dwSeed; +void FX_Random_GenerateMT(uint32_t* pBuffer, int32_t iCount) { + uint32_t dwSeed; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ if (!FX_GenerateCryptoRandom(&dwSeed, 1)) { FX_Random_GenerateBase(&dwSeed, 1); @@ -319,18 +319,18 @@ void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount) { } FX_Random_MT_Close(pContext); } -void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount) { +void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ SYSTEMTIME st1, st2; ::GetSystemTime(&st1); do { ::GetSystemTime(&st2); } while (FXSYS_memcmp(&st1, &st2, sizeof(SYSTEMTIME)) == 0); - FX_DWORD dwHash1 = + uint32_t dwHash1 = FX_HashCode_String_GetA((const FX_CHAR*)&st1, sizeof(st1), TRUE); - FX_DWORD dwHash2 = + uint32_t dwHash2 = FX_HashCode_String_GetA((const FX_CHAR*)&st2, sizeof(st2), TRUE); - ::srand((dwHash1 << 16) | (FX_DWORD)dwHash2); + ::srand((dwHash1 << 16) | (uint32_t)dwHash2); #else time_t tmLast = time(NULL); time_t tmCur; @@ -341,21 +341,21 @@ void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount) { ::srand((tmCur << 16) | (tmLast & 0xFFFF)); #endif while (iCount-- > 0) { - *pBuffer++ = (FX_DWORD)((::rand() << 16) | (::rand() & 0xFFFF)); + *pBuffer++ = (uint32_t)((::rand() << 16) | (::rand() & 0xFFFF)); } } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount) { +FX_BOOL FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount) { HCRYPTPROV hCP = NULL; if (!::CryptAcquireContext(&hCP, NULL, NULL, PROV_RSA_FULL, 0) || !hCP) { return FALSE; } - ::CryptGenRandom(hCP, iCount * sizeof(FX_DWORD), (uint8_t*)pBuffer); + ::CryptGenRandom(hCP, iCount * sizeof(uint32_t), (uint8_t*)pBuffer); ::CryptReleaseContext(hCP, 0); return TRUE; } #endif -void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) { +void FX_Random_GenerateCrypto(uint32_t* pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ FX_GenerateCryptoRandom(pBuffer, iCount); #else @@ -365,7 +365,7 @@ void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) { #ifdef PDF_ENABLE_XFA void FX_GUID_CreateV4(FX_LPGUID pGUID) { - FX_Random_GenerateMT((FX_DWORD*)pGUID, 4); + FX_Random_GenerateMT((uint32_t*)pGUID, 4); uint8_t& b = ((uint8_t*)pGUID)[6]; b = (b & 0x0F) | 0x40; } diff --git a/core/fxcrt/fx_ucddata.cpp b/core/fxcrt/fx_ucddata.cpp index 783d5653b8..1567d454f8 100644 --- a/core/fxcrt/fx_ucddata.cpp +++ b/core/fxcrt/fx_ucddata.cpp @@ -7,7 +7,7 @@ #include "core/fxcrt/include/fx_basic.h" #include "core/fxcrt/include/fx_ucd.h" -const FX_DWORD kTextLayoutCodeProperties[] = { +const uint32_t kTextLayoutCodeProperties[] = { 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe8ae5, 0xfffe9b5c, 0xfffe9ada, 0xfffe9b1a, 0xfffe9b5b, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, diff --git a/core/fxcrt/fx_unicode.cpp b/core/fxcrt/fx_unicode.cpp index 296ead84bb..d042283a32 100644 --- a/core/fxcrt/fx_unicode.cpp +++ b/core/fxcrt/fx_unicode.cpp @@ -6,7 +6,7 @@ #include "core/fxcrt/include/fx_ucd.h" -FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch) { +uint32_t FX_GetUnicodeProperties(FX_WCHAR wch) { size_t idx = static_cast<size_t>(wch); if (idx < kTextLayoutCodePropertiesSize) return kTextLayoutCodeProperties[(uint16_t)wch]; @@ -15,14 +15,14 @@ FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch) { #ifdef PDF_ENABLE_XFA FX_BOOL FX_IsCtrlCode(FX_WCHAR ch) { - FX_DWORD dwRet = (FX_GetUnicodeProperties(ch) & FX_CHARTYPEBITSMASK); + uint32_t dwRet = (FX_GetUnicodeProperties(ch) & FX_CHARTYPEBITSMASK); return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control; } #endif // PDF_ENABLE_XFA FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) { - FX_DWORD dwProps = FX_GetUnicodeProperties(wch); - FX_DWORD dwTemp = (dwProps & 0xFF800000); + uint32_t dwProps = FX_GetUnicodeProperties(wch); + uint32_t dwTemp = (dwProps & 0xFF800000); if (bRTL && dwTemp < 0xFF800000) { size_t idx = dwTemp >> 23; if (idx < kFXTextLayoutBidiMirrorSize) { @@ -43,10 +43,10 @@ FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) { #ifdef PDF_ENABLE_XFA FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, - FX_DWORD dwProps, + uint32_t dwProps, FX_BOOL bRTL, FX_BOOL bVertical) { - FX_DWORD dwTemp = (dwProps & 0xFF800000); + uint32_t dwTemp = (dwProps & 0xFF800000); if (bRTL && dwTemp < 0xFF800000) { size_t idx = dwTemp >> 23; if (idx < kFXTextLayoutBidiMirrorSize) { diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp index 43f8c54366..9cdf73ca90 100644 --- a/core/fxcrt/fx_xml_parser.cpp +++ b/core/fxcrt/fx_xml_parser.cpp @@ -179,7 +179,7 @@ void CXML_Parser::SkipLiterals(const CFX_ByteStringC& str) { } m_dwIndex = m_dwBufferSize; } -FX_DWORD CXML_Parser::GetCharRef() { +uint32_t CXML_Parser::GetCharRef() { m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; if (IsEOF()) { return 0; @@ -187,7 +187,7 @@ FX_DWORD CXML_Parser::GetCharRef() { uint8_t ch; int32_t iState = 0; CFX_ByteTextBuf buf; - FX_DWORD code = 0; + uint32_t code = 0; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex]; @@ -689,10 +689,10 @@ FX_BOOL CXML_Element::GetAttrFloat(const CFX_ByteStringC& space, } return FALSE; } -CXML_Element::ChildType CXML_Element::GetChildType(FX_DWORD index) const { +CXML_Element::ChildType CXML_Element::GetChildType(uint32_t index) const { return index < m_Children.size() ? m_Children[index].type : Invalid; } -CFX_WideString CXML_Element::GetContent(FX_DWORD index) const { +CFX_WideString CXML_Element::GetContent(uint32_t index) const { if (index < m_Children.size() && m_Children[index].type == Content) { CXML_Content* pContent = static_cast<CXML_Content*>(m_Children[index].child); @@ -701,13 +701,13 @@ CFX_WideString CXML_Element::GetContent(FX_DWORD index) const { } return CFX_WideString(); } -CXML_Element* CXML_Element::GetElement(FX_DWORD index) const { +CXML_Element* CXML_Element::GetElement(uint32_t index) const { if (index < m_Children.size() && m_Children[index].type == Element) { return static_cast<CXML_Element*>(m_Children[index].child); } return nullptr; } -FX_DWORD CXML_Element::CountElements(const CFX_ByteStringC& space, +uint32_t CXML_Element::CountElements(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const { int count = 0; for (const ChildRecord& record : m_Children) { @@ -741,7 +741,7 @@ CXML_Element* CXML_Element::GetElement(const CFX_ByteStringC& space, } return nullptr; } -FX_DWORD CXML_Element::FindElement(CXML_Element* pChild) const { +uint32_t CXML_Element::FindElement(CXML_Element* pChild) const { int index = 0; for (const ChildRecord& record : m_Children) { if (record.type == Element && @@ -750,7 +750,7 @@ FX_DWORD CXML_Element::FindElement(CXML_Element* pChild) const { } ++index; } - return (FX_DWORD)-1; + return (uint32_t)-1; } bool CXML_AttrItem::Matches(const CFX_ByteStringC& space, diff --git a/core/fxcrt/fxcrt_platforms.cpp b/core/fxcrt/fxcrt_platforms.cpp index 4305c41874..16e1a0976d 100644 --- a/core/fxcrt/fxcrt_platforms.cpp +++ b/core/fxcrt/fxcrt_platforms.cpp @@ -15,7 +15,7 @@ IFXCRT_FileAccess* FXCRT_FileAccess_Create() { return new CFXCRT_FileAccess_CRT; } -void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_ByteString& bsMode) { +void FXCRT_GetFileModeString(uint32_t dwModes, CFX_ByteString& bsMode) { if (dwModes & FX_FILEMODE_ReadOnly) { bsMode = "rb"; } else if (dwModes & FX_FILEMODE_Truncate) { @@ -24,7 +24,7 @@ void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_ByteString& bsMode) { bsMode = "a+b"; } } -void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_WideString& wsMode) { +void FXCRT_GetFileModeString(uint32_t dwModes, CFX_WideString& wsMode) { if (dwModes & FX_FILEMODE_ReadOnly) { wsMode = FX_WSTRC(L"rb"); } else if (dwModes & FX_FILEMODE_Truncate) { @@ -38,7 +38,7 @@ CFXCRT_FileAccess_CRT::~CFXCRT_FileAccess_CRT() { Close(); } FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_ByteStringC& fileName, - FX_DWORD dwMode) { + uint32_t dwMode) { if (m_hFile) { return FALSE; } @@ -48,7 +48,7 @@ FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_ByteStringC& fileName, return m_hFile != NULL; } FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_WideStringC& fileName, - FX_DWORD dwMode) { + uint32_t dwMode) { if (m_hFile) { return FALSE; } diff --git a/core/fxcrt/fxcrt_platforms.h b/core/fxcrt/fxcrt_platforms.h index 6bbebcba13..736c116625 100644 --- a/core/fxcrt/fxcrt_platforms.h +++ b/core/fxcrt/fxcrt_platforms.h @@ -10,16 +10,16 @@ #include "core/fxcrt/extension.h" #if _FX_OS_ == _FX_ANDROID_ -void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_ByteString& bsMode); -void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_WideString& wsMode); +void FXCRT_GetFileModeString(uint32_t dwModes, CFX_ByteString& bsMode); +void FXCRT_GetFileModeString(uint32_t dwModes, CFX_WideString& wsMode); class CFXCRT_FileAccess_CRT : public IFXCRT_FileAccess { public: CFXCRT_FileAccess_CRT(); ~CFXCRT_FileAccess_CRT() override; // IFXCRT_FileAccess - FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) override; - FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) override; + FX_BOOL Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override; + FX_BOOL Open(const CFX_WideStringC& fileName, uint32_t dwMode) override; void Close() override; void Release() override; FX_FILESIZE GetSize() const override; diff --git a/core/fxcrt/fxcrt_posix.cpp b/core/fxcrt/fxcrt_posix.cpp index 02556c1520..2f17e71567 100644 --- a/core/fxcrt/fxcrt_posix.cpp +++ b/core/fxcrt/fxcrt_posix.cpp @@ -14,7 +14,7 @@ IFXCRT_FileAccess* FXCRT_FileAccess_Create() { return new CFXCRT_FileAccess_Posix; } -void FXCRT_Posix_GetFileMode(FX_DWORD dwModes, +void FXCRT_Posix_GetFileMode(uint32_t dwModes, int32_t& nFlags, int32_t& nMasks) { nFlags = O_BINARY | O_LARGEFILE; @@ -34,7 +34,7 @@ CFXCRT_FileAccess_Posix::~CFXCRT_FileAccess_Posix() { Close(); } FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName, - FX_DWORD dwMode) { + uint32_t dwMode) { if (m_nFD > -1) { return FALSE; } @@ -44,7 +44,7 @@ FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName, return m_nFD > -1; } FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName, - FX_DWORD dwMode) { + uint32_t dwMode) { return Open(FX_UTF8Encode(fileName), dwMode); } void CFXCRT_FileAccess_Posix::Close() { diff --git a/core/fxcrt/fxcrt_posix.h b/core/fxcrt/fxcrt_posix.h index cf5f634874..969707a7b9 100644 --- a/core/fxcrt/fxcrt_posix.h +++ b/core/fxcrt/fxcrt_posix.h @@ -18,8 +18,8 @@ class CFXCRT_FileAccess_Posix : public IFXCRT_FileAccess { ~CFXCRT_FileAccess_Posix() override; // IFXCRT_FileAccess - FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) override; - FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) override; + FX_BOOL Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override; + FX_BOOL Open(const CFX_WideStringC& fileName, uint32_t dwMode) override; void Close() override; void Release() override; FX_FILESIZE GetSize() const override; diff --git a/core/fxcrt/fxcrt_windows.cpp b/core/fxcrt/fxcrt_windows.cpp index 61c0eb6e39..340d22585f 100644 --- a/core/fxcrt/fxcrt_windows.cpp +++ b/core/fxcrt/fxcrt_windows.cpp @@ -12,10 +12,10 @@ IFXCRT_FileAccess* FXCRT_FileAccess_Create() { return new CFXCRT_FileAccess_Win64; } -void FXCRT_Windows_GetFileMode(FX_DWORD dwMode, - FX_DWORD& dwAccess, - FX_DWORD& dwShare, - FX_DWORD& dwCreation) { +void FXCRT_Windows_GetFileMode(uint32_t dwMode, + uint32_t& dwAccess, + uint32_t& dwShare, + uint32_t& dwCreation) { dwAccess = GENERIC_READ; dwShare = FILE_SHARE_READ | FILE_SHARE_WRITE; if (!(dwMode & FX_FILEMODE_ReadOnly)) { @@ -41,11 +41,11 @@ CFXCRT_FileAccess_Win64::~CFXCRT_FileAccess_Win64() { Close(); } FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, - FX_DWORD dwMode) { + uint32_t dwMode) { if (m_hFile) { return FALSE; } - FX_DWORD dwAccess, dwShare, dwCreation; + uint32_t dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); m_hFile = ::CreateFileA(fileName.GetCStr(), dwAccess, dwShare, NULL, dwCreation, FILE_ATTRIBUTE_NORMAL, NULL); @@ -55,11 +55,11 @@ FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, return m_hFile != NULL; } FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName, - FX_DWORD dwMode) { + uint32_t dwMode) { if (m_hFile) { return FALSE; } - FX_DWORD dwAccess, dwShare, dwCreation; + uint32_t dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); m_hFile = ::CreateFileW((LPCWSTR)fileName.GetPtr(), dwAccess, dwShare, NULL, dwCreation, FILE_ATTRIBUTE_NORMAL, NULL); diff --git a/core/fxcrt/fxcrt_windows.h b/core/fxcrt/fxcrt_windows.h index 04a1a55b16..7444446d45 100644 --- a/core/fxcrt/fxcrt_windows.h +++ b/core/fxcrt/fxcrt_windows.h @@ -16,8 +16,8 @@ class CFXCRT_FileAccess_Win64 : public IFXCRT_FileAccess { ~CFXCRT_FileAccess_Win64() override; // IFXCRT_FileAccess - FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) override; - FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) override; + FX_BOOL Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override; + FX_BOOL Open(const CFX_WideStringC& fileName, uint32_t dwMode) override; void Close() override; void Release() override; FX_FILESIZE GetSize() const override; 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 <class KeyType, class ValueType> @@ -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<CFX_SortListArray<sizeof(FX_FILESIZE)>, 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_DWORD> FX_SAFE_DWORD; +typedef pdfium::base::CheckedNumeric<uint32_t> FX_SAFE_DWORD; typedef pdfium::base::CheckedNumeric<int32_t> FX_SAFE_INT32; typedef pdfium::base::CheckedNumeric<size_t> FX_SAFE_SIZE_T; typedef pdfium::base::CheckedNumeric<FX_FILESIZE> 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<FX_DWORD>(p[3]) << 24) | (static_cast<FX_DWORD>(p[2]) << 16) | \ - (static_cast<FX_DWORD>(p[1]) << 8) | (static_cast<FX_DWORD>(p[0]))) + ((static_cast<uint32_t>(p[3]) << 24) | (static_cast<uint32_t>(p[2]) << 16) | \ + (static_cast<uint32_t>(p[1]) << 8) | (static_cast<uint32_t>(p[0]))) #define FXDWORD_GET_MSBFIRST(p) \ - ((static_cast<FX_DWORD>(p[0]) << 24) | (static_cast<FX_DWORD>(p[1]) << 16) | \ - (static_cast<FX_DWORD>(p[2]) << 8) | (static_cast<FX_DWORD>(p[3]))) + ((static_cast<uint32_t>(p[0]) << 24) | (static_cast<uint32_t>(p[1]) << 16) | \ + (static_cast<uint32_t>(p[2]) << 8) | (static_cast<uint32_t>(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_RTFChar> 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 { diff --git a/core/fxcrt/plex.h b/core/fxcrt/plex.h index 8bb9607268..5391566d7b 100644 --- a/core/fxcrt/plex.h +++ b/core/fxcrt/plex.h @@ -12,7 +12,7 @@ struct CFX_Plex { CFX_Plex* pNext; void* data() { return this + 1; } - static CFX_Plex* Create(CFX_Plex*& head, FX_DWORD nMax, FX_DWORD cbElement); + static CFX_Plex* Create(CFX_Plex*& head, uint32_t nMax, uint32_t cbElement); void FreeDataChain(); }; diff --git a/core/fxcrt/xml_int.h b/core/fxcrt/xml_int.h index 9a2c28c11f..2dae7b5231 100644 --- a/core/fxcrt/xml_int.h +++ b/core/fxcrt/xml_int.h @@ -110,7 +110,7 @@ class CXML_Parser { void SkipWhiteSpaces(); void GetName(CFX_ByteString& space, CFX_ByteString& name); void GetAttrValue(CFX_WideString& value); - FX_DWORD GetCharRef(); + uint32_t GetCharRef(); void GetTagName(CFX_ByteString& space, CFX_ByteString& name, FX_BOOL& bEndTag, |