diff options
Diffstat (limited to 'core/include/fxcrt')
-rw-r--r-- | core/include/fxcrt/fx_arb.h | 2 | ||||
-rw-r--r-- | core/include/fxcrt/fx_basic.h | 96 | ||||
-rw-r--r-- | core/include/fxcrt/fx_coordinates.h | 38 | ||||
-rw-r--r-- | core/include/fxcrt/fx_ext.h | 30 | ||||
-rw-r--r-- | core/include/fxcrt/fx_safe_types.h | 2 | ||||
-rw-r--r-- | core/include/fxcrt/fx_stream.h | 10 | ||||
-rw-r--r-- | core/include/fxcrt/fx_string.h | 8 | ||||
-rw-r--r-- | core/include/fxcrt/fx_system.h | 50 |
8 files changed, 112 insertions, 124 deletions
diff --git a/core/include/fxcrt/fx_arb.h b/core/include/fxcrt/fx_arb.h index ff86fa6cf7..220aec75c4 100644 --- a/core/include/fxcrt/fx_arb.h +++ b/core/include/fxcrt/fx_arb.h @@ -17,7 +17,7 @@ public: virtual void SetPolicy(FX_BOOL bSeparateNeutral = TRUE) = 0; virtual FX_BOOL AppendChar(FX_WCHAR wch) = 0; virtual FX_BOOL EndChar() = 0; - virtual FX_INT32 GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) = 0; + virtual int32_t GetBidiInfo(int32_t &iStart, int32_t &iCount) = 0; virtual void Reset() = 0; protected: diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 0a5d4907b1..3af8a60766 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -41,14 +41,14 @@ public: void AppendBlock(const void* pBuf, FX_STRSIZE size); - void AppendFill(FX_BYTE byte, FX_STRSIZE count); + void AppendFill(uint8_t byte, FX_STRSIZE count); void AppendString(FX_BSTR str) { AppendBlock(str.GetPtr(), str.GetLength()); } - inline void AppendByte(FX_BYTE byte) + inline void AppendByte(uint8_t byte) { if (m_AllocSize <= m_DataSize) { ExpandBuf(1); @@ -99,7 +99,7 @@ public: void AppendChar(int ch) { - AppendByte((FX_BYTE)ch); + AppendByte((uint8_t)ch); } CFX_ByteTextBuf& operator << (int i); @@ -160,7 +160,7 @@ class CFX_ArchiveSaver public: CFX_ArchiveSaver() : m_pStream(NULL) {} - CFX_ArchiveSaver& operator << (FX_BYTE i); + CFX_ArchiveSaver& operator << (uint8_t i); CFX_ArchiveSaver& operator << (int i); @@ -178,7 +178,7 @@ public: void Write(const void* pData, FX_STRSIZE dwSize); - FX_INTPTR GetLength() + intptr_t GetLength() { return m_SavingBuf.GetSize(); } @@ -204,7 +204,7 @@ public: CFX_ArchiveLoader(FX_LPCBYTE pData, FX_DWORD dwSize); - CFX_ArchiveLoader& operator >> (FX_BYTE& i); + CFX_ArchiveLoader& operator >> (uint8_t& i); CFX_ArchiveLoader& operator >> (int& i); @@ -241,14 +241,14 @@ public: FX_BOOL Flush(); - FX_INT32 AppendBlock(const void* pBuf, size_t size); + int32_t AppendBlock(const void* pBuf, size_t size); - FX_INT32 AppendByte(FX_BYTE byte); + int32_t AppendByte(uint8_t byte); - FX_INT32 AppendDWord(FX_DWORD i); + int32_t AppendDWord(FX_DWORD i); - FX_INT32 AppendString(FX_BSTR lpsz); + int32_t AppendString(FX_BSTR lpsz); protected: @@ -282,14 +282,14 @@ private: }; struct CFX_CharMap { - static CFX_CharMap* GetDefaultMapper(FX_INT32 codepage = 0); + static CFX_CharMap* GetDefaultMapper(int32_t codepage = 0); CFX_WideString (*m_GetWideString)(CFX_CharMap* pMap, const CFX_ByteString& bstr); CFX_ByteString (*m_GetByteString)(CFX_CharMap* pMap, const CFX_WideString& wstr); - FX_INT32 (*m_GetCodePage)(); + int32_t (*m_GetCodePage)(); }; class CFX_UTF8Decoder { @@ -301,7 +301,7 @@ public: void Clear(); - void Input(FX_BYTE byte); + void Input(uint8_t byte); void AppendChar(FX_DWORD ch); @@ -541,13 +541,13 @@ public: return -1; } }; -typedef CFX_ArrayTemplate<FX_BYTE> CFX_ByteArray; +typedef CFX_ArrayTemplate<uint8_t> CFX_ByteArray; typedef CFX_ArrayTemplate<FX_WORD> CFX_WordArray; typedef CFX_ArrayTemplate<FX_DWORD> CFX_DWordArray; typedef CFX_ArrayTemplate<void*> CFX_PtrArray; typedef CFX_ArrayTemplate<FX_FILESIZE> CFX_FileSizeArray; typedef CFX_ArrayTemplate<FX_FLOAT> CFX_FloatArray; -typedef CFX_ArrayTemplate<FX_INT32> CFX_Int32Array; +typedef CFX_ArrayTemplate<int32_t> CFX_Int32Array; template <class ObjectClass> class CFX_ObjectArray : public CFX_BasicArray { @@ -574,12 +574,12 @@ public: return InsertSpaceAt(m_nSize, 1); } - FX_INT32 Append(const CFX_ObjectArray& src, FX_INT32 nStart = 0, FX_INT32 nCount = -1) + int32_t Append(const CFX_ObjectArray& src, int32_t nStart = 0, int32_t nCount = -1) { if (nCount == 0) { return 0; } - FX_INT32 nSize = src.GetSize(); + int32_t nSize = src.GetSize(); if (!nSize) { return 0; } @@ -597,18 +597,18 @@ public: InsertSpaceAt(m_nSize, nCount); ObjectClass* pStartObj = (ObjectClass*)GetDataPtr(nSize); nSize = nStart + nCount; - for (FX_INT32 i = nStart; i < nSize; i ++, pStartObj++) { + for (int32_t i = nStart; i < nSize; i ++, pStartObj++) { new ((void*)pStartObj) ObjectClass(src[i]); } return nCount; } - FX_INT32 Copy(const CFX_ObjectArray& src, FX_INT32 nStart = 0, FX_INT32 nCount = -1) + int32_t Copy(const CFX_ObjectArray& src, int32_t nStart = 0, int32_t nCount = -1) { if (nCount == 0) { return 0; } - FX_INT32 nSize = src.GetSize(); + int32_t nSize = src.GetSize(); if (!nSize) { return 0; } @@ -626,7 +626,7 @@ public: SetSize(nCount); ObjectClass* pStartObj = (ObjectClass*)m_pData; nSize = nStart + nCount; - for (FX_INT32 i = nStart; i < nSize; i ++, pStartObj++) { + for (int32_t i = nStart; i < nSize; i ++, pStartObj++) { new ((void*)pStartObj) ObjectClass(src[i]); } return nCount; @@ -704,9 +704,9 @@ private: short m_SegmentSize; - FX_BYTE m_IndexSize; + uint8_t m_IndexSize; - FX_BYTE m_IndexDepth; + uint8_t m_IndexDepth; int m_DataSize; @@ -859,26 +859,26 @@ public: FX_BOOL Lookup(KeyType key, ValueType& rValue) const { FX_LPVOID pValue = NULL; - if (!CFX_MapPtrToPtr::Lookup((void*)(FX_UINTPTR)key, pValue)) { + if (!CFX_MapPtrToPtr::Lookup((void*)(uintptr_t)key, pValue)) { return FALSE; } - rValue = (ValueType)(FX_UINTPTR)pValue; + rValue = (ValueType)(uintptr_t)pValue; return TRUE; } ValueType& operator[](KeyType key) { - return (ValueType&)CFX_MapPtrToPtr::operator []((void*)(FX_UINTPTR)key); + return (ValueType&)CFX_MapPtrToPtr::operator []((void*)(uintptr_t)key); } void SetAt(KeyType key, ValueType newValue) { - CFX_MapPtrToPtr::SetAt((void*)(FX_UINTPTR)key, (void*)(FX_UINTPTR)newValue); + CFX_MapPtrToPtr::SetAt((void*)(uintptr_t)key, (void*)(uintptr_t)newValue); } FX_BOOL RemoveKey(KeyType key) { - return CFX_MapPtrToPtr::RemoveKey((void*)(FX_UINTPTR)key); + return CFX_MapPtrToPtr::RemoveKey((void*)(uintptr_t)key); } void GetNextAssoc(FX_POSITION& rNextPosition, KeyType& rKey, ValueType& rValue) const @@ -886,8 +886,8 @@ public: void* pKey = NULL; void* pValue = NULL; CFX_MapPtrToPtr::GetNextAssoc(rNextPosition, pKey, pValue); - rKey = (KeyType)(FX_UINTPTR)pKey; - rValue = (ValueType)(FX_UINTPTR)pValue; + rKey = (KeyType)(uintptr_t)pKey; + rValue = (ValueType)(uintptr_t)pValue; } }; class CFX_CMapDWordToDWord @@ -1419,9 +1419,9 @@ protected: struct DataList { - FX_INT32 start; + int32_t start; - FX_INT32 count; + int32_t count; FX_LPBYTE data; }; public: @@ -1436,7 +1436,7 @@ public: void Clear() { - for (FX_INT32 i = m_DataLists.GetUpperBound(); i >= 0; i--) { + for (int32_t i = m_DataLists.GetUpperBound(); i >= 0; i--) { DataList list = m_DataLists.ElementAt(i); if (list.data) { FX_Free(list.data); @@ -1446,15 +1446,15 @@ public: m_CurList = 0; } - void Append(FX_INT32 nStart, FX_INT32 nCount) + void Append(int32_t nStart, int32_t nCount) { if (nStart < 0) { return; } while (nCount > 0) { - FX_INT32 temp_count = FX_MIN(nCount, FX_DATALIST_LENGTH); + int32_t temp_count = FX_MIN(nCount, FX_DATALIST_LENGTH); DataList list; - list.data = FX_Alloc2D(FX_BYTE, temp_count, unit); + list.data = FX_Alloc2D(uint8_t, temp_count, unit); list.start = nStart; list.count = temp_count; Append(list); @@ -1463,7 +1463,7 @@ public: } } - FX_LPBYTE GetAt(FX_INT32 nIndex) + FX_LPBYTE GetAt(int32_t nIndex) { if (nIndex < 0) { return NULL; @@ -1474,9 +1474,9 @@ public: DataList *pCurList = m_DataLists.GetDataPtr(m_CurList); if (!pCurList || nIndex < pCurList->start || nIndex >= pCurList->start + pCurList->count) { pCurList = NULL; - FX_INT32 iStart = 0; - FX_INT32 iEnd = m_DataLists.GetUpperBound(); - FX_INT32 iMid = 0; + int32_t iStart = 0; + int32_t iEnd = m_DataLists.GetUpperBound(); + int32_t iMid = 0; while (iStart <= iEnd) { iMid = (iStart + iEnd) / 2; DataList* list = m_DataLists.GetDataPtr(iMid); @@ -1496,11 +1496,11 @@ public: protected: void Append(const DataList& list) { - FX_INT32 iStart = 0; - FX_INT32 iEnd = m_DataLists.GetUpperBound(); - FX_INT32 iFind = 0; + int32_t iStart = 0; + int32_t iEnd = m_DataLists.GetUpperBound(); + int32_t iFind = 0; while (iStart <= iEnd) { - FX_INT32 iMid = (iStart + iEnd) / 2; + int32_t iMid = (iStart + iEnd) / 2; DataList* cur_list = m_DataLists.GetDataPtr(iMid); if (list.start < cur_list->start + cur_list->count) { iEnd = iMid - 1; @@ -1520,7 +1520,7 @@ protected: } m_DataLists.InsertAt(iFind, list); } - FX_INT32 m_CurList; + int32_t m_CurList; CFX_ArrayTemplate<DataList> m_DataLists; }; template<typename T1, typename T2> @@ -1533,19 +1533,19 @@ public: m_Data.Clear(); } - void Add(FX_INT32 nStart, FX_INT32 nCount) + void Add(int32_t nStart, int32_t nCount) { m_Data.Append(nStart, nCount); } - T2& operator [] (FX_INT32 nIndex) + T2& operator [] (int32_t nIndex) { FX_LPBYTE data = m_Data.GetAt(nIndex); FXSYS_assert(data != NULL); return (T2&)(*(volatile T2*)data); } - T2* GetPtrAt(FX_INT32 nIndex) + T2* GetPtrAt(int32_t nIndex) { return (T2*)m_Data.GetAt(nIndex); } diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h index 076c0e6a2f..c98ece9e07 100644 --- a/core/include/fxcrt/fx_coordinates.h +++ b/core/include/fxcrt/fx_coordinates.h @@ -113,15 +113,15 @@ public: } baseType x, y; }; -typedef CFX_PSVTemplate<FX_INT32> CFX_Point; +typedef CFX_PSVTemplate<int32_t> CFX_Point; typedef CFX_PSVTemplate<FX_FLOAT> CFX_PointF; -typedef CFX_PSVTemplate<FX_INT32> CFX_Size; +typedef CFX_PSVTemplate<int32_t> CFX_Size; typedef CFX_PSVTemplate<FX_FLOAT> CFX_SizeF; typedef CFX_ArrayTemplate<CFX_Point> CFX_Points; typedef CFX_ArrayTemplate<CFX_PointF> CFX_PointsF; -typedef CFX_PSVTemplate<FX_INT32> * FX_LPPOINT; +typedef CFX_PSVTemplate<int32_t> * FX_LPPOINT; typedef CFX_PSVTemplate<FX_FLOAT> * FX_LPPOINTF; -typedef CFX_PSVTemplate<FX_INT32> const * FX_LPCPOINT; +typedef CFX_PSVTemplate<int32_t> const * FX_LPCPOINT; typedef CFX_PSVTemplate<FX_FLOAT> const * FX_LPCPOINTF; #define CFX_FloatPoint CFX_PointF template<class baseType> @@ -227,7 +227,7 @@ public: return v.y < 0 ? -fSlope : fSlope; } }; -typedef CFX_VTemplate<FX_INT32> CFX_Vector; +typedef CFX_VTemplate<int32_t> CFX_Vector; typedef CFX_VTemplate<FX_FLOAT> CFX_VectorF; template<class baseType> class CFX_RTemplate @@ -524,11 +524,11 @@ public: baseType left, top; baseType width, height; }; -typedef CFX_RTemplate<FX_INT32> CFX_Rect; +typedef CFX_RTemplate<int32_t> CFX_Rect; typedef CFX_RTemplate<FX_FLOAT> CFX_RectF; -typedef CFX_RTemplate<FX_INT32> * FX_LPRECT; +typedef CFX_RTemplate<int32_t> * FX_LPRECT; typedef CFX_RTemplate<FX_FLOAT> * FX_LPRECTF; -typedef CFX_RTemplate<FX_INT32> const * FX_LPCRECT; +typedef CFX_RTemplate<int32_t> const * FX_LPCRECT; typedef CFX_RTemplate<FX_FLOAT> const * FX_LPCRECTF; typedef CFX_ArrayTemplate<CFX_RectF> CFX_RectFArray; struct FX_RECT { @@ -602,13 +602,13 @@ struct FX_RECT { }; struct FX_SMALL_RECT { - FX_SHORT Left; + int16_t Left; - FX_SHORT Top; + int16_t Top; - FX_SHORT Right; + int16_t Right; - FX_SHORT Bottom; + int16_t Bottom; }; class CFX_FloatRect { @@ -807,7 +807,7 @@ public: void Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended = FALSE); - void TranslateI(FX_INT32 x, FX_INT32 y, FX_BOOL bPrepended = FALSE) + void TranslateI(int32_t x, int32_t y, FX_BOOL bPrepended = FALSE) { Translate((FX_FLOAT)x, (FX_FLOAT)y, bPrepended); } @@ -831,17 +831,17 @@ public: FX_FLOAT GetUnitArea() const; FX_FLOAT TransformXDistance(FX_FLOAT dx) const; - FX_INT32 TransformXDistance(FX_INT32 dx) const; + int32_t TransformXDistance(int32_t dx) const; FX_FLOAT TransformYDistance(FX_FLOAT dy) const; - FX_INT32 TransformYDistance(FX_INT32 dy) const; + int32_t TransformYDistance(int32_t dy) const; FX_FLOAT TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const; - FX_INT32 TransformDistance(FX_INT32 dx, FX_INT32 dy) const; + int32_t TransformDistance(int32_t dx, int32_t dy) const; FX_FLOAT TransformDistance(FX_FLOAT distance) const; void TransformPoint(FX_FLOAT &x, FX_FLOAT &y) const; - void TransformPoint(FX_INT32 &x, FX_INT32 &y) const; - void TransformPoints(CFX_PointF *points, FX_INT32 iCount) const; - void TransformPoints(CFX_Point *points, FX_INT32 iCount) const; + void TransformPoint(int32_t &x, int32_t &y) const; + void TransformPoints(CFX_PointF *points, int32_t iCount) const; + void TransformPoints(CFX_Point *points, int32_t iCount) const; void Transform(FX_FLOAT& x, FX_FLOAT& y) const { diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h index 3d0cdedf9e..60cc259ff8 100644 --- a/core/include/fxcrt/fx_ext.h +++ b/core/include/fxcrt/fx_ext.h @@ -19,31 +19,31 @@ extern "C" { FX_FLOAT FXSYS_tan(FX_FLOAT a); FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); -FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, FX_INT32 iLength = -1, FX_INT32 *pUsedLen = NULL); -FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, FX_INT32 iLength = -1, FX_INT32 *pUsedLen = NULL); +FX_FLOAT FXSYS_strtof(FX_LPCSTR pcsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); +FX_FLOAT FXSYS_wcstof(FX_LPCWSTR pwsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); FX_LPWSTR FXSYS_wcsncpy(FX_LPWSTR dstStr, FX_LPCWSTR srcStr, size_t count); -FX_INT32 FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count); -FX_INT32 FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count); +int32_t FXSYS_wcsnicmp(FX_LPCWSTR s1, FX_LPCWSTR s2, size_t count); +int32_t FXSYS_strnicmp(FX_LPCSTR s1, FX_LPCSTR s2, size_t count); -inline FX_BOOL FXSYS_islower(FX_INT32 ch) +inline FX_BOOL FXSYS_islower(int32_t ch) { return ch >= 'a' && ch <= 'z'; } -inline FX_BOOL FXSYS_isupper(FX_INT32 ch) +inline FX_BOOL FXSYS_isupper(int32_t ch) { return ch >= 'A' && ch <= 'Z'; } -inline FX_INT32 FXSYS_tolower(FX_INT32 ch) +inline int32_t FXSYS_tolower(int32_t ch) { return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); } -inline FX_INT32 FXSYS_toupper(FX_INT32 ch) +inline int32_t FXSYS_toupper(int32_t ch) { return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); } -FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase = FALSE); -FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, FX_INT32 iLength, FX_BOOL bIgnoreCase = FALSE); +FX_DWORD FX_HashCode_String_GetA(FX_LPCSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); +FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); #ifdef __cplusplus } @@ -58,11 +58,11 @@ FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext); void FX_Random_MT_Close(FX_LPVOID pContext); -void FX_Random_GenerateBase(FX_LPDWORD pBuffer, FX_INT32 iCount); +void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount); -void FX_Random_GenerateMT(FX_LPDWORD pBuffer, FX_INT32 iCount); +void FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount); -void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, FX_INT32 iCount); +void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, int32_t iCount); #ifdef __cplusplus } #endif @@ -70,10 +70,10 @@ template<class baseType> class CFX_SSortTemplate { public: - void ShellSort(baseType *pArray, FX_INT32 iCount) + void ShellSort(baseType *pArray, int32_t iCount) { FXSYS_assert(pArray != NULL && iCount > 0); - FX_INT32 i, j, gap; + int32_t i, j, gap; baseType v1, v2; gap = iCount >> 1; while (gap > 0) { diff --git a/core/include/fxcrt/fx_safe_types.h b/core/include/fxcrt/fx_safe_types.h index e45e6d3c8d..ee50a53e34 100644 --- a/core/include/fxcrt/fx_safe_types.h +++ b/core/include/fxcrt/fx_safe_types.h @@ -12,7 +12,7 @@ #include "fx_system.h" typedef pdfium::base::CheckedNumeric<FX_DWORD> FX_SAFE_DWORD; -typedef pdfium::base::CheckedNumeric<FX_INT32> FX_SAFE_INT32; +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/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h index 7f36342160..a07fd6dc3a 100644 --- a/core/include/fxcrt/fx_stream.h +++ b/core/include/fxcrt/fx_stream.h @@ -20,7 +20,7 @@ typedef struct FX_HFILE_ { FX_LPVOID pData; }* FX_HFILE; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -#define FX_FILESIZE FX_INT32 +#define FX_FILESIZE int32_t #else #include <fcntl.h> #include <unistd.h> @@ -37,10 +37,10 @@ typedef struct FX_HFILE_ { #define FX_GETBYTEOFFSET40(a) 0 #define FX_GETBYTEOFFSET48(a) 0 #define FX_GETBYTEOFFSET56(a) 0 -#define FX_GETBYTEOFFSET24(a) ((FX_BYTE)(a>>24)) -#define FX_GETBYTEOFFSET16(a) ((FX_BYTE)(a>>16)) -#define FX_GETBYTEOFFSET8(a) ((FX_BYTE)(a>>8)) -#define FX_GETBYTEOFFSET0(a) ((FX_BYTE)(a)) +#define FX_GETBYTEOFFSET24(a) ((uint8_t)(a>>24)) +#define FX_GETBYTEOFFSET16(a) ((uint8_t)(a>>16)) +#define FX_GETBYTEOFFSET8(a) ((uint8_t)(a>>8)) +#define FX_GETBYTEOFFSET0(a) ((uint8_t)(a)) #define FX_FILEMODE_Write 0 #define FX_FILEMODE_ReadOnly 1 #define FX_FILEMODE_Truncate 2 diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index 9903dad942..8fc9d79ebb 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -121,7 +121,7 @@ public: return m_Length == 0; } - FX_BYTE GetAt(FX_STRSIZE index) const + uint8_t GetAt(FX_STRSIZE index) const { return m_Ptr[index]; } @@ -140,7 +140,7 @@ public: return CFX_ByteStringC(m_Ptr + index, count); } - const FX_BYTE& operator[] (size_t index) const + const uint8_t& operator[] (size_t index) const { return m_Ptr[index]; } @@ -279,12 +279,12 @@ public: const CFX_ByteString& operator += (FX_BSTR bstrc); - FX_BYTE GetAt(FX_STRSIZE nIndex) const + uint8_t GetAt(FX_STRSIZE nIndex) const { return m_pData ? m_pData->m_String[nIndex] : 0; } - FX_BYTE operator[](FX_STRSIZE nIndex) const + uint8_t operator[](FX_STRSIZE nIndex) const { return m_pData ? m_pData->m_String[nIndex] : 0; } diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h index f0ebcf90b1..80d75908d4 100644 --- a/core/include/fxcrt/fx_system.h +++ b/core/include/fxcrt/fx_system.h @@ -68,35 +68,23 @@ extern "C" { #endif typedef void* FX_LPVOID; // Deprecate, use with void*. -typedef void const* FX_LPCVOID; // Deprecate, use with const void*. +typedef const void* FX_LPCVOID; // Deprecate, use with const void*. typedef void* FX_POSITION; // Keep until fxcrt containers gone -typedef signed char FX_INT8; // Deprecate, use int8_t. -typedef unsigned char FX_UINT8; // Deprecate, use uint8_t. -typedef unsigned char FX_BYTE; // Deprecate, use uint8_t. -typedef unsigned char* FX_LPBYTE; // Deprecate, use uint8_t*. -typedef unsigned char const* FX_LPCBYTE; // Deprecate, use const uint8_t*. -typedef short FX_INT16; // Deprecate, use int16_t. -typedef unsigned short FX_UINT16; // Deprecate, use uint16_t. -typedef short FX_SHORT; // Deprecate, use int16_t. +typedef uint8_t* FX_LPBYTE; // Deprecate, use uint8_t*. +typedef const uint8_t* FX_LPCBYTE; // Deprecate, use const uint8_t*. typedef unsigned short FX_WORD; // Keep - "an efficient small type" -typedef unsigned short* FX_LPWORD; // Deprecate, use FX_WORD*. -typedef unsigned short const* FX_LPCWORD; // Deprecate, use const FX_WORD*. -typedef int FX_INT32; // Deprecate, use int32_t. -typedef unsigned int FX_UINT32; // Deprecate, use uint32_t. +typedef FX_WORD* FX_LPWORD; // Deprecate, use FX_WORD*. +typedef const FX_WORD* FX_LPCWORD; // Deprecate, use const FX_WORD*. typedef unsigned int FX_DWORD; // Keep - "an efficient type" -typedef unsigned int* FX_LPDWORD; // Deprecate, use FX_DWORD*. -typedef int64_t FX_INT64; // Deprecate, use int64_t. -typedef uint64_t FX_UINT64; // Deprecate, use uint64_t. -typedef intptr_t FX_INTPTR; // Deprecate, use intptr_t. -typedef uintptr_t FX_UINTPTR; // Deprecate, use uintptr_t. +typedef FX_DWORD* FX_LPDWORD; // Deprecate, use FX_DWORD*. typedef float FX_FLOAT; // Keep, allow upgrade to doubles. typedef int FX_BOOL; // Sadly not always 0 or 1. typedef char FX_CHAR; // Keep, questionable signedness. -typedef char* FX_LPSTR; // Deprecate, use FX_CHAR*. -typedef char const* FX_LPCSTR; // Deprecate, use const FX_CHAR*. +typedef FX_CHAR* FX_LPSTR; // Deprecate, use FX_CHAR*. +typedef const FX_CHAR* FX_LPCSTR; // Deprecate, use const FX_CHAR*. typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. -typedef wchar_t* FX_LPWSTR; // Deprecate, use FX_WCHAR*. -typedef wchar_t const* FX_LPCWSTR; // Deprecate, use const FX_WCHAR*. +typedef FX_WCHAR* FX_LPWSTR; // Deprecate, use FX_WCHAR*. +typedef const FX_WCHAR* FX_LPCWSTR; // Deprecate, use const FX_WCHAR*. // PDFium string sizes are limited to 2^31-1, and the value is signed to // allow -1 as a placeholder for "unknown". @@ -260,19 +248,19 @@ wchar_t* FXSYS_wcsupr(wchar_t* str); #define FXSYS_fmod(a, b) (FX_FLOAT)fmod(a, b) #define FXSYS_abs abs #define FXDWORD_FROM_LSBFIRST(i) (i) -#define FXDWORD_FROM_MSBFIRST(i) (((FX_BYTE)(i) << 24) | ((FX_BYTE)((i) >> 8) << 16) | ((FX_BYTE)((i) >> 16) << 8) | (FX_BYTE)((i) >> 24)) +#define FXDWORD_FROM_MSBFIRST(i) (((uint8_t)(i) << 24) | ((uint8_t)((i) >> 8) << 16) | ((uint8_t)((i) >> 16) << 8) | (uint8_t)((i) >> 24)) #define FXDWORD_GET_LSBFIRST(p) ((((FX_LPBYTE)(p))[3] << 24) | (((FX_LPBYTE)(p))[2] << 16) | (((FX_LPBYTE)(p))[1] << 8) | (((FX_LPBYTE)(p))[0])) #define FXDWORD_GET_MSBFIRST(p) ((((FX_LPBYTE)(p))[0] << 24) | (((FX_LPBYTE)(p))[1] << 16) | (((FX_LPBYTE)(p))[2] << 8) | (((FX_LPBYTE)(p))[3])) -#define FXSYS_HIBYTE(word) ((FX_BYTE)((word) >> 8)) -#define FXSYS_LOBYTE(word) ((FX_BYTE)(word)) +#define FXSYS_HIBYTE(word) ((uint8_t)((word) >> 8)) +#define FXSYS_LOBYTE(word) ((uint8_t)(word)) #define FXSYS_HIWORD(dword) ((FX_WORD)((dword) >> 16)) #define FXSYS_LOWORD(dword) ((FX_WORD)(dword)) -FX_INT32 FXSYS_atoi(FX_LPCSTR str); -FX_INT32 FXSYS_wtoi(FX_LPCWSTR str); -FX_INT64 FXSYS_atoi64(FX_LPCSTR str); -FX_INT64 FXSYS_wtoi64(FX_LPCWSTR str); -FX_LPCSTR FXSYS_i64toa(FX_INT64 value, FX_LPSTR str, int radix); -FX_LPCWSTR FXSYS_i64tow(FX_INT64 value, FX_LPWSTR str, int radix); +int32_t FXSYS_atoi(FX_LPCSTR str); +int32_t FXSYS_wtoi(FX_LPCWSTR str); +int64_t FXSYS_atoi64(FX_LPCSTR str); +int64_t FXSYS_wtoi64(FX_LPCWSTR str); +FX_LPCSTR FXSYS_i64toa(int64_t value, FX_LPSTR str, int radix); +FX_LPCWSTR FXSYS_i64tow(int64_t value, FX_LPWSTR str, int radix); int FXSYS_round(FX_FLOAT f); #define FXSYS_Mul(a, b) ((a) * (b)) #define FXSYS_Div(a, b) ((a) / (b)) |