From d7e5cc754a937605d1f73db5e7967c58ddd80742 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 10 Jun 2015 14:33:37 -0700 Subject: Merge to XFA: Remove typdefs for pointer types in fx_system.h. Original Review URL: https://codereview.chromium.org/1171733003 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1178613002. --- core/include/fxcrt/fx_basic.h | 70 +++++++++++----------- core/include/fxcrt/fx_ext.h | 26 ++++----- core/include/fxcrt/fx_memory.h | 4 +- core/include/fxcrt/fx_stream.h | 26 ++++----- core/include/fxcrt/fx_string.h | 128 ++++++++++++++++++++--------------------- core/include/fxcrt/fx_system.h | 31 ++++------ core/include/fxcrt/fx_ucd.h | 2 +- 7 files changed, 138 insertions(+), 149 deletions(-) (limited to 'core/include/fxcrt') diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index fbcb657012..924420da91 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -66,7 +66,7 @@ public: void Delete(int start_index, int count); - FX_LPBYTE GetBuffer() const + uint8_t* GetBuffer() const { return m_pBuffer; } @@ -83,7 +83,7 @@ protected: FX_STRSIZE m_AllocStep; - FX_LPBYTE m_pBuffer; + uint8_t* m_pBuffer; FX_STRSIZE m_DataSize; @@ -121,7 +121,7 @@ class CFX_WideTextBuf : public CFX_BinaryBuf { public: - void operator = (FX_LPCWSTR lpsz); + void operator = (const FX_WCHAR* lpsz); void operator = (FX_WSTR str); @@ -131,7 +131,7 @@ public: CFX_WideTextBuf& operator << (double f); - CFX_WideTextBuf& operator << (FX_LPCWSTR lpsz); + CFX_WideTextBuf& operator << (const FX_WCHAR* lpsz); CFX_WideTextBuf& operator << (FX_WSTR str); CFX_WideTextBuf& operator << (const CFX_WideString &str); @@ -143,9 +143,9 @@ public: return m_DataSize / sizeof(FX_WCHAR); } - FX_LPWSTR GetBuffer() const + FX_WCHAR* GetBuffer() const { - return (FX_LPWSTR)m_pBuffer; + return (FX_WCHAR*)m_pBuffer; } void Delete(int start_index, int count) @@ -172,7 +172,7 @@ public: CFX_ArchiveSaver& operator << (FX_BSTR bstr); - CFX_ArchiveSaver& operator << (FX_LPCWSTR bstr); + CFX_ArchiveSaver& operator << (const FX_WCHAR* bstr); CFX_ArchiveSaver& operator << (const CFX_WideString& wstr); @@ -183,7 +183,7 @@ public: return m_SavingBuf.GetSize(); } - FX_LPCBYTE GetBuffer() + const uint8_t* GetBuffer() { return m_SavingBuf.GetBuffer(); } @@ -202,7 +202,7 @@ class CFX_ArchiveLoader { public: - CFX_ArchiveLoader(FX_LPCBYTE pData, FX_DWORD dwSize); + CFX_ArchiveLoader(const uint8_t* pData, FX_DWORD dwSize); CFX_ArchiveLoader& operator >> (uint8_t& i); @@ -225,7 +225,7 @@ protected: FX_DWORD m_LoadingPos; - FX_LPCBYTE m_pLoadingBuf; + const uint8_t* m_pLoadingBuf; FX_DWORD m_LoadingSize; }; @@ -256,7 +256,7 @@ protected: FX_STRSIZE m_BufSize; - FX_LPBYTE m_pBuffer; + uint8_t* m_pBuffer; FX_STRSIZE m_Length; }; @@ -269,9 +269,9 @@ public: FX_BOOL AttachFile(IFX_StreamWrite *pFile, FX_BOOL bTakeover = FALSE); - FX_BOOL AttachFile(FX_LPCWSTR filename); + FX_BOOL AttachFile(const FX_WCHAR* filename); - FX_BOOL AttachFile(FX_LPCSTR filename); + FX_BOOL AttachFile(const FX_CHAR* filename); private: virtual FX_BOOL DoWork(const void* pBuf, size_t size); @@ -365,7 +365,7 @@ protected: FX_BOOL Copy(const CFX_BasicArray& src); - FX_LPBYTE InsertSpaceAt(int nIndex, int nCount); + uint8_t* InsertSpaceAt(int nIndex, int nCount); FX_BOOL RemoveAt(int nIndex, int nCount); @@ -374,7 +374,7 @@ protected: const void* GetDataPtr(int index) const; protected: - FX_LPBYTE m_pData; + uint8_t* m_pData; int m_nSize; @@ -713,7 +713,7 @@ private: void* m_pIndex; void** GetIndex(int seg_index) const; void* IterateIndex(int level, int& start, void** pIndex, FX_BOOL (*callback)(void* param, void* pData), void* param) const; - void* IterateSegment(FX_LPCBYTE pSegment, int count, FX_BOOL (*callback)(void* param, void* pData), void* param) const; + void* IterateSegment(const uint8_t* pSegment, int count, FX_BOOL (*callback)(void* param, void* pData), void* param) const; }; template class CFX_SegmentedArray : public CFX_BaseSegmentedArray @@ -858,7 +858,7 @@ public: FX_BOOL Lookup(KeyType key, ValueType& rValue) const { - FX_LPVOID pValue = NULL; + void* pValue = NULL; if (!CFX_MapPtrToPtr::Lookup((void*)(uintptr_t)key, pValue)) { return FALSE; } @@ -954,7 +954,7 @@ public: void GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteString& rKey, void*& rValue) const; - FX_LPVOID GetNextValue(FX_POSITION& rNextPosition) const; + void* GetNextValue(FX_POSITION& rNextPosition) const; FX_DWORD GetHashTableSize() const { @@ -1000,7 +1000,7 @@ public: void GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteString& rKey, void*& rValue) const; - FX_LPVOID GetNextValue(FX_POSITION& rNextPosition) const; + void* GetNextValue(FX_POSITION& rNextPosition) const; FX_BOOL Lookup(FX_BSTR key, void*& rValue) const; @@ -1115,14 +1115,14 @@ public: ~CFX_PtrList(); }; -typedef void (*PD_CALLBACK_FREEDATA)(FX_LPVOID pData); +typedef void (*PD_CALLBACK_FREEDATA)(void* pData); struct FX_PRIVATEDATA { void FreeData(); - FX_LPVOID m_pModuleId; + void* m_pModuleId; - FX_LPVOID m_pData; + void* m_pData; PD_CALLBACK_FREEDATA m_pCallback; @@ -1136,13 +1136,13 @@ public: void ClearAll(); - void SetPrivateData(FX_LPVOID module_id, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback); + void SetPrivateData(void* module_id, void* pData, PD_CALLBACK_FREEDATA callback); - void SetPrivateObj(FX_LPVOID module_id, CFX_DestructObject* pObj); + void SetPrivateObj(void* module_id, CFX_DestructObject* pObj); - FX_LPVOID GetPrivateData(FX_LPVOID module_id); + void* GetPrivateData(void* module_id); - FX_BOOL LookupPrivateData(FX_LPVOID module_id, FX_LPVOID &pData) const + FX_BOOL LookupPrivateData(void* module_id, void* &pData) const { if (!module_id) { return FALSE; @@ -1157,18 +1157,18 @@ public: return FALSE; } - FX_BOOL RemovePrivateData(FX_LPVOID module_id); + FX_BOOL RemovePrivateData(void* module_id); protected: CFX_ArrayTemplate m_DataList; - void AddData(FX_LPVOID module_id, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct); + void AddData(void* module_id, void* pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct); }; class CFX_BitStream { public: - void Init(FX_LPCBYTE pData, FX_DWORD dwSize); + void Init(const uint8_t* pData, FX_DWORD dwSize); FX_DWORD GetBits(FX_DWORD nBits); @@ -1195,7 +1195,7 @@ protected: FX_DWORD m_BitSize; - FX_LPCBYTE m_pData; + const uint8_t* m_pData; }; template class CFX_CountRef { @@ -1365,13 +1365,13 @@ public: return m_SrcPos; } - void FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); + void FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf); void FilterFinish(CFX_BinaryBuf& dest_buf); protected: CFX_DataFilter(); - virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) = 0; + virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf) = 0; virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) = 0; void ReportEOF(FX_DWORD left_input); @@ -1431,7 +1431,7 @@ protected: int32_t start; int32_t count; - FX_LPBYTE data; + uint8_t* data; }; public: @@ -1472,7 +1472,7 @@ public: } } - FX_LPBYTE GetAt(int32_t nIndex) + uint8_t* GetAt(int32_t nIndex) { if (nIndex < 0) { return NULL; @@ -1549,7 +1549,7 @@ public: T2& operator [] (int32_t nIndex) { - FX_LPBYTE data = m_Data.GetAt(nIndex); + uint8_t* data = m_Data.GetAt(nIndex); FXSYS_assert(data != NULL); return (T2&)(*(volatile T2*)data); } diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h index b31d7a43f7..9bb4c29fe6 100644 --- a/core/include/fxcrt/fx_ext.h +++ b/core/include/fxcrt/fx_ext.h @@ -19,11 +19,11 @@ 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, 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); -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); +FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); +FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, int32_t iLength = -1, int32_t *pUsedLen = NULL); +FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count); +int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count); +int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count); inline FX_BOOL FXSYS_islower(int32_t ch) { @@ -42,8 +42,8 @@ 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, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); -FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); +FX_DWORD 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, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); #ifdef __cplusplus } @@ -52,17 +52,17 @@ FX_DWORD FX_HashCode_String_GetW(FX_LPCWSTR pStr, int32_t iLength, FX_BOOL bIgno extern "C" { #endif -FX_LPVOID FX_Random_MT_Start(FX_DWORD dwSeed); +void* FX_Random_MT_Start(FX_DWORD dwSeed); -FX_DWORD FX_Random_MT_Generate(FX_LPVOID pContext); +FX_DWORD FX_Random_MT_Generate(void* pContext); -void FX_Random_MT_Close(FX_LPVOID pContext); +void FX_Random_MT_Close(void* pContext); -void FX_Random_GenerateBase(FX_LPDWORD pBuffer, int32_t iCount); +void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount); -void FX_Random_GenerateMT(FX_LPDWORD pBuffer, int32_t iCount); +void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount); -void FX_Random_GenerateCrypto(FX_LPDWORD pBuffer, int32_t iCount); +void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount); #ifdef __cplusplus } #endif diff --git a/core/include/fxcrt/fx_memory.h b/core/include/fxcrt/fx_memory.h index 03df3647b0..2e7eafbaca 100644 --- a/core/include/fxcrt/fx_memory.h +++ b/core/include/fxcrt/fx_memory.h @@ -91,14 +91,14 @@ public: m_TrunkSize = trunk_size; } - void* AllocDebug(size_t size, FX_LPCSTR file, int line) + void* AllocDebug(size_t size, const FX_CHAR* file, int line) { return Alloc(size); } void* Alloc(size_t size); - void* ReallocDebug(void* p, size_t new_size, FX_LPCSTR file, int line) + void* ReallocDebug(void* p, size_t new_size, const FX_CHAR* file, int line) { return NULL; } diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h index 190ce97cac..ea3d23bab1 100644 --- a/core/include/fxcrt/fx_stream.h +++ b/core/include/fxcrt/fx_stream.h @@ -10,14 +10,14 @@ #include "fx_memory.h" #include "fx_string.h" -void* FX_OpenFolder(FX_LPCSTR path); -void* FX_OpenFolder(FX_LPCWSTR path); +void* FX_OpenFolder(const FX_CHAR* path); +void* FX_OpenFolder(const FX_WCHAR* path); FX_BOOL FX_GetNextFile(void* handle, CFX_ByteString& filename, FX_BOOL& bFolder); FX_BOOL FX_GetNextFile(void* handle, CFX_WideString& filename, FX_BOOL& bFolder); void FX_CloseFolder(void* handle); FX_WCHAR FX_GetFolderSeparator(); typedef struct FX_HFILE_ { - FX_LPVOID pData; + void* pData; }* FX_HFILE; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ #define FX_FILESIZE int32_t @@ -88,8 +88,8 @@ public: return WriteBlock(pData, GetSize(), size); } }; -IFX_FileWrite* FX_CreateFileWrite(FX_LPCSTR filename); -IFX_FileWrite* FX_CreateFileWrite(FX_LPCWSTR filename); +IFX_FileWrite* FX_CreateFileWrite(const FX_CHAR* filename); +IFX_FileWrite* FX_CreateFileWrite(const FX_WCHAR* filename); class IFX_StreamRead { public: @@ -134,8 +134,8 @@ public: return 0; } }; -IFX_FileRead* FX_CreateFileRead(FX_LPCSTR filename); -IFX_FileRead* FX_CreateFileRead(FX_LPCWSTR filename); +IFX_FileRead* FX_CreateFileRead(const FX_CHAR* filename); +IFX_FileRead* FX_CreateFileRead(const FX_WCHAR* filename); class IFX_FileStream : public IFX_FileRead, public IFX_FileWrite { public: @@ -162,8 +162,8 @@ public: virtual FX_BOOL Flush() = 0; }; -IFX_FileStream* FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes); -IFX_FileStream* FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes); +IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes); +IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, FX_DWORD dwModes); class IFX_FileAccess { public: @@ -181,13 +181,13 @@ public: virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0; - virtual FX_LPBYTE GetBuffer() const = 0; + virtual uint8_t* GetBuffer() const = 0; - virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) = 0; + virtual void AttachBuffer(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) = 0; virtual void DetachBuffer() = 0; }; -IFX_MemoryStream* FX_CreateMemoryStream(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE); +IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE); IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE); class IFX_BufferRead : public IFX_StreamRead { @@ -203,7 +203,7 @@ public: virtual FX_BOOL ReadNextBlock(FX_BOOL bRestart = FALSE) = 0; - virtual FX_LPCBYTE GetBlockBuffer() = 0; + virtual const uint8_t* GetBlockBuffer() = 0; virtual size_t GetBlockSize() = 0; diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index 8fc9d79ebb..5923ffdf2d 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -31,15 +31,15 @@ public: m_Length = 0; } - CFX_ByteStringC(FX_LPCBYTE ptr, FX_STRSIZE size) + CFX_ByteStringC(const uint8_t* ptr, FX_STRSIZE size) { m_Ptr = ptr; m_Length = size; } - CFX_ByteStringC(FX_LPCSTR ptr) + CFX_ByteStringC(const FX_CHAR* ptr) { - m_Ptr = (FX_LPCBYTE)ptr; + m_Ptr = (const uint8_t*)ptr; m_Length = ptr ? FXSYS_strlen(ptr) : 0; } @@ -52,13 +52,13 @@ public: // TODO(tsepez): Mark single-argument string constructors as explicit. CFX_ByteStringC(FX_CHAR& ch) { - m_Ptr = (FX_LPCBYTE)&ch; + m_Ptr = (const uint8_t*)&ch; m_Length = 1; } - CFX_ByteStringC(FX_LPCSTR ptr, FX_STRSIZE len) + CFX_ByteStringC(const FX_CHAR* ptr, FX_STRSIZE len) { - m_Ptr = (FX_LPCBYTE)ptr; + m_Ptr = (const uint8_t*)ptr; m_Length = (len == -1) ? FXSYS_strlen(ptr) : len; } @@ -70,9 +70,9 @@ public: CFX_ByteStringC(const CFX_ByteString& src); - CFX_ByteStringC& operator = (FX_LPCSTR src) + CFX_ByteStringC& operator = (const FX_CHAR* src) { - m_Ptr = (FX_LPCBYTE)src; + m_Ptr = (const uint8_t*)src; m_Length = m_Ptr ? FXSYS_strlen(src) : 0; return *this; } @@ -101,14 +101,14 @@ public: FX_DWORD GetID(FX_STRSIZE start_pos = 0) const; - FX_LPCBYTE GetPtr() const + const uint8_t* GetPtr() const { return m_Ptr; } - FX_LPCSTR GetCStr() const + const FX_CHAR* GetCStr() const { - return (FX_LPCSTR)m_Ptr; + return (const FX_CHAR*)m_Ptr; } FX_STRSIZE GetLength() const @@ -152,7 +152,7 @@ public: } protected: - FX_LPCBYTE m_Ptr; + const uint8_t* m_Ptr; FX_STRSIZE m_Length; private: @@ -190,36 +190,36 @@ public: } CFX_ByteString(char ch); - CFX_ByteString(FX_LPCSTR ptr) + CFX_ByteString(const FX_CHAR* ptr) : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) { } - CFX_ByteString(FX_LPCSTR ptr, FX_STRSIZE len); - CFX_ByteString(FX_LPCBYTE ptr, FX_STRSIZE len); + CFX_ByteString(const FX_CHAR* ptr, FX_STRSIZE len); + CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len); CFX_ByteString(FX_BSTR bstrc); CFX_ByteString(FX_BSTR bstrc1, FX_BSTR bstrc2); ~CFX_ByteString(); - static CFX_ByteString FromUnicode(FX_LPCWSTR ptr, FX_STRSIZE len = -1); + static CFX_ByteString FromUnicode(const FX_WCHAR* ptr, FX_STRSIZE len = -1); static CFX_ByteString FromUnicode(const CFX_WideString& str); // Explicit conversion to raw string - FX_LPCSTR c_str() const + const FX_CHAR* c_str() const { return m_pData ? m_pData->m_String : ""; } // Implicit conversion to C-style string -- deprecated - operator FX_LPCSTR() const + operator const FX_CHAR*() const { return m_pData ? m_pData->m_String : ""; } - operator FX_LPCBYTE() const + operator const uint8_t*() const { - return m_pData ? (FX_LPCBYTE)m_pData->m_String : NULL; + return m_pData ? (const uint8_t*)m_pData->m_String : NULL; } FX_STRSIZE GetLength() const @@ -261,7 +261,7 @@ public: void Empty(); - const CFX_ByteString& operator = (FX_LPCSTR str); + const CFX_ByteString& operator = (const FX_CHAR* str); const CFX_ByteString& operator = (FX_BSTR bstrc); @@ -269,11 +269,11 @@ public: const CFX_ByteString& operator = (const CFX_BinaryBuf& buf); - void Load(FX_LPCBYTE str, FX_STRSIZE len); + void Load(const uint8_t* str, FX_STRSIZE len); const CFX_ByteString& operator += (FX_CHAR ch); - const CFX_ByteString& operator += (FX_LPCSTR str); + const CFX_ByteString& operator += (const FX_CHAR* str); const CFX_ByteString& operator += (const CFX_ByteString& str); @@ -296,14 +296,14 @@ public: FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1); - void Format(FX_LPCSTR lpszFormat, ... ); + void Format(const FX_CHAR* lpszFormat, ... ); - void FormatV(FX_LPCSTR lpszFormat, va_list argList); + void FormatV(const FX_CHAR* lpszFormat, va_list argList); void Reserve(FX_STRSIZE len); - FX_LPSTR GetBuffer(FX_STRSIZE len); + FX_CHAR* GetBuffer(FX_STRSIZE len); void ReleaseBuffer(FX_STRSIZE len = -1); @@ -384,9 +384,9 @@ protected: }; void AllocCopy(CFX_ByteString& dest, FX_STRSIZE nCopyLen, FX_STRSIZE nCopyIndex) const; - void AssignCopy(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData); - void ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCSTR lpszSrc1Data, FX_STRSIZE nSrc2Len, FX_LPCSTR lpszSrc2Data); - void ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCSTR lpszSrcData); + void AssignCopy(FX_STRSIZE nSrcLen, const FX_CHAR* lpszSrcData); + void ConcatCopy(FX_STRSIZE nSrc1Len, const FX_CHAR* lpszSrc1Data, FX_STRSIZE nSrc2Len, const FX_CHAR* lpszSrc2Data); + void ConcatInPlace(FX_STRSIZE nSrcLen, const FX_CHAR* lpszSrcData); void CopyBeforeWrite(); void AllocBeforeWrite(FX_STRSIZE nLen); @@ -395,12 +395,12 @@ protected: }; inline CFX_ByteStringC::CFX_ByteStringC(const CFX_ByteString& src) { - m_Ptr = (FX_LPCBYTE)src; + m_Ptr = (const uint8_t*)src; m_Length = src.GetLength(); } inline CFX_ByteStringC& CFX_ByteStringC::operator = (const CFX_ByteString& src) { - m_Ptr = (FX_LPCBYTE)src; + m_Ptr = (const uint8_t*)src; m_Length = src.GetLength(); return *this; } @@ -422,11 +422,11 @@ inline CFX_ByteString operator + (FX_BSTR str1, FX_BSTR str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (FX_BSTR str1, FX_LPCSTR str2) +inline CFX_ByteString operator + (FX_BSTR str1, const FX_CHAR* str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (FX_LPCSTR str1, FX_BSTR str2) +inline CFX_ByteString operator + (const FX_CHAR* str1, FX_BSTR str2) { return CFX_ByteString(str1, str2); } @@ -450,11 +450,11 @@ inline CFX_ByteString operator + (FX_CHAR ch, const CFX_ByteString& str2) { return CFX_ByteString(ch, str2); } -inline CFX_ByteString operator + (const CFX_ByteString& str1, FX_LPCSTR str2) +inline CFX_ByteString operator + (const CFX_ByteString& str1, const FX_CHAR* str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (FX_LPCSTR str1, const CFX_ByteString& str2) +inline CFX_ByteString operator + (const FX_CHAR* str1, const CFX_ByteString& str2) { return CFX_ByteString(str1, str2); } @@ -477,7 +477,7 @@ public: m_Length = 0; } - CFX_WideStringC(FX_LPCWSTR ptr) + CFX_WideStringC(const FX_WCHAR* ptr) { m_Ptr = ptr; m_Length = ptr ? FXSYS_wcslen(ptr) : 0; @@ -489,7 +489,7 @@ public: m_Length = 1; } - CFX_WideStringC(FX_LPCWSTR ptr, FX_STRSIZE len) + CFX_WideStringC(const FX_WCHAR* ptr, FX_STRSIZE len) { m_Ptr = ptr; m_Length = (len == -1) ? FXSYS_wcslen(ptr) : len; @@ -503,7 +503,7 @@ public: CFX_WideStringC(const CFX_WideString& src); - CFX_WideStringC& operator = (FX_LPCWSTR src) + CFX_WideStringC& operator = (const FX_WCHAR* src) { m_Ptr = src; m_Length = FXSYS_wcslen(src); @@ -532,7 +532,7 @@ public: return !(*this == str); } - FX_LPCWSTR GetPtr() const + const FX_WCHAR* GetPtr() const { return m_Ptr; } @@ -600,7 +600,7 @@ public: } protected: - FX_LPCWSTR m_Ptr; + const FX_WCHAR* m_Ptr; FX_STRSIZE m_Length; private: @@ -636,10 +636,10 @@ public: other.m_pData = nullptr; } - CFX_WideString(FX_LPCWSTR ptr) + CFX_WideString(const FX_WCHAR* ptr) : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) { } - CFX_WideString(FX_LPCWSTR ptr, FX_STRSIZE len); + CFX_WideString(const FX_WCHAR* ptr, FX_STRSIZE len); CFX_WideString(FX_WCHAR ch); @@ -658,13 +658,13 @@ public: static FX_STRSIZE WStringLength(const unsigned short* str); // Explicit conversion to raw string - FX_LPCWSTR c_str() const + const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; } // Implicit conversion to C-style wide string -- deprecated - operator FX_LPCWSTR() const + operator const FX_WCHAR*() const { return m_pData ? m_pData->m_String : L""; } @@ -682,13 +682,13 @@ public: return m_pData ? m_pData->m_nDataLength : 0; } - const CFX_WideString& operator = (FX_LPCWSTR str); + const CFX_WideString& operator = (const FX_WCHAR* str); const CFX_WideString& operator =(const CFX_WideString& stringSrc); const CFX_WideString& operator =(const CFX_WideStringC& stringSrc); - const CFX_WideString& operator += (FX_LPCWSTR str); + const CFX_WideString& operator += (const FX_WCHAR* str); const CFX_WideString& operator += (FX_WCHAR ch); @@ -725,11 +725,11 @@ public: void SetAt(FX_STRSIZE nIndex, FX_WCHAR ch); - int Compare(FX_LPCWSTR str) const; + int Compare(const FX_WCHAR* str) const; int Compare(const CFX_WideString& str) const; - int CompareNoCase(FX_LPCWSTR str) const; + int CompareNoCase(const FX_WCHAR* str) const; bool Equal(const wchar_t* ptr) const; bool Equal(const CFX_WideStringC& str) const; @@ -747,9 +747,9 @@ public: FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1); - void Format(FX_LPCWSTR lpszFormat, ... ); + void Format(const FX_WCHAR* lpszFormat, ... ); - void FormatV(FX_LPCWSTR lpszFormat, va_list argList); + void FormatV(const FX_WCHAR* lpszFormat, va_list argList); void MakeLower(); @@ -759,17 +759,17 @@ public: void TrimRight(FX_WCHAR chTarget); - void TrimRight(FX_LPCWSTR lpszTargets); + void TrimRight(const FX_WCHAR* lpszTargets); void TrimLeft(); void TrimLeft(FX_WCHAR chTarget); - void TrimLeft(FX_LPCWSTR lpszTargets); + void TrimLeft(const FX_WCHAR* lpszTargets); void Reserve(FX_STRSIZE len); - FX_LPWSTR GetBuffer(FX_STRSIZE len); + FX_WCHAR* GetBuffer(FX_STRSIZE len); void ReleaseBuffer(FX_STRSIZE len = -1); @@ -777,11 +777,11 @@ public: FX_FLOAT GetFloat() const; - FX_STRSIZE Find(FX_LPCWSTR lpszSub, FX_STRSIZE start = 0) const; + FX_STRSIZE Find(const FX_WCHAR* lpszSub, FX_STRSIZE start = 0) const; FX_STRSIZE Find(FX_WCHAR ch, FX_STRSIZE start = 0) const; - FX_STRSIZE Replace(FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew); + FX_STRSIZE Replace(const FX_WCHAR* lpszOld, const FX_WCHAR* lpszNew); FX_STRSIZE Remove(FX_WCHAR ch); @@ -816,9 +816,9 @@ protected: void CopyBeforeWrite(); void AllocBeforeWrite(FX_STRSIZE nLen); - void ConcatInPlace(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcData); - void ConcatCopy(FX_STRSIZE nSrc1Len, FX_LPCWSTR lpszSrc1Data, FX_STRSIZE nSrc2Len, FX_LPCWSTR lpszSrc2Data); - void AssignCopy(FX_STRSIZE nSrcLen, FX_LPCWSTR lpszSrcData); + void ConcatInPlace(FX_STRSIZE nSrcLen, const FX_WCHAR* lpszSrcData); + void ConcatCopy(FX_STRSIZE nSrc1Len, const FX_WCHAR* lpszSrc1Data, FX_STRSIZE nSrc2Len, const FX_WCHAR* lpszSrc2Data); + void AssignCopy(FX_STRSIZE nSrcLen, const FX_WCHAR* lpszSrcData); void AllocCopy(CFX_WideString& dest, FX_STRSIZE nCopyLen, FX_STRSIZE nCopyIndex) const; StringData* m_pData; @@ -840,11 +840,11 @@ inline CFX_WideString operator + (const CFX_WideStringC& str1, const CFX_WideStr { return CFX_WideString(str1, str2); } -inline CFX_WideString operator + (const CFX_WideStringC& str1, FX_LPCWSTR str2) +inline CFX_WideString operator + (const CFX_WideStringC& str1, const FX_WCHAR* str2) { return CFX_WideString(str1, str2); } -inline CFX_WideString operator + (FX_LPCWSTR str1, const CFX_WideStringC& str2) +inline CFX_WideString operator + (const FX_WCHAR* str1, const CFX_WideStringC& str2) { return CFX_WideString(str1, str2); } @@ -868,11 +868,11 @@ inline CFX_WideString operator + (FX_WCHAR ch, const CFX_WideString& str2) { return CFX_WideString(ch, str2); } -inline CFX_WideString operator + (const CFX_WideString& str1, FX_LPCWSTR str2) +inline CFX_WideString operator + (const CFX_WideString& str1, const FX_WCHAR* str2) { return CFX_WideString(str1, str2); } -inline CFX_WideString operator + (FX_LPCWSTR str1, const CFX_WideString& str2) +inline CFX_WideString operator + (const FX_WCHAR* str1, const CFX_WideString& str2) { return CFX_WideString(str1, str2); } @@ -898,8 +898,8 @@ inline bool operator!= (const CFX_WideStringC& lhs, const CFX_WideString& rhs) { } FX_FLOAT FX_atof(FX_BSTR str); void FX_atonum(FX_BSTR str, FX_BOOL& bInteger, void* pData); -FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_LPSTR buf); -CFX_ByteString FX_UTF8Encode(FX_LPCWSTR pwsStr, FX_STRSIZE len); +FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); +CFX_ByteString FX_UTF8Encode(const FX_WCHAR* pwsStr, FX_STRSIZE len); inline CFX_ByteString FX_UTF8Encode(FX_WSTR wsStr) { return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h index 80d75908d4..ec6d6294b0 100644 --- a/core/include/fxcrt/fx_system.h +++ b/core/include/fxcrt/fx_system.h @@ -67,24 +67,13 @@ #ifdef __cplusplus extern "C" { #endif -typedef void* FX_LPVOID; // Deprecate, use with void*. -typedef const void* FX_LPCVOID; // Deprecate, use with const void*. typedef void* FX_POSITION; // Keep until fxcrt containers gone -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 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 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 int FX_BOOL; // Keep, sadly not always 0 or 1. typedef char FX_CHAR; // Keep, questionable signedness. -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 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". @@ -158,7 +147,7 @@ void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap); #define FXSYS_wfopen _wfopen #endif #else -FXSYS_FILE* FXSYS_wfopen(FX_LPCWSTR filename, FX_LPCWSTR mode); +FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode); #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ #ifdef __cplusplus @@ -249,18 +238,18 @@ wchar_t* FXSYS_wcsupr(wchar_t* str); #define FXSYS_abs abs #define FXDWORD_FROM_LSBFIRST(i) (i) #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 FXDWORD_GET_LSBFIRST(p) ((((uint8_t*)(p))[3] << 24) | (((uint8_t*)(p))[2] << 16) | (((uint8_t*)(p))[1] << 8) | (((uint8_t*)(p))[0])) +#define FXDWORD_GET_MSBFIRST(p) ((((uint8_t*)(p))[0] << 24) | (((uint8_t*)(p))[1] << 16) | (((uint8_t*)(p))[2] << 8) | (((uint8_t*)(p))[3])) #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)) -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); +int32_t FXSYS_atoi(const FX_CHAR* str); +int32_t FXSYS_wtoi(const FX_WCHAR* str); +int64_t FXSYS_atoi64(const FX_CHAR* str); +int64_t FXSYS_wtoi64(const FX_WCHAR* str); +const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix); +const FX_WCHAR* FXSYS_i64tow(int64_t value, FX_WCHAR* str, int radix); int FXSYS_round(FX_FLOAT f); #define FXSYS_Mul(a, b) ((a) * (b)) #define FXSYS_Div(a, b) ((a) / (b)) diff --git a/core/include/fxcrt/fx_ucd.h b/core/include/fxcrt/fx_ucd.h index 466acd45d4..e8d55d1cd3 100644 --- a/core/include/fxcrt/fx_ucd.h +++ b/core/include/fxcrt/fx_ucd.h @@ -167,7 +167,7 @@ public: int16_t m_iBidiLevel; int16_t m_iBidiPos; int16_t m_iBidiOrder; - FX_LPVOID m_pUserData; + void* m_pUserData; }; typedef CFX_ArrayTemplate CFX_TxtCharArray; class CFX_RTFChar : public CFX_Char -- cgit v1.2.3