From bb17868d736f698d5217c30d52c5bbfed62c5936 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 9 Jun 2015 11:30:25 -0700 Subject: Use stdint.h types throughout PDFium. It's redundant nowadays to provide our own equivalents, now that this is done for us by the system header. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1177483002 --- core/src/fxcrt/extension.h | 18 +++++++------- core/src/fxcrt/fx_arabic.cpp | 6 ++--- core/src/fxcrt/fx_arabic.h | 16 ++++++------- core/src/fxcrt/fx_basic_array.cpp | 10 ++++---- core/src/fxcrt/fx_basic_bstring.cpp | 14 +++++------ core/src/fxcrt/fx_basic_buffer.cpp | 24 +++++++++---------- core/src/fxcrt/fx_basic_coords.cpp | 16 ++++++------- core/src/fxcrt/fx_basic_gcc.cpp | 26 ++++++++++---------- core/src/fxcrt/fx_basic_maps.cpp | 28 +++++++++++----------- core/src/fxcrt/fx_basic_memmgr.cpp | 2 +- core/src/fxcrt/fx_basic_plex.cpp | 4 ++-- core/src/fxcrt/fx_basic_utf.cpp | 4 ++-- core/src/fxcrt/fx_basic_util.cpp | 12 +++++----- core/src/fxcrt/fx_basic_wstring.cpp | 6 ++--- core/src/fxcrt/fx_extension.cpp | 30 +++++++++++------------ core/src/fxcrt/fx_unicode.cpp | 2 +- core/src/fxcrt/fx_xml_composer.cpp | 2 +- core/src/fxcrt/fx_xml_parser.cpp | 48 ++++++++++++++++++------------------- core/src/fxcrt/fxcrt_platforms.cpp | 2 +- core/src/fxcrt/fxcrt_posix.cpp | 6 ++--- core/src/fxcrt/fxcrt_posix.h | 2 +- core/src/fxcrt/xml_int.h | 2 +- 22 files changed, 140 insertions(+), 140 deletions(-) (limited to 'core/src/fxcrt') diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index ce66e26402..c2d72f4bf1 100644 --- a/core/src/fxcrt/extension.h +++ b/core/src/fxcrt/extension.h @@ -160,7 +160,7 @@ public: ~CFX_MemoryStream() { if (m_dwFlags & FX_MEMSTREAM_TakeOver) { - for (FX_INT32 i = 0; i < m_Blocks.GetSize(); i++) { + for (int32_t i = 0; i < m_Blocks.GetSize(); i++) { FX_Free((FX_LPBYTE)m_Blocks[i]); } } @@ -270,7 +270,7 @@ public: } } size_t nRead = FX_MIN(size, m_nCurSize - m_nCurPos); - if (!ReadBlock(buffer, (FX_INT32)m_nCurPos, nRead)) { + if (!ReadBlock(buffer, (int32_t)m_nCurPos, nRead)) { return 0; } return nRead; @@ -293,10 +293,10 @@ public: if (m_nCurPos > m_nTotalSize) { m_nTotalSize = (m_nCurPos + m_nGrowSize - 1) / m_nGrowSize * m_nGrowSize; if (m_Blocks.GetSize() < 1) { - void* block = FX_Alloc(FX_BYTE, m_nTotalSize); + void* block = FX_Alloc(uint8_t, m_nTotalSize); m_Blocks.Add(block); } else { - m_Blocks[0] = FX_Realloc(FX_BYTE, m_Blocks[0], m_nTotalSize); + m_Blocks[0] = FX_Realloc(uint8_t, m_Blocks[0], m_nTotalSize); } if (!m_Blocks[0]) { m_Blocks.RemoveAll(); @@ -347,7 +347,7 @@ public: { if (m_dwFlags & FX_MEMSTREAM_Consecutive) { if (m_Blocks.GetSize() < 1) { - FX_LPBYTE pBlock = FX_Alloc(FX_BYTE, FX_MAX(nInitSize, 4096)); + FX_LPBYTE pBlock = FX_Alloc(uint8_t, FX_MAX(nInitSize, 4096)); m_Blocks.Add(pBlock); } m_nGrowSize = FX_MAX(nGrowSize, 4096); @@ -400,11 +400,11 @@ protected: if (size <= m_nTotalSize) { return TRUE; } - FX_INT32 iCount = m_Blocks.GetSize(); + int32_t iCount = m_Blocks.GetSize(); size = (size - m_nTotalSize + m_nGrowSize - 1) / m_nGrowSize; - m_Blocks.SetSize(m_Blocks.GetSize() + (FX_INT32)size); + m_Blocks.SetSize(m_Blocks.GetSize() + (int32_t)size); while (size --) { - FX_LPBYTE pBlock = FX_Alloc(FX_BYTE, m_nGrowSize); + FX_LPBYTE pBlock = FX_Alloc(uint8_t, m_nGrowSize); m_Blocks.SetAt(iCount ++, pBlock); m_nTotalSize += m_nGrowSize; } @@ -431,7 +431,7 @@ typedef struct _FX_MTRANDOMCONTEXT { } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount); +FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, int32_t iCount); #endif #ifdef __cplusplus } diff --git a/core/src/fxcrt/fx_arabic.cpp b/core/src/fxcrt/fx_arabic.cpp index 04ce172c3f..30caa24ec2 100644 --- a/core/src/fxcrt/fx_arabic.cpp +++ b/core/src/fxcrt/fx_arabic.cpp @@ -24,8 +24,8 @@ CFX_BidiChar::CFX_BidiChar() FX_BOOL CFX_BidiChar::AppendChar(FX_WCHAR wch) { FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; - FX_INT32 iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; - FX_INT32 iContext = 0; + int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; + int32_t iContext = 0; switch (iBidiCls) { case FX_BIDICLASS_L: case FX_BIDICLASS_AN: @@ -69,7 +69,7 @@ FX_BOOL CFX_BidiChar::EndChar() m_iLastCount = m_iCurCount - m_iLastStart; return m_iLastCount > 0; } -FX_INT32 CFX_BidiChar::GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) +int32_t CFX_BidiChar::GetBidiInfo(int32_t &iStart, int32_t &iCount) { iStart = m_iLastStart; iCount = m_iLastCount; diff --git a/core/src/fxcrt/fx_arabic.h b/core/src/fxcrt/fx_arabic.h index 741bfb9c3d..081294605a 100644 --- a/core/src/fxcrt/fx_arabic.h +++ b/core/src/fxcrt/fx_arabic.h @@ -21,18 +21,18 @@ public: } virtual FX_BOOL AppendChar(FX_WCHAR wch) override; virtual FX_BOOL EndChar() override; - virtual FX_INT32 GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) override; + virtual int32_t GetBidiInfo(int32_t &iStart, int32_t &iCount) override; virtual void Reset() override; private: ~CFX_BidiChar() { } - FX_BOOL m_bSeparateNeutral; - FX_INT32 m_iCurStart; - FX_INT32 m_iCurCount; - FX_INT32 m_iCurBidi; - FX_INT32 m_iLastBidi; - FX_INT32 m_iLastStart; - FX_INT32 m_iLastCount; + FX_BOOL m_bSeparateNeutral; + int32_t m_iCurStart; + int32_t m_iCurCount; + int32_t m_iCurBidi; + int32_t m_iLastBidi; + int32_t m_iLastStart; + int32_t m_iLastCount; }; #endif // CORE_SRC_FXCRT_FX_ARABIC_H_ diff --git a/core/src/fxcrt/fx_basic_array.cpp b/core/src/fxcrt/fx_basic_array.cpp index 43a5417c00..315c83e53a 100644 --- a/core/src/fxcrt/fx_basic_array.cpp +++ b/core/src/fxcrt/fx_basic_array.cpp @@ -38,7 +38,7 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) m_nSize = m_nMaxSize = 0; return FALSE; } - m_pData = FX_Alloc(FX_BYTE, totalSize.ValueOrDie()); + m_pData = FX_Alloc(uint8_t, totalSize.ValueOrDie()); m_nSize = m_nMaxSize = nNewSize; } else if (nNewSize <= m_nMaxSize) { if (nNewSize > m_nSize) { @@ -52,7 +52,7 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) if (!totalSize.IsValid() || nNewMax < m_nSize) { return FALSE; } - FX_LPBYTE pNewData = FX_Realloc(FX_BYTE, m_pData, totalSize.ValueOrDie()); + FX_LPBYTE pNewData = FX_Realloc(uint8_t, m_pData, totalSize.ValueOrDie()); if (pNewData == NULL) { return FALSE; } @@ -185,7 +185,7 @@ void* CFX_BaseSegmentedArray::Add() if (m_DataSize % m_SegmentSize) { return GetAt(m_DataSize ++); } - void* pSegment = FX_Alloc2D(FX_BYTE, m_UnitSize, m_SegmentSize); + void* pSegment = FX_Alloc2D(uint8_t, m_UnitSize, m_SegmentSize); if (m_pIndex == NULL) { m_pIndex = pSegment; m_DataSize ++; @@ -315,8 +315,8 @@ void CFX_BaseSegmentedArray::Delete(int index, int count) } int i; for (i = index; i < m_DataSize - count; i ++) { - FX_BYTE* pSrc = (FX_BYTE*)GetAt(i + count); - FX_BYTE* pDest = (FX_BYTE*)GetAt(i); + uint8_t* pSrc = (uint8_t*)GetAt(i + count); + uint8_t* pDest = (uint8_t*)GetAt(i); for (int j = 0; j < m_UnitSize; j ++) { pDest[j] = pSrc[j]; } diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp index 2377a6d624..78698fc6d0 100644 --- a/core/src/fxcrt/fx_basic_bstring.cpp +++ b/core/src/fxcrt/fx_basic_bstring.cpp @@ -72,7 +72,7 @@ CFX_ByteString::StringData* CFX_ByteString::StringData::Create(int nLen) int usableSize = totalSize - overhead; FXSYS_assert(usableSize >= nLen); - void* pData = FX_Alloc(FX_BYTE, totalSize); + void* pData = FX_Alloc(uint8_t, totalSize); return new (pData) StringData(nLen, usableSize); } CFX_ByteString::~CFX_ByteString() @@ -284,11 +284,11 @@ bool CFX_ByteString::EqualNoCase(FX_BSTR str) const FX_LPCBYTE pThat = str.GetPtr(); for (FX_STRSIZE i = 0; i < len; i ++) { if ((*pThis) != (*pThat)) { - FX_BYTE bThis = *pThis; + uint8_t bThis = *pThis; if (bThis >= 'A' && bThis <= 'Z') { bThis += 'a' - 'A'; } - FX_BYTE bThat = *pThat; + uint8_t bThat = *pThat; if (bThat >= 'A' && bThat <= 'Z') { bThat += 'a' - 'A'; } @@ -645,7 +645,7 @@ void CFX_ByteString::FormatV(FX_LPCSTR lpszFormat, va_list argList) case 'X': case 'o': if (nModifier & FORCE_INT64) { - va_arg(argList, FX_INT64); + va_arg(argList, int64_t); } else { va_arg(argList, int); } @@ -936,7 +936,7 @@ CFX_WideString CFX_ByteString::UTF8Decode() const { CFX_UTF8Decoder decoder; for (FX_STRSIZE i = 0; i < GetLength(); i ++) { - decoder.Input((FX_BYTE)m_pData->m_String[i]); + decoder.Input((uint8_t)m_pData->m_String[i]); } return decoder.GetResult(); } @@ -969,9 +969,9 @@ int CFX_ByteString::Compare(FX_BSTR str) const int that_len = str.GetLength(); int min_len = this_len < that_len ? this_len : that_len; for (int i = 0; i < min_len; i ++) { - if ((FX_BYTE)m_pData->m_String[i] < str.GetAt(i)) { + if ((uint8_t)m_pData->m_String[i] < str.GetAt(i)) { return -1; - } else if ((FX_BYTE)m_pData->m_String[i] > str.GetAt(i)) { + } else if ((uint8_t)m_pData->m_String[i] > str.GetAt(i)) { return 1; } } diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index 06ba9413a5..7d45a43128 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -18,7 +18,7 @@ CFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size) , m_DataSize(size) , m_AllocSize(size) { - m_pBuffer = FX_Alloc(FX_BYTE, size); + m_pBuffer = FX_Alloc(uint8_t, size); } CFX_BinaryBuf::~CFX_BinaryBuf() { @@ -84,9 +84,9 @@ void CFX_BinaryBuf::ExpandBuf(FX_STRSIZE add_size) new_size = (new_size + alloc_step - 1) / alloc_step * alloc_step; FX_LPBYTE pNewBuffer = m_pBuffer; if (pNewBuffer) { - pNewBuffer = FX_Realloc(FX_BYTE, m_pBuffer, new_size); + pNewBuffer = FX_Realloc(uint8_t, m_pBuffer, new_size); } else { - pNewBuffer = FX_Alloc(FX_BYTE, new_size); + pNewBuffer = FX_Alloc(uint8_t, new_size); } m_pBuffer = pNewBuffer; m_AllocSize = new_size; @@ -126,7 +126,7 @@ void CFX_BinaryBuf::InsertBlock(FX_STRSIZE pos, const void* pBuf, FX_STRSIZE siz } m_DataSize += size; } -void CFX_BinaryBuf::AppendFill(FX_BYTE byte, FX_STRSIZE count) +void CFX_BinaryBuf::AppendFill(uint8_t byte, FX_STRSIZE count) { ExpandBuf(count); if (!m_pBuffer) { @@ -242,7 +242,7 @@ CFX_WideStringC CFX_WideTextBuf::GetWideString() const { return CFX_WideStringC((FX_LPCWSTR)m_pBuffer, m_DataSize / sizeof(FX_WCHAR)); } -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_BYTE i) +CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (uint8_t i) { if (m_pStream) { m_pStream->WriteBlock(&i, 1); @@ -325,7 +325,7 @@ FX_BOOL CFX_ArchiveLoader::IsEOF() { return m_LoadingPos >= m_LoadingSize; } -CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (FX_BYTE& i) +CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (uint8_t& i) { if (m_LoadingPos >= m_LoadingSize) { return *this; @@ -447,13 +447,13 @@ FX_BOOL IFX_BufferArchive::Flush() m_Length = 0; return bRet; } -FX_INT32 IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) +int32_t IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) { if (!pBuf || size < 1) { return 0; } if (!m_pBuffer) { - m_pBuffer = FX_Alloc(FX_BYTE, m_BufSize); + m_pBuffer = FX_Alloc(uint8_t, m_BufSize); } FX_LPBYTE buffer = (FX_LPBYTE)pBuf; FX_STRSIZE temp_size = (FX_STRSIZE)size; @@ -469,19 +469,19 @@ FX_INT32 IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) temp_size -= buf_size; buffer += buf_size; } - return (FX_INT32)size; + return (int32_t)size; } -FX_INT32 IFX_BufferArchive::AppendByte(FX_BYTE byte) +int32_t IFX_BufferArchive::AppendByte(uint8_t byte) { return AppendBlock(&byte, 1); } -FX_INT32 IFX_BufferArchive::AppendDWord(FX_DWORD i) +int32_t IFX_BufferArchive::AppendDWord(FX_DWORD i) { char buf[32]; FXSYS_itoa(i, buf, 10); return AppendBlock(buf, (size_t)FXSYS_strlen(buf)); } -FX_INT32 IFX_BufferArchive::AppendString(FX_BSTR lpsz) +int32_t IFX_BufferArchive::AppendString(FX_BSTR lpsz) { return AppendBlock(lpsz.GetPtr(), lpsz.GetLength()); } diff --git a/core/src/fxcrt/fx_basic_coords.cpp b/core/src/fxcrt/fx_basic_coords.cpp index 8e7bb3e751..496b1443d1 100644 --- a/core/src/fxcrt/fx_basic_coords.cpp +++ b/core/src/fxcrt/fx_basic_coords.cpp @@ -430,7 +430,7 @@ FX_FLOAT CFX_Matrix::TransformXDistance(FX_FLOAT dx) const FX_FLOAT fx = a * dx, fy = b * dx; return FXSYS_sqrt(fx * fx + fy * fy); } -FX_INT32 CFX_Matrix::TransformXDistance(FX_INT32 dx) const +int32_t CFX_Matrix::TransformXDistance(int32_t dx) const { FX_FLOAT fx = a * dx, fy = b * dx; return FXSYS_round(FXSYS_sqrt(fx * fx + fy * fy)); @@ -440,7 +440,7 @@ FX_FLOAT CFX_Matrix::TransformYDistance(FX_FLOAT dy) const FX_FLOAT fx = c * dy, fy = d * dy; return FXSYS_sqrt(fx * fx + fy * fy); } -FX_INT32 CFX_Matrix::TransformYDistance(FX_INT32 dy) const +int32_t CFX_Matrix::TransformYDistance(int32_t dy) const { FX_FLOAT fx = c * dy, fy = d * dy; return FXSYS_round(FXSYS_sqrt(fx * fx + fy * fy)); @@ -450,7 +450,7 @@ FX_FLOAT CFX_Matrix::TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const FX_FLOAT fx = a * dx + c * dy, fy = b * dx + d * dy; return FXSYS_sqrt(fx * fx + fy * fy); } -FX_INT32 CFX_Matrix::TransformDistance(FX_INT32 dx, FX_INT32 dy) const +int32_t CFX_Matrix::TransformDistance(int32_t dx, int32_t dy) const { FX_FLOAT fx = a * dx + c * dy, fy = b * dx + d * dy; return FXSYS_round(FXSYS_sqrt(fx * fx + fy * fy)); @@ -472,11 +472,11 @@ void CFX_Matrix::TransformVector(CFX_Vector &v) const v.x = FXSYS_round(fx); v.y = FXSYS_round(fy); } -void CFX_Matrix::TransformPoints(CFX_Point *points, FX_INT32 iCount) const +void CFX_Matrix::TransformPoints(CFX_Point *points, int32_t iCount) const { FXSYS_assert(iCount > 0); FX_FLOAT fx, fy; - for (FX_INT32 i = 0; i < iCount; i ++) { + for (int32_t i = 0; i < iCount; i ++) { fx = a * points->x + c * points->y + e; fy = b * points->x + d * points->y + f; points->x = FXSYS_round(fx); @@ -484,11 +484,11 @@ void CFX_Matrix::TransformPoints(CFX_Point *points, FX_INT32 iCount) const points ++; } } -void CFX_Matrix::TransformPoints(CFX_PointF *points, FX_INT32 iCount) const +void CFX_Matrix::TransformPoints(CFX_PointF *points, int32_t iCount) const { FXSYS_assert(iCount > 0); FX_FLOAT fx, fy; - for (FX_INT32 i = 0; i < iCount; i ++) { + for (int32_t i = 0; i < iCount; i ++) { fx = a * points->x + c * points->y + e; fy = b * points->x + d * points->y + f; points->x = fx, points->y = fy; @@ -501,7 +501,7 @@ void CFX_Matrix::TransformPoint(FX_FLOAT &x, FX_FLOAT &y) const FX_FLOAT fy = b * x + d * y + f; x = fx, y = fy; } -void CFX_Matrix::TransformPoint(FX_INT32 &x, FX_INT32 &y) const +void CFX_Matrix::TransformPoint(int32_t &x, int32_t &y) const { FX_FLOAT fx = a * x + c * y + e; FX_FLOAT fy = b * x + d * y + f; diff --git a/core/src/fxcrt/fx_basic_gcc.cpp b/core/src/fxcrt/fx_basic_gcc.cpp index 93c71ce660..caa99926a6 100644 --- a/core/src/fxcrt/fx_basic_gcc.cpp +++ b/core/src/fxcrt/fx_basic_gcc.cpp @@ -58,29 +58,29 @@ STR_T FXSYS_IntToStr(T value, STR_T string, int radix) #ifdef __cplusplus extern "C" { #endif -FX_INT32 FXSYS_atoi(FX_LPCSTR str) +int32_t FXSYS_atoi(FX_LPCSTR str) { - return FXSYS_StrToInt(str); + return FXSYS_StrToInt(str); } -FX_INT32 FXSYS_wtoi(FX_LPCWSTR str) +int32_t FXSYS_wtoi(FX_LPCWSTR str) { - return FXSYS_StrToInt(str); + return FXSYS_StrToInt(str); } -FX_INT64 FXSYS_atoi64(FX_LPCSTR str) +int64_t FXSYS_atoi64(FX_LPCSTR str) { - return FXSYS_StrToInt(str); + return FXSYS_StrToInt(str); } -FX_INT64 FXSYS_wtoi64(FX_LPCWSTR str) +int64_t FXSYS_wtoi64(FX_LPCWSTR str) { - return FXSYS_StrToInt(str); + return FXSYS_StrToInt(str); } -FX_LPCSTR FXSYS_i64toa(FX_INT64 value, FX_LPSTR str, int radix) +FX_LPCSTR FXSYS_i64toa(int64_t value, FX_LPSTR str, int radix) { - return FXSYS_IntToStr(value, str, radix); + return FXSYS_IntToStr(value, str, radix); } -FX_LPCWSTR FXSYS_i64tow(FX_INT64 value, FX_LPWSTR str, int radix) +FX_LPCWSTR FXSYS_i64tow(int64_t value, FX_LPWSTR str, int radix) { - return FXSYS_IntToStr(value, str, radix); + return FXSYS_IntToStr(value, str, radix); } #ifdef __cplusplus } @@ -194,7 +194,7 @@ int FXSYS_wcsicmp(const FX_WCHAR *dst, const FX_WCHAR *src) } char* FXSYS_itoa(int value, char* string, int radix) { - return FXSYS_IntToStr(value, string, radix); + return FXSYS_IntToStr(value, string, radix); } #ifdef __cplusplus } diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp index 7fca42acde..c0c394583e 100644 --- a/core/src/fxcrt/fx_basic_maps.cpp +++ b/core/src/fxcrt/fx_basic_maps.cpp @@ -42,7 +42,7 @@ CFX_MapPtrToPtr::~CFX_MapPtrToPtr() } FX_DWORD CFX_MapPtrToPtr::HashKey(void* key) const { - return ((FX_DWORD)(FX_UINTPTR)key) >> 4; + return ((FX_DWORD)(uintptr_t)key) >> 4; } void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, void*& rKey, void*& rValue) const { @@ -377,10 +377,10 @@ FX_BOOL CFX_MapByteStringToPtr::RemoveKey(FX_BSTR key) return FALSE; } struct _CompactString { - FX_BYTE m_CompactLen; - FX_BYTE m_LenHigh; - FX_BYTE m_LenLow; - FX_BYTE m_Unused; + uint8_t m_CompactLen; + uint8_t m_LenHigh; + uint8_t m_LenLow; + uint8_t m_Unused; FX_LPBYTE m_pBuffer; }; static void _CompactStringRelease(_CompactString* pCompact) @@ -405,14 +405,14 @@ static FX_BOOL _CompactStringSame(_CompactString* pCompact, FX_LPCBYTE pStr, int static void _CompactStringStore(_CompactString* pCompact, FX_LPCBYTE pStr, int len) { if (len < (int)sizeof(_CompactString)) { - pCompact->m_CompactLen = (FX_BYTE)len; + pCompact->m_CompactLen = (uint8_t)len; FXSYS_memcpy32(&pCompact->m_LenHigh, pStr, len); return; } pCompact->m_CompactLen = 0xff; pCompact->m_LenHigh = len / 256; pCompact->m_LenLow = len % 256; - pCompact->m_pBuffer = FX_Alloc(FX_BYTE, len); + pCompact->m_pBuffer = FX_Alloc(uint8_t, len); FXSYS_memcpy32(pCompact->m_pBuffer, pStr, len); } static CFX_ByteStringC _CompactStringGet(_CompactString* pCompact) @@ -449,7 +449,7 @@ FX_POSITION CFX_CMapByteStringToPtr::GetStartPosition() const for (int i = 0; i < size; i ++) { _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(i); if (pKey->m_CompactLen != 0xfe) { - return (FX_POSITION)(FX_UINTPTR)(i + 1); + return (FX_POSITION)(uintptr_t)(i + 1); } } return NULL; @@ -459,7 +459,7 @@ void CFX_CMapByteStringToPtr::GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteS if (rNextPosition == NULL) { return; } - int index = (int)(FX_UINTPTR)rNextPosition - 1; + int index = (int)(uintptr_t)rNextPosition - 1; _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); rKey = _CompactStringGet(pKey); rValue = *(void**)(pKey + 1); @@ -468,7 +468,7 @@ void CFX_CMapByteStringToPtr::GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteS while (index < size) { pKey = (_CompactString*)m_Buffer.GetAt(index); if (pKey->m_CompactLen != 0xfe) { - rNextPosition = (FX_POSITION)(FX_UINTPTR)(index + 1); + rNextPosition = (FX_POSITION)(uintptr_t)(index + 1); return; } index ++; @@ -480,7 +480,7 @@ FX_LPVOID CFX_CMapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) cons if (rNextPosition == NULL) { return NULL; } - int index = (int)(FX_UINTPTR)rNextPosition - 1; + int index = (int)(uintptr_t)rNextPosition - 1; _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); FX_LPVOID rValue = *(void**)(pKey + 1); index ++; @@ -488,7 +488,7 @@ FX_LPVOID CFX_CMapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) cons while (index < size) { pKey = (_CompactString*)m_Buffer.GetAt(index); if (pKey->m_CompactLen != 0xfe) { - rNextPosition = (FX_POSITION)(FX_UINTPTR)(index + 1); + rNextPosition = (FX_POSITION)(uintptr_t)(index + 1); return rValue; } index ++; @@ -601,7 +601,7 @@ void CFX_CMapDWordToDWord::GetNextAssoc(FX_POSITION& pos, FX_DWORD& key, FX_DWOR if (pos == 0) { return; } - FX_DWORD index = ((FX_DWORD)(FX_UINTPTR)pos) - 1; + FX_DWORD index = ((FX_DWORD)(uintptr_t)pos) - 1; FX_DWORD count = m_Buffer.GetSize() / sizeof(_DWordPair); _DWordPair* buf = (_DWordPair*)m_Buffer.GetBuffer(); key = buf[index].key; @@ -609,7 +609,7 @@ void CFX_CMapDWordToDWord::GetNextAssoc(FX_POSITION& pos, FX_DWORD& key, FX_DWOR if (index == count - 1) { pos = 0; } else { - pos = (FX_POSITION)((FX_UINTPTR)pos + 1); + pos = (FX_POSITION)((uintptr_t)pos + 1); } } void CFX_CMapDWordToDWord::SetAt(FX_DWORD key, FX_DWORD value) diff --git a/core/src/fxcrt/fx_basic_memmgr.cpp b/core/src/fxcrt/fx_basic_memmgr.cpp index 63c609daec..a381fa4ef5 100644 --- a/core/src/fxcrt/fx_basic_memmgr.cpp +++ b/core/src/fxcrt/fx_basic_memmgr.cpp @@ -63,7 +63,7 @@ void* CFX_GrowOnlyPool::Alloc(size_t size) pTrunk = pTrunk->m_pNext; } size_t alloc_size = size > m_TrunkSize ? size : m_TrunkSize; - pTrunk = (_FX_GrowOnlyTrunk*)FX_Alloc(FX_BYTE, sizeof(_FX_GrowOnlyTrunk) + alloc_size); + pTrunk = (_FX_GrowOnlyTrunk*)FX_Alloc(uint8_t, sizeof(_FX_GrowOnlyTrunk) + alloc_size); pTrunk->m_Size = alloc_size; pTrunk->m_Allocated = size; pTrunk->m_pNext = (_FX_GrowOnlyTrunk*)m_pFirstTrunk; diff --git a/core/src/fxcrt/fx_basic_plex.cpp b/core/src/fxcrt/fx_basic_plex.cpp index 78319bd5da..802429600a 100644 --- a/core/src/fxcrt/fx_basic_plex.cpp +++ b/core/src/fxcrt/fx_basic_plex.cpp @@ -8,7 +8,7 @@ #include "plex.h" CFX_Plex* CFX_Plex::Create(CFX_Plex*& pHead, FX_DWORD nMax, FX_DWORD cbElement) { - CFX_Plex* p = (CFX_Plex*)FX_Alloc(FX_BYTE, sizeof(CFX_Plex) + nMax * cbElement); + CFX_Plex* p = (CFX_Plex*)FX_Alloc(uint8_t, sizeof(CFX_Plex) + nMax * cbElement); p->pNext = pHead; pHead = p; return p; @@ -17,7 +17,7 @@ void CFX_Plex::FreeDataChain() { CFX_Plex* p = this; while (p != NULL) { - FX_BYTE* bytes = (FX_BYTE*)p; + uint8_t* bytes = (uint8_t*)p; CFX_Plex* pNext = p->pNext; FX_Free(bytes); p = pNext; diff --git a/core/src/fxcrt/fx_basic_utf.cpp b/core/src/fxcrt/fx_basic_utf.cpp index f52b83efda..1422b7abd4 100644 --- a/core/src/fxcrt/fx_basic_utf.cpp +++ b/core/src/fxcrt/fx_basic_utf.cpp @@ -14,7 +14,7 @@ void CFX_UTF8Decoder::AppendChar(FX_DWORD ch) { m_Buffer.AppendChar((FX_WCHAR)ch); } -void CFX_UTF8Decoder::Input(FX_BYTE byte) +void CFX_UTF8Decoder::Input(uint8_t byte) { if (byte < 0x80) { m_PendingBytes = 0; @@ -65,7 +65,7 @@ void CFX_UTF8Encoder::Input(FX_WCHAR unicode) } else { nbytes = 6; } - static FX_BYTE prefix[] = {0xc0, 0xe0, 0xf0, 0xf8, 0xfc}; + static uint8_t prefix[] = {0xc0, 0xe0, 0xf0, 0xf8, 0xfc}; int order = 1 << ((nbytes - 1) * 6); int code = unicode; m_Buffer.AppendChar(prefix[nbytes - 2] | (code / order)); diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp index fd411919f1..4ccb93ccbb 100644 --- a/core/src/fxcrt/fx_basic_util.cpp +++ b/core/src/fxcrt/fx_basic_util.cpp @@ -187,22 +187,22 @@ void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap) } #endif // _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900 -static FX_BOOL FX_IsDigit(FX_BYTE ch) +static FX_BOOL FX_IsDigit(uint8_t ch) { return (ch >= '0' && ch <= '9') ? TRUE : FALSE; } -static FX_BOOL FX_IsXDigit(FX_BYTE ch) +static FX_BOOL FX_IsXDigit(uint8_t ch) { return (FX_IsDigit(ch) || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')) ? TRUE : FALSE; } -static FX_BYTE FX_MakeUpper(FX_BYTE ch) +static uint8_t FX_MakeUpper(uint8_t ch) { if (ch < 'a' || ch > 'z') { return ch; } return ch - 32; } -static int FX_HexToI(FX_BYTE ch) +static int FX_HexToI(uint8_t ch) { ch = FX_MakeUpper(ch); return FX_IsDigit(ch) ? (ch - '0') : (ch - 55); @@ -237,7 +237,7 @@ CFX_ByteString FX_UrlEncode(const CFX_WideString& wsUrl) int nByte = bsUri.GetLength(); for (int j = 0; j < nByte; j++) { rUrl += '%'; - FX_BYTE code = bsUri.GetAt(j); + uint8_t code = bsUri.GetAt(j); rUrl += arDigits[code >> 4]; rUrl += arDigits[code & 0x0F]; } @@ -268,7 +268,7 @@ CFX_ByteString FX_EncodeURI(const CFX_WideString& wsURI) CFX_ByteString bsUri = wsURI.UTF8Encode(); int nLength = bsUri.GetLength(); for (int i = 0; i < nLength; i++) { - FX_BYTE code = bsUri.GetAt(i); + uint8_t code = bsUri.GetAt(i); if (code > 0x7F || url_encodeTable[code] == 1) { rURI += '%'; rURI += arDigits[code >> 4]; diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp index 09e64e0c72..aeb366338e 100644 --- a/core/src/fxcrt/fx_basic_wstring.cpp +++ b/core/src/fxcrt/fx_basic_wstring.cpp @@ -33,7 +33,7 @@ CFX_WideString::StringData* CFX_WideString::StringData::Create(int nLen) int usableLen = (totalSize - overhead) / sizeof(FX_WCHAR); FXSYS_assert(usableLen >= nLen); - void* pData = FX_Alloc(FX_BYTE, iSize.ValueOrDie()); + void* pData = FX_Alloc(uint8_t, iSize.ValueOrDie()); return new (pData) StringData(nLen, usableLen); } CFX_WideString::~CFX_WideString() @@ -911,7 +911,7 @@ void CFX_WideString::FormatV(FX_LPCWSTR lpszFormat, va_list argList) case 'X': case 'o': if (nModifier & FORCE_INT64) { - va_arg(argList, FX_INT64); + va_arg(argList, int64_t); } else { va_arg(argList, int); } @@ -1068,7 +1068,7 @@ static const CFX_CharMap g_DefaultGBKMapper = {&_DefMap_GetWideString, &_DefMap_ static const CFX_CharMap g_DefaultJISMapper = {&_DefMap_GetWideString, &_DefMap_GetByteString, &_DefMap_GetJISCodePage}; static const CFX_CharMap g_DefaultUHCMapper = {&_DefMap_GetWideString, &_DefMap_GetByteString, &_DefMap_GetUHCCodePage}; static const CFX_CharMap g_DefaultBig5Mapper = {&_DefMap_GetWideString, &_DefMap_GetByteString, &_DefMap_GetBig5CodePage}; -CFX_CharMap* CFX_CharMap::GetDefaultMapper(FX_INT32 codepage) +CFX_CharMap* CFX_CharMap::GetDefaultMapper(int32_t codepage) { switch (codepage) { case 0: diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp index 20e2e1a320..eeecc811c2 100644 --- a/core/src/fxcrt/fx_extension.cpp +++ b/core/src/fxcrt/fx_extension.cpp @@ -139,25 +139,25 @@ FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x) { return FXSYS_log(x) / FXSYS_log(b); } -FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, FX_INT32 iLength, FX_INT32 *pUsedLen) +FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, int32_t iLength, int32_t *pUsedLen) { FXSYS_assert(pcsStr != NULL); if (iLength < 0) { - iLength = (FX_INT32)FXSYS_strlen(pcsStr); + iLength = (int32_t)FXSYS_strlen(pcsStr); } CFX_WideString ws = CFX_WideString::FromLocal(pcsStr, iLength); return FXSYS_wcstof(ws.c_str(), iLength, pUsedLen); } -FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, FX_INT32 iLength, FX_INT32 *pUsedLen) +FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, int32_t iLength, int32_t *pUsedLen) { FXSYS_assert(pwsStr != NULL); if (iLength < 0) { - iLength = (FX_INT32)FXSYS_wcslen(pwsStr); + iLength = (int32_t)FXSYS_wcslen(pwsStr); } if (iLength == 0) { return 0.0f; } - FX_INT32 iUsedLen = 0; + int32_t iUsedLen = 0; FX_BOOL bNegtive = FALSE; switch (pwsStr[iUsedLen]) { case '-': @@ -202,7 +202,7 @@ FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count) } return dstStr; } -FX_INT32 FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) +int32_t FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) { FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); FX_WCHAR wch1 = 0, wch2 = 0; @@ -215,7 +215,7 @@ FX_INT32 FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count) } return wch1 - wch2; } -FX_INT32 FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) +int32_t FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) { FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); FX_CHAR ch1 = 0, ch2 = 0; @@ -228,11 +228,11 @@ FX_INT32 FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count) } return ch1 - ch2; } -FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase) +FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr != NULL); if (iLength < 0) { - iLength = (FX_INT32)FXSYS_strlen(pStr); + iLength = (int32_t)FXSYS_strlen(pStr); } FX_LPCSTR pStrEnd = pStr + iLength; FX_DWORD dwHashCode = 0; @@ -247,11 +247,11 @@ FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BOOL bIgno } return dwHashCode; } -FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase) +FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr != NULL); if (iLength < 0) { - iLength = (FX_INT32)FXSYS_wcslen(pStr); + iLength = (int32_t)FXSYS_wcslen(pStr); } FX_LPCWSTR pStrEnd = pStr + iLength; FX_DWORD dwHashCode = 0; @@ -321,7 +321,7 @@ void FX_Random_MT_Close(FX_LPVOID pContext) FXSYS_assert(pContext != NULL); FX_Free(pContext); } -void FX_Random_GenerateMT(FX_LPDWORD pBuffer, FX_INT32 iCount) +void FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount) { FX_DWORD dwSeed; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -337,7 +337,7 @@ void FX_Random_GenerateMT(FX_LPDWORD pBuffer, FX_INT32 iCount) } FX_Random_MT_Close(pContext); } -void FX_Random_GenerateBase(FX_LPDWORD pBuffer, FX_INT32 iCount) +void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ SYSTEMTIME st1, st2; @@ -358,7 +358,7 @@ void FX_Random_GenerateBase(FX_LPDWORD pBuffer, FX_INT32 iCount) } } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount) +FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, int32_t iCount) { HCRYPTPROV hCP = NULL; if (!::CryptAcquireContext(&hCP, NULL, NULL, PROV_RSA_FULL, 0) || hCP == NULL) { @@ -369,7 +369,7 @@ FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount) return TRUE; } #endif -void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, FX_INT32 iCount) +void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ FX_GenerateCryptoRandom(pBuffer, iCount); diff --git a/core/src/fxcrt/fx_unicode.cpp b/core/src/fxcrt/fx_unicode.cpp index aac6142ce4..0117c1ffc5 100644 --- a/core/src/fxcrt/fx_unicode.cpp +++ b/core/src/fxcrt/fx_unicode.cpp @@ -29,7 +29,7 @@ FX_BOOL FX_IsCombinationChar(FX_WCHAR wch) FX_BOOL FX_IsBidiChar(FX_WCHAR wch) { FX_DWORD dwProps = gs_FX_TextLayout_CodeProperties[(FX_WORD)wch]; - FX_INT32 iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; + int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; return (FX_BIDICLASS_R == iBidiCls || FX_BIDICLASS_AL == iBidiCls); } FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) diff --git a/core/src/fxcrt/fx_xml_composer.cpp b/core/src/fxcrt/fx_xml_composer.cpp index 97c5dfd130..7858290f9a 100644 --- a/core/src/fxcrt/fx_xml_composer.cpp +++ b/core/src/fxcrt/fx_xml_composer.cpp @@ -11,7 +11,7 @@ void FX_XML_SplitQualifiedName(FX_BSTR bsFullName, CFX_ByteStringC &bsSpace, CFX if (bsFullName.IsEmpty()) { return; } - FX_INT32 iStart = 0; + int32_t iStart = 0; for (; iStart < bsFullName.GetLength(); iStart ++) { if (bsFullName.GetAt(iStart) == ':') { break; diff --git a/core/src/fxcrt/fx_xml_parser.cpp b/core/src/fxcrt/fx_xml_parser.cpp index 2c069cb132..5649a7db0e 100644 --- a/core/src/fxcrt/fx_xml_parser.cpp +++ b/core/src/fxcrt/fx_xml_parser.cpp @@ -64,7 +64,7 @@ FX_BOOL CXML_Parser::IsEOF() #define FXCRTM_XML_CHARTYPE_HexLowerLetter 0x40 #define FXCRTM_XML_CHARTYPE_HexUpperLetter 0x60 #define FXCRTM_XML_CHARTYPE_HexChar 0x60 -FX_BYTE g_FXCRT_XML_ByteTypes[256] = { +uint8_t g_FXCRT_XML_ByteTypes[256] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, @@ -82,27 +82,27 @@ FX_BYTE g_FXCRT_XML_ByteTypes[256] = { 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x01, 0x01, }; -FX_BOOL g_FXCRT_XML_IsWhiteSpace(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsWhiteSpace(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_SpaceChar) != 0; } -FX_BOOL g_FXCRT_XML_IsLetter(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsLetter(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Letter) != 0; } -FX_BOOL g_FXCRT_XML_IsDigital(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsDigital(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_Digital) != 0; } -FX_BOOL g_FXCRT_XML_IsNameIntro(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsNameIntro(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameIntro) != 0; } -FX_BOOL g_FXCRT_XML_IsNameChar(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsNameChar(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_NameChar) != 0; } -FX_BOOL g_FXCRT_XML_IsHexChar(FX_BYTE ch) +FX_BOOL g_FXCRT_XML_IsHexChar(uint8_t ch) { return (g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar) != 0; } @@ -129,7 +129,7 @@ void CXML_Parser::GetName(CFX_ByteString &space, CFX_ByteString &name) return; } CFX_ByteTextBuf buf; - FX_BYTE ch; + uint8_t ch; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex]; @@ -156,7 +156,7 @@ void CXML_Parser::SkipLiterals(FX_BSTR str) if (IsEOF()) { return; } - FX_INT32 i = 0, iLen = str.GetLength(); + int32_t i = 0, iLen = str.GetLength(); do { while (m_dwIndex < m_dwBufferSize) { if (str.GetAt(i) != m_pBuffer[m_dwIndex ++]) { @@ -188,8 +188,8 @@ FX_DWORD CXML_Parser::GetCharRef() if (IsEOF()) { return 0; } - FX_BYTE ch; - FX_INT32 iState = 0; + uint8_t ch; + int32_t iState = 0; CFX_ByteTextBuf buf; FX_DWORD code = 0; do { @@ -246,7 +246,7 @@ FX_DWORD CXML_Parser::GetCharRef() iState = 10; break; } - FX_BYTE nHex = g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar; + uint8_t nHex = g_FXCRT_XML_ByteTypes[ch] & FXCRTM_XML_CHARTYPE_HexChar; if (nHex) { if (nHex == FXCRTM_XML_CHARTYPE_HexDigital) { code = (code << 4) + ch - '0'; @@ -276,7 +276,7 @@ void CXML_Parser::GetAttrValue(CFX_WideString &value) return; } CFX_UTF8Decoder decoder; - FX_BYTE mark = 0, ch = 0; + uint8_t mark = 0, ch = 0; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex]; @@ -317,8 +317,8 @@ void CXML_Parser::GetTagName(CFX_ByteString &space, CFX_ByteString &name, FX_BOO return; } bEndTag = FALSE; - FX_BYTE ch; - FX_INT32 iState = bStartTag ? 1 : 0; + uint8_t ch; + int32_t iState = bStartTag ? 1 : 0; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex]; @@ -410,7 +410,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, FX_BOOL bStartTag if (IsEOF()) { return pElement; } - FX_BYTE ch = m_pBuffer[m_dwIndex ++]; + uint8_t ch = m_pBuffer[m_dwIndex ++]; if (ch == '/') { m_dwIndex ++; m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; @@ -428,7 +428,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, FX_BOOL bStartTag CFX_UTF8Decoder decoder; CFX_WideTextBuf content; FX_BOOL bCDATA = FALSE; - FX_INT32 iState = 0; + int32_t iState = 0; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex ++]; @@ -588,7 +588,7 @@ void CXML_Element::Empty() void CXML_Element::RemoveChildren() { for (int i = 0; i < m_Children.GetSize(); i += 2) { - ChildType type = (ChildType)(FX_UINTPTR)m_Children.GetAt(i); + ChildType type = (ChildType)(uintptr_t)m_Children.GetAt(i); if (type == Content) { CXML_Content* content = (CXML_Content*)m_Children.GetAt(i + 1); delete content; @@ -710,13 +710,13 @@ CXML_Element::ChildType CXML_Element::GetChildType(FX_DWORD index) const if (index >= (FX_DWORD)m_Children.GetSize()) { return Invalid; } - return (ChildType)(FX_UINTPTR)m_Children.GetAt(index); + return (ChildType)(uintptr_t)m_Children.GetAt(index); } CFX_WideString CXML_Element::GetContent(FX_DWORD index) const { index <<= 1; if (index >= (FX_DWORD)m_Children.GetSize() || - (ChildType)(FX_UINTPTR)m_Children.GetAt(index) != Content) { + (ChildType)(uintptr_t)m_Children.GetAt(index) != Content) { return CFX_WideString(); } CXML_Content* pContent = (CXML_Content*)m_Children.GetAt(index + 1); @@ -729,7 +729,7 @@ CXML_Element* CXML_Element::GetElement(FX_DWORD index) const { index <<= 1; if (index >= (FX_DWORD)m_Children.GetSize() || - (ChildType)(FX_UINTPTR)m_Children.GetAt(index) != Element) { + (ChildType)(uintptr_t)m_Children.GetAt(index) != Element) { return NULL; } return (CXML_Element*)m_Children.GetAt(index + 1); @@ -738,7 +738,7 @@ FX_DWORD CXML_Element::CountElements(FX_BSTR space, FX_BSTR tag) const { int count = 0; for (int i = 0; i < m_Children.GetSize(); i += 2) { - ChildType type = (ChildType)(FX_UINTPTR)m_Children.GetAt(i); + ChildType type = (ChildType)(uintptr_t)m_Children.GetAt(i); if (type != Element) { continue; } @@ -755,7 +755,7 @@ CXML_Element* CXML_Element::GetElement(FX_BSTR space, FX_BSTR tag, int index) co return NULL; } for (int i = 0; i < m_Children.GetSize(); i += 2) { - ChildType type = (ChildType)(FX_UINTPTR)m_Children.GetAt(i); + ChildType type = (ChildType)(uintptr_t)m_Children.GetAt(i); if (type != Element) { continue; } @@ -772,7 +772,7 @@ CXML_Element* CXML_Element::GetElement(FX_BSTR space, FX_BSTR tag, int index) co FX_DWORD CXML_Element::FindElement(CXML_Element *pChild) const { for (int i = 0; i < m_Children.GetSize(); i += 2) { - if ((ChildType)(FX_UINTPTR)m_Children.GetAt(i) == Element && + if ((ChildType)(uintptr_t)m_Children.GetAt(i) == Element && (CXML_Element*)m_Children.GetAt(i + 1) == pChild) { return (FX_DWORD)(i >> 1); } diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp index 942d6a3c02..0810c2ff65 100644 --- a/core/src/fxcrt/fxcrt_platforms.cpp +++ b/core/src/fxcrt/fxcrt_platforms.cpp @@ -168,7 +168,7 @@ FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) return FALSE; } FX_FILESIZE num = 0; - FX_LPBYTE pBuffer = FX_Alloc(FX_BYTE, 32768); + FX_LPBYTE pBuffer = FX_Alloc(uint8_t, 32768); while (num = src.Read(pBuffer, 32768)) { if (dst.Write(pBuffer, num) != num) { break; diff --git a/core/src/fxcrt/fxcrt_posix.cpp b/core/src/fxcrt/fxcrt_posix.cpp index 06d92c523d..b5fb0219af 100644 --- a/core/src/fxcrt/fxcrt_posix.cpp +++ b/core/src/fxcrt/fxcrt_posix.cpp @@ -11,7 +11,7 @@ IFXCRT_FileAccess* FXCRT_FileAccess_Create() { return new CFXCRT_FileAccess_Posix; } -void FXCRT_Posix_GetFileMode(FX_DWORD dwModes, FX_INT32 &nFlags, FX_INT32 &nMasks) +void FXCRT_Posix_GetFileMode(FX_DWORD dwModes, int32_t &nFlags, int32_t &nMasks) { nFlags = O_BINARY | O_LARGEFILE; if (dwModes & FX_FILEMODE_ReadOnly) { @@ -38,7 +38,7 @@ FX_BOOL CFXCRT_FileAccess_Posix::Open(FX_BSTR fileName, FX_DWORD dwMode) if (m_nFD > -1) { return FALSE; } - FX_INT32 nFlags, nMasks; + int32_t nFlags, nMasks; FXCRT_Posix_GetFileMode(dwMode, nFlags, nMasks); m_nFD = open(fileName.GetCStr(), nFlags, nMasks); return m_nFD > -1; @@ -164,7 +164,7 @@ FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) return FALSE; } size_t num = 0; - FX_LPBYTE pBuffer = FX_Alloc(FX_BYTE, 32768); + FX_LPBYTE pBuffer = FX_Alloc(uint8_t, 32768); num = src.Read(pBuffer, 32768); while (num) { if (dst.Write(pBuffer, num) != num) { diff --git a/core/src/fxcrt/fxcrt_posix.h b/core/src/fxcrt/fxcrt_posix.h index 8c716cd6d6..0b4509ec73 100644 --- a/core/src/fxcrt/fxcrt_posix.h +++ b/core/src/fxcrt/fxcrt_posix.h @@ -29,7 +29,7 @@ public: virtual FX_BOOL Flush(); virtual FX_BOOL Truncate(FX_FILESIZE szFile); protected: - FX_INT32 m_nFD; + int32_t m_nFD; }; #endif diff --git a/core/src/fxcrt/xml_int.h b/core/src/fxcrt/xml_int.h index 7cfeec95f7..4155a39ffa 100644 --- a/core/src/fxcrt/xml_int.h +++ b/core/src/fxcrt/xml_int.h @@ -107,7 +107,7 @@ public: } m_dwSize = (size_t)FX_MIN(FX_XMLDATASTREAM_BufferSize, nLength - m_nStart); if (!m_pBuffer) { - m_pBuffer = FX_Alloc(FX_BYTE, m_dwSize); + m_pBuffer = FX_Alloc(uint8_t, m_dwSize); } return m_pFileRead->ReadBlock(m_pBuffer, m_nStart, m_dwSize); } -- cgit v1.2.3