diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-06-10 16:51:15 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-06-10 16:51:15 -0700 |
commit | 6f0a64a1bf18ab6636404cdfb883897459083a4d (patch) | |
tree | 1ef1326c8bb015213e0cdf0d726a27a537d09c73 /core/include/fxcrt | |
parent | e4503ea9947d2f9c61704da20271b413a364a9c0 (diff) | |
download | pdfium-chromium/2430.tar.xz |
Remove FX_BSTR and FX_WSTR typedefs.chromium/2434chromium/2433chromium/2432chromium/2431chromium/2430
These stand for const CFX_{Byte,Wide}StringC&, which is just
monumentally confusing, since there are so many string types
running around here.
The following had manual changes:
core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
core/src/fpdfdoc/doc_form.cpp
fpdfsdk/src/fpdf_ext.cpp
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1180593004.
Diffstat (limited to 'core/include/fxcrt')
-rw-r--r-- | core/include/fxcrt/fx_basic.h | 36 | ||||
-rw-r--r-- | core/include/fxcrt/fx_stream.h | 20 | ||||
-rw-r--r-- | core/include/fxcrt/fx_string.h | 42 | ||||
-rw-r--r-- | core/include/fxcrt/fx_xml.h | 50 |
4 files changed, 73 insertions, 75 deletions
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 004b01875b..df36c26a02 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -43,7 +43,7 @@ public: void AppendFill(uint8_t byte, FX_STRSIZE count); - void AppendString(FX_BSTR str) + void AppendString(const CFX_ByteStringC& str) { AppendBlock(str.GetPtr(), str.GetLength()); } @@ -95,7 +95,7 @@ class CFX_ByteTextBuf : public CFX_BinaryBuf { public: - void operator = (FX_BSTR str); + void operator = (const CFX_ByteStringC& str); void AppendChar(int ch) { @@ -108,7 +108,7 @@ public: CFX_ByteTextBuf& operator << (double f); - CFX_ByteTextBuf& operator << (FX_BSTR lpsz); + CFX_ByteTextBuf& operator << (const CFX_ByteStringC& lpsz); CFX_ByteTextBuf& operator << (const CFX_ByteTextBuf& buf); @@ -123,7 +123,7 @@ public: void operator = (const FX_WCHAR* lpsz); - void operator = (FX_WSTR str); + void operator = (const CFX_WideStringC& str); void AppendChar(FX_WCHAR wch); @@ -133,7 +133,7 @@ public: CFX_WideTextBuf& operator << (const FX_WCHAR* lpsz); - CFX_WideTextBuf& operator << (FX_WSTR str); + CFX_WideTextBuf& operator << (const CFX_WideStringC& str); CFX_WideTextBuf& operator << (const CFX_WideString &str); CFX_WideTextBuf& operator << (const CFX_WideTextBuf& buf); @@ -170,7 +170,7 @@ public: CFX_ArchiveSaver& operator << (double i); - CFX_ArchiveSaver& operator << (FX_BSTR bstr); + CFX_ArchiveSaver& operator << (const CFX_ByteStringC& bstr); CFX_ArchiveSaver& operator << (const FX_WCHAR* bstr); @@ -248,7 +248,7 @@ public: int32_t AppendDWord(FX_DWORD i); - int32_t AppendString(FX_BSTR lpsz); + int32_t AppendString(const CFX_ByteStringC& lpsz); protected: @@ -332,7 +332,7 @@ public: void Input(FX_WCHAR unicode); - void AppendStr(FX_BSTR str) + void AppendStr(const CFX_ByteStringC& str) { m_UTF16First = 0; m_Buffer << str; @@ -934,16 +934,16 @@ public: return m_nCount == 0; } - FX_BOOL Lookup(FX_BSTR key, void*& rValue) const; + FX_BOOL Lookup(const CFX_ByteStringC& key, void*& rValue) const; - void*& operator[](FX_BSTR key); + void*& operator[](const CFX_ByteStringC& key); - void SetAt(FX_BSTR key, void* newValue) + void SetAt(const CFX_ByteStringC& key, void* newValue) { (*this)[key] = newValue; } - FX_BOOL RemoveKey(FX_BSTR key); + FX_BOOL RemoveKey(const CFX_ByteStringC& key); void RemoveAll(); @@ -963,7 +963,7 @@ public: void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow = TRUE); - FX_DWORD HashKey(FX_BSTR key) const; + FX_DWORD HashKey(const CFX_ByteStringC& key) const; protected: CAssoc** m_pHashTable; @@ -982,7 +982,7 @@ protected: void FreeAssoc(CAssoc* pAssoc); - CAssoc* GetAssocAt(FX_BSTR key, FX_DWORD& hash) const; + CAssoc* GetAssocAt(const CFX_ByteStringC& key, FX_DWORD& hash) const; public: ~CFX_MapByteStringToPtr(); @@ -1002,15 +1002,15 @@ public: void* GetNextValue(FX_POSITION& rNextPosition) const; - FX_BOOL Lookup(FX_BSTR key, void*& rValue) const; + FX_BOOL Lookup(const CFX_ByteStringC& key, void*& rValue) const; - void SetAt(FX_BSTR key, void* value); + void SetAt(const CFX_ByteStringC& key, void* value); - void RemoveKey(FX_BSTR key); + void RemoveKey(const CFX_ByteStringC& key); int GetCount() const; - void AddValue(FX_BSTR key, void* pValue); + void AddValue(const CFX_ByteStringC& key, void* pValue); private: CFX_BaseSegmentedArray m_Buffer; diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h index 44f911d150..4099befcfc 100644 --- a/core/include/fxcrt/fx_stream.h +++ b/core/include/fxcrt/fx_stream.h @@ -44,8 +44,8 @@ typedef struct FX_HFILE_ { #define FX_FILEMODE_Write 0 #define FX_FILEMODE_ReadOnly 1 #define FX_FILEMODE_Truncate 2 -FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode); -FX_HFILE FX_File_Open(FX_WSTR fileName, FX_DWORD dwMode); +FX_HFILE FX_File_Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode); +FX_HFILE FX_File_Open(const CFX_WideStringC& fileName, FX_DWORD dwMode); void FX_File_Close(FX_HFILE hFile); FX_FILESIZE FX_File_GetSize(FX_HFILE hFile); FX_FILESIZE FX_File_GetPosition(FX_HFILE hFile); @@ -56,14 +56,14 @@ size_t FX_File_Write(FX_HFILE hFile, const void* pBuffer, size_t szBuffer); size_t FX_File_WritePos(FX_HFILE hFile, const void* pBuffer, size_t szBuffer, FX_FILESIZE pos); FX_BOOL FX_File_Flush(FX_HFILE hFile); FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile); -FX_BOOL FX_File_Exist(FX_BSTR fileName); -FX_BOOL FX_File_Exist(FX_WSTR fileName); -FX_BOOL FX_File_Delete(FX_BSTR fileName); -FX_BOOL FX_File_Delete(FX_WSTR fileName); -FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst); -FX_BOOL FX_File_Copy(FX_WSTR fileNameSrc, FX_WSTR fileNameDst); -FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst); -FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst); +FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName); +FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName); +FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName); +FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName); +FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst); +FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst); +FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst); +FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst); class IFX_StreamWrite { public: diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index 5923ffdf2d..4ce8b81937 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -167,7 +167,6 @@ inline bool operator== (const char* lhs, const CFX_ByteStringC& rhs) { inline bool operator!= (const char* lhs, const CFX_ByteStringC& rhs) { return rhs != lhs; } -typedef const CFX_ByteStringC& FX_BSTR; #define FX_BSTRC(str) CFX_ByteStringC(str, sizeof str-1) #define FXBSTR_ID(c1, c2, c3, c4) ((c1 << 24) | (c2 << 16) | (c3 << 8) | (c4)) @@ -196,8 +195,8 @@ public: 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(const CFX_ByteStringC& bstrc); + CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2); ~CFX_ByteString(); @@ -232,14 +231,14 @@ public: return !GetLength(); } - int Compare(FX_BSTR str) const; + int Compare(const CFX_ByteStringC& str) const; bool Equal(const char* ptr) const; bool Equal(const CFX_ByteStringC& str) const; bool Equal(const CFX_ByteString& other) const; - bool EqualNoCase(FX_BSTR str) const; + bool EqualNoCase(const CFX_ByteStringC& str) const; bool operator== (const char* ptr) const { return Equal(ptr); } bool operator== (const CFX_ByteStringC& str) const { return Equal(str); } @@ -263,7 +262,7 @@ public: const CFX_ByteString& operator = (const FX_CHAR* str); - const CFX_ByteString& operator = (FX_BSTR bstrc); + const CFX_ByteString& operator = (const CFX_ByteStringC& bstrc); const CFX_ByteString& operator = (const CFX_ByteString& stringSrc); @@ -277,7 +276,7 @@ public: const CFX_ByteString& operator += (const CFX_ByteString& str); - const CFX_ByteString& operator += (FX_BSTR bstrc); + const CFX_ByteString& operator += (const CFX_ByteStringC& bstrc); uint8_t GetAt(FX_STRSIZE nIndex) const { @@ -315,7 +314,7 @@ public: CFX_ByteString Right(FX_STRSIZE count) const; - FX_STRSIZE Find(FX_BSTR lpszSub, FX_STRSIZE start = 0) const; + FX_STRSIZE Find(const CFX_ByteStringC& lpszSub, FX_STRSIZE start = 0) const; FX_STRSIZE Find(FX_CHAR ch, FX_STRSIZE start = 0) const; @@ -329,15 +328,15 @@ public: void TrimRight(FX_CHAR chTarget); - void TrimRight(FX_BSTR lpszTargets); + void TrimRight(const CFX_ByteStringC& lpszTargets); void TrimLeft(); void TrimLeft(FX_CHAR chTarget); - void TrimLeft(FX_BSTR lpszTargets); + void TrimLeft(const CFX_ByteStringC& lpszTargets); - FX_STRSIZE Replace(FX_BSTR lpszOld, FX_BSTR lpszNew); + FX_STRSIZE Replace(const CFX_ByteStringC& lpszOld, const CFX_ByteStringC& lpszNew); FX_STRSIZE Remove(FX_CHAR ch); @@ -418,23 +417,23 @@ inline bool operator!= (const CFX_ByteStringC& lhs, const CFX_ByteString& rhs) { return rhs != lhs; } -inline CFX_ByteString operator + (FX_BSTR str1, FX_BSTR str2) +inline CFX_ByteString operator + (const CFX_ByteStringC& str1, const CFX_ByteStringC& str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (FX_BSTR str1, const FX_CHAR* str2) +inline CFX_ByteString operator + (const CFX_ByteStringC& str1, const FX_CHAR* str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (const FX_CHAR* str1, FX_BSTR str2) +inline CFX_ByteString operator + (const FX_CHAR* str1, const CFX_ByteStringC& str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (FX_BSTR str1, FX_CHAR ch) +inline CFX_ByteString operator + (const CFX_ByteStringC& str1, FX_CHAR ch) { return CFX_ByteString(str1, CFX_ByteStringC(ch)); } -inline CFX_ByteString operator + (FX_CHAR ch, FX_BSTR str2) +inline CFX_ByteString operator + (FX_CHAR ch, const CFX_ByteStringC& str2) { return CFX_ByteString(ch, str2); } @@ -458,11 +457,11 @@ inline CFX_ByteString operator + (const FX_CHAR* str1, const CFX_ByteString& str { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (const CFX_ByteString& str1, FX_BSTR str2) +inline CFX_ByteString operator + (const CFX_ByteString& str1, const CFX_ByteStringC& str2) { return CFX_ByteString(str1, str2); } -inline CFX_ByteString operator + (FX_BSTR str1, const CFX_ByteString& str2) +inline CFX_ByteString operator + (const CFX_ByteStringC& str1, const CFX_ByteString& str2) { return CFX_ByteString(str1, str2); } @@ -615,7 +614,6 @@ inline bool operator== (const wchar_t* lhs, const CFX_WideStringC& rhs) { inline bool operator!= (const wchar_t* lhs, const CFX_WideStringC& rhs) { return rhs != lhs; } -typedef const CFX_WideStringC& FX_WSTR; #define FX_WSTRC(wstr) CFX_WideStringC(wstr, FX_ArraySize(wstr) - 1) // A mutable string with shared buffers using copy-on-write semantics that @@ -896,11 +894,11 @@ inline bool operator!= (const wchar_t* lhs, const CFX_WideString& rhs) { inline bool operator!= (const CFX_WideStringC& lhs, const CFX_WideString& rhs) { return rhs != lhs; } -FX_FLOAT FX_atof(FX_BSTR str); -void FX_atonum(FX_BSTR str, FX_BOOL& bInteger, void* pData); +FX_FLOAT FX_atof(const CFX_ByteStringC& str); +void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); 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) +inline CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr) { return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); } diff --git a/core/include/fxcrt/fx_xml.h b/core/include/fxcrt/fx_xml.h index b2fb24c6df..fb24f61b13 100644 --- a/core/include/fxcrt/fx_xml.h +++ b/core/include/fxcrt/fx_xml.h @@ -27,9 +27,9 @@ public: { RemoveAll(); } - const CFX_WideString* Lookup(FX_BSTR space, FX_BSTR name) const; - void SetAt(FX_BSTR space, FX_BSTR name, FX_WSTR value); - void RemoveAt(FX_BSTR space, FX_BSTR name); + const CFX_WideString* Lookup(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const; + void SetAt(const CFX_ByteStringC& space, const CFX_ByteStringC& name, const CFX_WideStringC& value); + void RemoveAt(const CFX_ByteStringC& space, const CFX_ByteStringC& name); void RemoveAll(); int GetSize() const; CXML_AttrItem& GetAt(int index) const; @@ -39,7 +39,7 @@ class CXML_Content { public: CXML_Content() : m_bCDATA(FALSE), m_Content() {} - void Set(FX_BOOL bCDATA, FX_WSTR content) + void Set(FX_BOOL bCDATA, const CFX_WideStringC& content) { m_bCDATA = bCDATA; m_Content = content; @@ -53,8 +53,8 @@ public: static CXML_Element* Parse(const void* pBuffer, size_t size, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); static CXML_Element* Parse(IFX_FileRead *pFile, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); static CXML_Element* Parse(IFX_BufferRead *pBuffer, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); - CXML_Element(FX_BSTR qSpace, FX_BSTR tagName); - CXML_Element(FX_BSTR qTagName); + CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName); + CXML_Element(const CFX_ByteStringC& qTagName); CXML_Element(); ~CXML_Element(); @@ -67,7 +67,7 @@ public: CFX_ByteString GetNamespace(FX_BOOL bQualified = FALSE) const; - CFX_ByteString GetNamespaceURI(FX_BSTR qName) const; + CFX_ByteString GetNamespaceURI(const CFX_ByteStringC& qName) const; CXML_Element* GetParent() const { @@ -81,50 +81,50 @@ public: void GetAttrByIndex(int index, CFX_ByteString &space, CFX_ByteString &name, CFX_WideString &value) const; - FX_BOOL HasAttr(FX_BSTR qName) const; + FX_BOOL HasAttr(const CFX_ByteStringC& qName) const; - FX_BOOL GetAttrValue(FX_BSTR name, CFX_WideString& attribute) const; - CFX_WideString GetAttrValue(FX_BSTR name) const + FX_BOOL GetAttrValue(const CFX_ByteStringC& name, CFX_WideString& attribute) const; + CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const { CFX_WideString attr; GetAttrValue(name, attr); return attr; } - FX_BOOL GetAttrValue(FX_BSTR space, FX_BSTR name, CFX_WideString& attribute) const; - CFX_WideString GetAttrValue(FX_BSTR space, FX_BSTR name) const + FX_BOOL GetAttrValue(const CFX_ByteStringC& space, const CFX_ByteStringC& name, CFX_WideString& attribute) const; + CFX_WideString GetAttrValue(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const { CFX_WideString attr; GetAttrValue(space, name, attr); return attr; } - FX_BOOL GetAttrInteger(FX_BSTR name, int& attribute) const; - int GetAttrInteger(FX_BSTR name) const + FX_BOOL GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const; + int GetAttrInteger(const CFX_ByteStringC& name) const { int attr = 0; GetAttrInteger(name, attr); return attr; } - FX_BOOL GetAttrInteger(FX_BSTR space, FX_BSTR name, int& attribute) const; - int GetAttrInteger(FX_BSTR space, FX_BSTR name) const + FX_BOOL GetAttrInteger(const CFX_ByteStringC& space, const CFX_ByteStringC& name, int& attribute) const; + int GetAttrInteger(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const { int attr = 0; GetAttrInteger(space, name, attr); return attr; } - FX_BOOL GetAttrFloat(FX_BSTR name, FX_FLOAT& attribute) const; - FX_FLOAT GetAttrFloat(FX_BSTR name) const + FX_BOOL GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const; + FX_FLOAT GetAttrFloat(const CFX_ByteStringC& name) const { FX_FLOAT attr = 0; GetAttrFloat(name, attr); return attr; } - FX_BOOL GetAttrFloat(FX_BSTR space, FX_BSTR name, FX_FLOAT& attribute) const; - FX_FLOAT GetAttrFloat(FX_BSTR space, FX_BSTR name) const + FX_BOOL GetAttrFloat(const CFX_ByteStringC& space, const CFX_ByteStringC& name, FX_FLOAT& attribute) const; + FX_FLOAT GetAttrFloat(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const { FX_FLOAT attr = 0; GetAttrFloat(space, name, attr); @@ -141,23 +141,23 @@ public: CXML_Element* GetElement(FX_DWORD index) const; - CXML_Element* GetElement(FX_BSTR space, FX_BSTR tag) const + CXML_Element* GetElement(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const { return GetElement(space, tag, 0); } - FX_DWORD CountElements(FX_BSTR space, FX_BSTR tag) const; + FX_DWORD CountElements(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const; - CXML_Element* GetElement(FX_BSTR space, FX_BSTR tag, int index) const; + CXML_Element* GetElement(const CFX_ByteStringC& space, const CFX_ByteStringC& tag, int index) const; FX_DWORD FindElement(CXML_Element *pChild) const; - void SetTag(FX_BSTR qSpace, FX_BSTR tagname); + void SetTag(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagname); - void SetTag(FX_BSTR qTagName); + void SetTag(const CFX_ByteStringC& qTagName); void RemoveChildren(); |