diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-06-10 17:38:11 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-06-10 17:38:11 -0700 |
commit | ca3ac5e9ffc936066267fbb1c329e5297d8e23e6 (patch) | |
tree | 986e666023ae0eec649051613d83c6c60ef3dac0 /core/src/fxcrt | |
parent | 0aa0e7331b3512066df3e33d6642456a0de63de7 (diff) | |
download | pdfium-ca3ac5e9ffc936066267fbb1c329e5297d8e23e6.tar.xz |
Merge to XFA: Remove FX_BSTR and FX_WSTR typedefs.
Nearly automatic merge + re-run script on new files.
Original Review URL: https://codereview.chromium.org/1180593004.
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1174303002.
Diffstat (limited to 'core/src/fxcrt')
-rw-r--r-- | core/src/fxcrt/extension.h | 6 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_bstring.cpp | 20 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_buffer.cpp | 10 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_maps.cpp | 18 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_util.cpp | 4 | ||||
-rw-r--r-- | core/src/fxcrt/fx_extension.cpp | 6 | ||||
-rw-r--r-- | core/src/fxcrt/fx_xml_composer.cpp | 6 | ||||
-rw-r--r-- | core/src/fxcrt/fx_xml_parser.cpp | 34 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_platforms.cpp | 20 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_platforms.h | 4 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_posix.cpp | 20 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_posix.h | 4 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_windows.cpp | 20 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_windows.h | 4 | ||||
-rw-r--r-- | core/src/fxcrt/xml_int.h | 6 |
15 files changed, 91 insertions, 91 deletions
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index c526a2ea6e..869cf30aad 100644 --- a/core/src/fxcrt/extension.h +++ b/core/src/fxcrt/extension.h @@ -13,8 +13,8 @@ class IFXCRT_FileAccess { public: virtual ~IFXCRT_FileAccess() {} - virtual FX_BOOL Open(FX_BSTR fileName, FX_DWORD dwMode) = 0; - virtual FX_BOOL Open(FX_WSTR fileName, FX_DWORD dwMode) = 0; + virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) = 0; + virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) = 0; virtual void Close() = 0; virtual void Release() = 0; virtual FX_FILESIZE GetSize() const = 0; @@ -45,7 +45,7 @@ public: return (IFX_FileAccess*)this; } - virtual FX_BOOL Init(FX_WSTR wsPath) + virtual FX_BOOL Init(const CFX_WideStringC& wsPath) { m_path = wsPath; m_RefCount = 1; diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp index 2baeb83b5d..c6fa998077 100644 --- a/core/src/fxcrt/fx_basic_bstring.cpp +++ b/core/src/fxcrt/fx_basic_bstring.cpp @@ -127,7 +127,7 @@ CFX_ByteString::CFX_ByteString(const CFX_ByteString& stringSrc) *this = stringSrc; } } -CFX_ByteString::CFX_ByteString(FX_BSTR stringSrc) +CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& stringSrc) { if (stringSrc.IsEmpty()) { m_pData = NULL; @@ -137,7 +137,7 @@ CFX_ByteString::CFX_ByteString(FX_BSTR stringSrc) *this = stringSrc; } } -CFX_ByteString::CFX_ByteString(FX_BSTR str1, FX_BSTR str2) +CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& str1, const CFX_ByteStringC& str2) { m_pData = NULL; int nNewLen = str1.GetLength() + str2.GetLength(); @@ -159,7 +159,7 @@ const CFX_ByteString& CFX_ByteString::operator=(const FX_CHAR* lpsz) } return *this; } -const CFX_ByteString& CFX_ByteString::operator=(FX_BSTR str) +const CFX_ByteString& CFX_ByteString::operator=(const CFX_ByteStringC& str) { if (str.IsEmpty()) { Empty(); @@ -224,7 +224,7 @@ const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteString& string) ConcatInPlace(string.m_pData->m_nDataLength, string.m_pData->m_String); return *this; } -const CFX_ByteString& CFX_ByteString::operator+=(FX_BSTR string) +const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteStringC& string) { if (string.IsEmpty()) { return *this; @@ -271,7 +271,7 @@ void CFX_ByteString::Empty() m_pData = NULL; } } -bool CFX_ByteString::EqualNoCase(FX_BSTR str) const +bool CFX_ByteString::EqualNoCase(const CFX_ByteStringC& str) const { if (m_pData == NULL) { return str.IsEmpty(); @@ -815,7 +815,7 @@ const FX_CHAR* FX_strstr(const FX_CHAR* str1, int len1, const FX_CHAR* str2, int } return NULL; } -FX_STRSIZE CFX_ByteString::Find(FX_BSTR lpszSub, FX_STRSIZE nStart) const +FX_STRSIZE CFX_ByteString::Find(const CFX_ByteStringC& lpszSub, FX_STRSIZE nStart) const { if (m_pData == NULL) { return -1; @@ -874,7 +874,7 @@ FX_STRSIZE CFX_ByteString::Remove(FX_CHAR chRemove) m_pData->m_nDataLength -= nCount; return nCount; } -FX_STRSIZE CFX_ByteString::Replace(FX_BSTR lpszOld, FX_BSTR lpszNew) +FX_STRSIZE CFX_ByteString::Replace(const CFX_ByteStringC& lpszOld, const CFX_ByteStringC& lpszNew) { if (m_pData == NULL) { return 0; @@ -960,7 +960,7 @@ void CFX_ByteString::ConvertFrom(const CFX_WideString& str, CFX_CharMap* pCharMa } *this = (*pCharMap->m_GetByteString)(pCharMap, str); } -int CFX_ByteString::Compare(FX_BSTR str) const +int CFX_ByteString::Compare(const CFX_ByteStringC& str) const { if (m_pData == NULL) { return str.IsEmpty() ? 0 : -1; @@ -982,7 +982,7 @@ int CFX_ByteString::Compare(FX_BSTR str) const } return 0; } -void CFX_ByteString::TrimRight(FX_BSTR lpszTargets) +void CFX_ByteString::TrimRight(const CFX_ByteStringC& lpszTargets) { if (m_pData == NULL || lpszTargets.IsEmpty()) { return; @@ -1015,7 +1015,7 @@ void CFX_ByteString::TrimRight() { TrimRight(FX_BSTRC("\x09\x0a\x0b\x0c\x0d\x20")); } -void CFX_ByteString::TrimLeft(FX_BSTR lpszTargets) +void CFX_ByteString::TrimLeft(const CFX_ByteStringC& lpszTargets) { if (m_pData == NULL) { return; diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index f56c4299cc..43da8e9ebf 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -139,7 +139,7 @@ CFX_ByteStringC CFX_BinaryBuf::GetByteString() const { return CFX_ByteStringC(m_pBuffer, m_DataSize); } -CFX_ByteTextBuf& CFX_ByteTextBuf::operator << (FX_BSTR lpsz) +CFX_ByteTextBuf& CFX_ByteTextBuf::operator << (const CFX_ByteStringC& lpsz) { AppendBlock(lpsz.GetPtr(), lpsz.GetLength()); return *this; @@ -183,7 +183,7 @@ void CFX_WideTextBuf::AppendChar(FX_WCHAR ch) *(FX_WCHAR*)(m_pBuffer + m_DataSize) = ch; m_DataSize += sizeof(FX_WCHAR); } -CFX_WideTextBuf& CFX_WideTextBuf::operator << (FX_WSTR str) +CFX_WideTextBuf& CFX_WideTextBuf::operator << (const CFX_WideStringC& str) { AppendBlock(str.GetPtr(), str.GetLength() * sizeof(FX_WCHAR)); return *this; @@ -234,7 +234,7 @@ CFX_WideTextBuf& CFX_WideTextBuf::operator << (const CFX_WideTextBuf& buf) AppendBlock(buf.m_pBuffer, buf.m_DataSize); return *this; } -void CFX_WideTextBuf::operator =(FX_WSTR str) +void CFX_WideTextBuf::operator =(const CFX_WideStringC& str) { CopyData(str.GetPtr(), str.GetLength() * sizeof(FX_WCHAR)); } @@ -278,7 +278,7 @@ CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_FLOAT f) } return *this; } -CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_BSTR bstr) +CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (const CFX_ByteStringC& bstr) { int len = bstr.GetLength(); if (m_pStream) { @@ -481,7 +481,7 @@ int32_t IFX_BufferArchive::AppendDWord(FX_DWORD i) FXSYS_itoa(i, buf, 10); return AppendBlock(buf, (size_t)FXSYS_strlen(buf)); } -int32_t IFX_BufferArchive::AppendString(FX_BSTR lpsz) +int32_t IFX_BufferArchive::AppendString(const CFX_ByteStringC& lpsz) { return AppendBlock(lpsz.GetPtr(), lpsz.GetLength()); } diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp index 7df4cdb8ed..afc7c8219e 100644 --- a/core/src/fxcrt/fx_basic_maps.cpp +++ b/core/src/fxcrt/fx_basic_maps.cpp @@ -261,7 +261,7 @@ void* CFX_MapByteStringToPtr::GetNextValue(FX_POSITION& rNextPosition) const rNextPosition = (FX_POSITION) pAssocNext; return pAssocRet->value; } -void*& CFX_MapByteStringToPtr::operator[](FX_BSTR key) +void*& CFX_MapByteStringToPtr::operator[](const CFX_ByteStringC& key) { FX_DWORD nHash; CAssoc* pAssoc; @@ -310,7 +310,7 @@ void CFX_MapByteStringToPtr::FreeAssoc(CFX_MapByteStringToPtr::CAssoc* pAssoc) } } CFX_MapByteStringToPtr::CAssoc* -CFX_MapByteStringToPtr::GetAssocAt(FX_BSTR key, FX_DWORD& nHash) const +CFX_MapByteStringToPtr::GetAssocAt(const CFX_ByteStringC& key, FX_DWORD& nHash) const { nHash = HashKey(key) % m_nHashTableSize; if (m_pHashTable == NULL) { @@ -324,7 +324,7 @@ CFX_MapByteStringToPtr::GetAssocAt(FX_BSTR key, FX_DWORD& nHash) const } return NULL; } -FX_BOOL CFX_MapByteStringToPtr::Lookup(FX_BSTR key, void*& rValue) const +FX_BOOL CFX_MapByteStringToPtr::Lookup(const CFX_ByteStringC& key, void*& rValue) const { FX_DWORD nHash; CAssoc* pAssoc = GetAssocAt(key, nHash); @@ -348,7 +348,7 @@ void CFX_MapByteStringToPtr::InitHashTable( } m_nHashTableSize = nHashSize; } -inline FX_DWORD CFX_MapByteStringToPtr::HashKey(FX_BSTR key) const +inline FX_DWORD CFX_MapByteStringToPtr::HashKey(const CFX_ByteStringC& key) const { FX_DWORD nHash = 0; int len = key.GetLength(); @@ -358,7 +358,7 @@ inline FX_DWORD CFX_MapByteStringToPtr::HashKey(FX_BSTR key) const } return nHash; } -FX_BOOL CFX_MapByteStringToPtr::RemoveKey(FX_BSTR key) +FX_BOOL CFX_MapByteStringToPtr::RemoveKey(const CFX_ByteStringC& key) { if (m_pHashTable == NULL) { return FALSE; @@ -500,7 +500,7 @@ FX_BOOL _CMapLookupCallback(void* param, void* pData) { return !_CompactStringSame((_CompactString*)pData, ((CFX_ByteStringC*)param)->GetPtr(), ((CFX_ByteStringC*)param)->GetLength()); } -FX_BOOL CFX_CMapByteStringToPtr::Lookup(FX_BSTR key, void*& rValue) const +FX_BOOL CFX_CMapByteStringToPtr::Lookup(const CFX_ByteStringC& key, void*& rValue) const { void* p = m_Buffer.Iterate(_CMapLookupCallback, (void*)&key); if (!p) { @@ -509,7 +509,7 @@ FX_BOOL CFX_CMapByteStringToPtr::Lookup(FX_BSTR key, void*& rValue) const rValue = *(void**)((_CompactString*)p + 1); return TRUE; } -void CFX_CMapByteStringToPtr::SetAt(FX_BSTR key, void* value) +void CFX_CMapByteStringToPtr::SetAt(const CFX_ByteStringC& key, void* value) { ASSERT(value != NULL); int index, key_len = key.GetLength(); @@ -535,14 +535,14 @@ void CFX_CMapByteStringToPtr::SetAt(FX_BSTR key, void* value) _CompactStringStore(pKey, key.GetPtr(), key_len); *(void**)(pKey + 1) = value; } -void CFX_CMapByteStringToPtr::AddValue(FX_BSTR key, void* value) +void CFX_CMapByteStringToPtr::AddValue(const CFX_ByteStringC& key, void* value) { ASSERT(value != NULL); _CompactString* pKey = (_CompactString*)m_Buffer.Add(); _CompactStringStore(pKey, key.GetPtr(), key.GetLength()); *(void**)(pKey + 1) = value; } -void CFX_CMapByteStringToPtr::RemoveKey(FX_BSTR key) +void CFX_CMapByteStringToPtr::RemoveKey(const CFX_ByteStringC& key) { int key_len = key.GetLength(); int size = m_Buffer.GetSize(); diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp index 5870baa020..c9230872f7 100644 --- a/core/src/fxcrt/fx_basic_util.cpp +++ b/core/src/fxcrt/fx_basic_util.cpp @@ -90,7 +90,7 @@ void CFX_PrivateData::ClearAll() } m_DataList.RemoveAll(); } -void FX_atonum(FX_BSTR strc, FX_BOOL& bInteger, void* pData) +void FX_atonum(const CFX_ByteStringC& strc, FX_BOOL& bInteger, void* pData) { if (FXSYS_memchr(strc.GetPtr(), '.', strc.GetLength()) == NULL) { bInteger = TRUE; @@ -123,7 +123,7 @@ void FX_atonum(FX_BSTR strc, FX_BOOL& bInteger, void* pData) *(FX_FLOAT*)pData = FX_atof(strc); } } -FX_FLOAT FX_atof(FX_BSTR strc) +FX_FLOAT FX_atof(const CFX_ByteStringC& strc) { if (strc.GetLength() == 0) { return 0.0; diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp index 21aeffddc6..16974459fc 100644 --- a/core/src/fxcrt/fx_extension.cpp +++ b/core/src/fxcrt/fx_extension.cpp @@ -11,7 +11,7 @@ #else #include <ctime> #endif -FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode) +FX_HFILE FX_File_Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) { IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(); if (pFA && !pFA->Open(fileName, dwMode)) { @@ -20,7 +20,7 @@ FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode) } return (FX_HFILE)pFA; } -FX_HFILE FX_File_Open(FX_WSTR fileName, FX_DWORD dwMode) +FX_HFILE FX_File_Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) { IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(); if (pFA && !pFA->Open(fileName, dwMode)) { @@ -80,7 +80,7 @@ FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile) FXSYS_assert(hFile != NULL); return ((IFXCRT_FileAccess*)hFile)->Truncate(szFile); } -IFX_FileAccess* FX_CreateDefaultFileAccess(FX_WSTR wsPath) +IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) { if (wsPath.GetLength() == 0) return NULL; diff --git a/core/src/fxcrt/fx_xml_composer.cpp b/core/src/fxcrt/fx_xml_composer.cpp index 7858290f9a..97971aa841 100644 --- a/core/src/fxcrt/fx_xml_composer.cpp +++ b/core/src/fxcrt/fx_xml_composer.cpp @@ -6,7 +6,7 @@ #include "../../include/fxcrt/fx_xml.h" #include "xml_int.h" -void FX_XML_SplitQualifiedName(FX_BSTR bsFullName, CFX_ByteStringC &bsSpace, CFX_ByteStringC &bsName) +void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, CFX_ByteStringC &bsSpace, CFX_ByteStringC &bsName) { if (bsFullName.IsEmpty()) { return; @@ -25,12 +25,12 @@ void FX_XML_SplitQualifiedName(FX_BSTR bsFullName, CFX_ByteStringC &bsSpace, CFX bsName = CFX_ByteStringC(bsFullName.GetCStr() + iStart, bsFullName.GetLength() - iStart); } } -void CXML_Element::SetTag(FX_BSTR qSpace, FX_BSTR tagname) +void CXML_Element::SetTag(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagname) { m_QSpaceName = qSpace; m_TagName = tagname; } -void CXML_Element::SetTag(FX_BSTR qTagName) +void CXML_Element::SetTag(const CFX_ByteStringC& qTagName) { ASSERT(!qTagName.IsEmpty()); CFX_ByteStringC bsSpace, bsName; diff --git a/core/src/fxcrt/fx_xml_parser.cpp b/core/src/fxcrt/fx_xml_parser.cpp index 1eec20c371..f41db0e5cb 100644 --- a/core/src/fxcrt/fx_xml_parser.cpp +++ b/core/src/fxcrt/fx_xml_parser.cpp @@ -156,7 +156,7 @@ void CXML_Parser::GetName(CFX_ByteString &space, CFX_ByteString &name) } while (ReadNextBlock()); name = buf.GetByteString(); } -void CXML_Parser::SkipLiterals(FX_BSTR str) +void CXML_Parser::SkipLiterals(const CFX_ByteStringC& str) { m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; if (IsEOF()) { @@ -524,7 +524,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, FX_BOOL bStartTag bCDATA = FALSE; return pElement; } -void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA, FX_WSTR content, CXML_Element* pElement) +void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA, const CFX_WideStringC& content, CXML_Element* pElement) { if (content.IsEmpty()) { return; @@ -577,7 +577,7 @@ CXML_Element::CXML_Element() , m_AttrMap() { } -CXML_Element::CXML_Element(FX_BSTR qSpace, FX_BSTR tagName) +CXML_Element::CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName) : m_QSpaceName() , m_TagName() , m_AttrMap() @@ -585,7 +585,7 @@ CXML_Element::CXML_Element(FX_BSTR qSpace, FX_BSTR tagName) m_QSpaceName = qSpace; m_TagName = tagName; } -CXML_Element::CXML_Element(FX_BSTR qTagName) +CXML_Element::CXML_Element(const CFX_ByteStringC& qTagName) : m_pParent(NULL) , m_QSpaceName() , m_TagName() @@ -633,7 +633,7 @@ CFX_ByteString CXML_Element::GetNamespace(FX_BOOL bQualified) const } return GetNamespaceURI(m_QSpaceName); } -CFX_ByteString CXML_Element::GetNamespaceURI(FX_BSTR qName) const +CFX_ByteString CXML_Element::GetNamespaceURI(const CFX_ByteStringC& qName) const { const CFX_WideString* pwsSpace; const CXML_Element *pElement = this; @@ -660,19 +660,19 @@ void CXML_Element::GetAttrByIndex(int index, CFX_ByteString& space, CFX_ByteStri name = item.m_AttrName; value = item.m_Value; } -FX_BOOL CXML_Element::HasAttr(FX_BSTR name) const +FX_BOOL CXML_Element::HasAttr(const CFX_ByteStringC& name) const { CFX_ByteStringC bsSpace, bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); return m_AttrMap.Lookup(bsSpace, bsName) != NULL; } -FX_BOOL CXML_Element::GetAttrValue(FX_BSTR name, CFX_WideString& attribute) const +FX_BOOL CXML_Element::GetAttrValue(const CFX_ByteStringC& name, CFX_WideString& attribute) const { CFX_ByteStringC bsSpace, bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); return GetAttrValue(bsSpace, bsName, attribute); } -FX_BOOL CXML_Element::GetAttrValue(FX_BSTR space, FX_BSTR name, CFX_WideString& attribute) const +FX_BOOL CXML_Element::GetAttrValue(const CFX_ByteStringC& space, const CFX_ByteStringC& name, CFX_WideString& attribute) const { const CFX_WideString* pValue = m_AttrMap.Lookup(space, name); if (pValue) { @@ -681,7 +681,7 @@ FX_BOOL CXML_Element::GetAttrValue(FX_BSTR space, FX_BSTR name, CFX_WideString& } return FALSE; } -FX_BOOL CXML_Element::GetAttrInteger(FX_BSTR name, int& attribute) const +FX_BOOL CXML_Element::GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const { CFX_ByteStringC bsSpace, bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); @@ -692,7 +692,7 @@ FX_BOOL CXML_Element::GetAttrInteger(FX_BSTR name, int& attribute) const } return FALSE; } -FX_BOOL CXML_Element::GetAttrInteger(FX_BSTR space, FX_BSTR name, int& attribute) const +FX_BOOL CXML_Element::GetAttrInteger(const CFX_ByteStringC& space, const CFX_ByteStringC& name, int& attribute) const { const CFX_WideString* pwsValue = m_AttrMap.Lookup(space, name); if (pwsValue) { @@ -701,13 +701,13 @@ FX_BOOL CXML_Element::GetAttrInteger(FX_BSTR space, FX_BSTR name, int& attribute } return FALSE; } -FX_BOOL CXML_Element::GetAttrFloat(FX_BSTR name, FX_FLOAT& attribute) const +FX_BOOL CXML_Element::GetAttrFloat(const CFX_ByteStringC& name, FX_FLOAT& attribute) const { CFX_ByteStringC bsSpace, bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); return GetAttrFloat(bsSpace, bsName, attribute); } -FX_BOOL CXML_Element::GetAttrFloat(FX_BSTR space, FX_BSTR name, FX_FLOAT& attribute) const +FX_BOOL CXML_Element::GetAttrFloat(const CFX_ByteStringC& space, const CFX_ByteStringC& name, FX_FLOAT& attribute) const { const CFX_WideString* pValue = m_AttrMap.Lookup(space, name); if (pValue) { @@ -750,7 +750,7 @@ CXML_Element* CXML_Element::GetElement(FX_DWORD index) const } return (CXML_Element*)m_Children.GetAt(index + 1); } -FX_DWORD CXML_Element::CountElements(FX_BSTR space, FX_BSTR tag) const +FX_DWORD CXML_Element::CountElements(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const { int count = 0; for (int i = 0; i < m_Children.GetSize(); i += 2) { @@ -765,7 +765,7 @@ FX_DWORD CXML_Element::CountElements(FX_BSTR space, FX_BSTR tag) const } return count; } -CXML_Element* CXML_Element::GetElement(FX_BSTR space, FX_BSTR tag, int index) const +CXML_Element* CXML_Element::GetElement(const CFX_ByteStringC& space, const CFX_ByteStringC& tag, int index) const { if (index < 0) { return NULL; @@ -795,7 +795,7 @@ FX_DWORD CXML_Element::FindElement(CXML_Element *pChild) const } return (FX_DWORD) - 1; } -const CFX_WideString* CXML_AttrMap::Lookup(FX_BSTR space, FX_BSTR name) const +const CFX_WideString* CXML_AttrMap::Lookup(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const { if (m_pMap == NULL) { return NULL; @@ -808,7 +808,7 @@ const CFX_WideString* CXML_AttrMap::Lookup(FX_BSTR space, FX_BSTR name) const } return NULL; } -void CXML_AttrMap::SetAt(FX_BSTR space, FX_BSTR name, FX_WSTR value) +void CXML_AttrMap::SetAt(const CFX_ByteStringC& space, const CFX_ByteStringC& name, const CFX_WideStringC& value) { for (int i = 0; i < GetSize(); i++) { CXML_AttrItem& item = GetAt(i); @@ -831,7 +831,7 @@ void CXML_AttrMap::SetAt(FX_BSTR space, FX_BSTR name, FX_WSTR value) pItem->m_AttrName = name; pItem->m_Value = value; } -void CXML_AttrMap::RemoveAt(FX_BSTR space, FX_BSTR name) +void CXML_AttrMap::RemoveAt(const CFX_ByteStringC& space, const CFX_ByteStringC& name) { if (m_pMap == NULL) { return; diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp index e5259c2b54..ae0f829255 100644 --- a/core/src/fxcrt/fxcrt_platforms.cpp +++ b/core/src/fxcrt/fxcrt_platforms.cpp @@ -39,7 +39,7 @@ CFXCRT_FileAccess_CRT::~CFXCRT_FileAccess_CRT() { Close(); } -FX_BOOL CFXCRT_FileAccess_CRT::Open(FX_BSTR fileName, FX_DWORD dwMode) +FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) { if (m_hFile) { return FALSE; @@ -49,7 +49,7 @@ FX_BOOL CFXCRT_FileAccess_CRT::Open(FX_BSTR fileName, FX_DWORD dwMode) m_hFile = FXSYS_fopen(fileName.GetCStr(), strMode.c_str()); return m_hFile != NULL; } -FX_BOOL CFXCRT_FileAccess_CRT::Open(FX_WSTR fileName, FX_DWORD dwMode) +FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) { if (m_hFile) { return FALSE; @@ -138,23 +138,23 @@ FX_BOOL CFXCRT_FileAccess_CRT::Truncate(FX_FILESIZE szFile) { return FALSE; } -FX_BOOL FX_File_Exist(FX_BSTR fileName) +FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName) { return access(fileName.GetCStr(), F_OK) > -1; } -FX_BOOL FX_File_Exist(FX_WSTR fileName) +FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName) { return FX_File_Exist(FX_UTF8Encode(fileName)); } -FX_BOOL FX_File_Delete(FX_BSTR fileName) +FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName) { return remove(fileName.GetCStr()) > -1; } -FX_BOOL FX_File_Delete(FX_WSTR fileName) +FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName) { return FX_File_Delete(FX_UTF8Encode(fileName)); } -FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) +FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { CFXCRT_FileAccess_CRT src, dst; if (!src.Open(fileNameSrc, FX_FILEMODE_ReadOnly)) { @@ -177,15 +177,15 @@ FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) FX_Free(pBuffer); return TRUE; } -FX_BOOL FX_File_Copy(FX_WSTR fileNameSrc, FX_WSTR fileNameDst) +FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return FX_File_Copy(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); } -FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) +FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { return rename(fileNameSrc.GetCStr(), fileNameDst.GetCStr()); } -FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst) +FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return FX_File_Move(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); } diff --git a/core/src/fxcrt/fxcrt_platforms.h b/core/src/fxcrt/fxcrt_platforms.h index be51724352..6df020a34c 100644 --- a/core/src/fxcrt/fxcrt_platforms.h +++ b/core/src/fxcrt/fxcrt_platforms.h @@ -17,8 +17,8 @@ class CFXCRT_FileAccess_CRT : public IFXCRT_FileAccess public: CFXCRT_FileAccess_CRT(); virtual ~CFXCRT_FileAccess_CRT(); - virtual FX_BOOL Open(FX_BSTR fileName, FX_DWORD dwMode); - virtual FX_BOOL Open(FX_WSTR fileName, FX_DWORD dwMode); + virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode); + virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode); virtual void Close(); virtual void Release(); virtual FX_FILESIZE GetSize() const; diff --git a/core/src/fxcrt/fxcrt_posix.cpp b/core/src/fxcrt/fxcrt_posix.cpp index dd2aaf27d0..da39f8cd5e 100644 --- a/core/src/fxcrt/fxcrt_posix.cpp +++ b/core/src/fxcrt/fxcrt_posix.cpp @@ -33,7 +33,7 @@ CFXCRT_FileAccess_Posix::~CFXCRT_FileAccess_Posix() { Close(); } -FX_BOOL CFXCRT_FileAccess_Posix::Open(FX_BSTR fileName, FX_DWORD dwMode) +FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) { if (m_nFD > -1) { return FALSE; @@ -43,7 +43,7 @@ FX_BOOL CFXCRT_FileAccess_Posix::Open(FX_BSTR fileName, FX_DWORD dwMode) m_nFD = open(fileName.GetCStr(), nFlags, nMasks); return m_nFD > -1; } -FX_BOOL CFXCRT_FileAccess_Posix::Open(FX_WSTR fileName, FX_DWORD dwMode) +FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) { return Open(FX_UTF8Encode(fileName), dwMode); } @@ -134,23 +134,23 @@ FX_BOOL CFXCRT_FileAccess_Posix::Truncate(FX_FILESIZE szFile) } return !ftruncate(m_nFD, szFile); } -FX_BOOL FX_File_Exist(FX_BSTR fileName) +FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName) { return access(fileName.GetCStr(), F_OK) > -1; } -FX_BOOL FX_File_Exist(FX_WSTR fileName) +FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName) { return FX_File_Exist(FX_UTF8Encode(fileName)); } -FX_BOOL FX_File_Delete(FX_BSTR fileName) +FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName) { return remove(fileName.GetCStr()) > -1; } -FX_BOOL FX_File_Delete(FX_WSTR fileName) +FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName) { return FX_File_Delete(FX_UTF8Encode(fileName)); } -FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) +FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { CFXCRT_FileAccess_Posix src, dst; if (!src.Open(fileNameSrc, FX_FILEMODE_ReadOnly)) { @@ -175,15 +175,15 @@ FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) FX_Free(pBuffer); return TRUE; } -FX_BOOL FX_File_Copy(FX_WSTR fileNameSrc, FX_WSTR fileNameDst) +FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return FX_File_Copy(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); } -FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) +FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { return rename(fileNameSrc.GetCStr(), fileNameDst.GetCStr()); } -FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst) +FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return FX_File_Move(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); } diff --git a/core/src/fxcrt/fxcrt_posix.h b/core/src/fxcrt/fxcrt_posix.h index 0b4509ec73..c798ad848a 100644 --- a/core/src/fxcrt/fxcrt_posix.h +++ b/core/src/fxcrt/fxcrt_posix.h @@ -15,8 +15,8 @@ class CFXCRT_FileAccess_Posix : public IFXCRT_FileAccess public: CFXCRT_FileAccess_Posix(); virtual ~CFXCRT_FileAccess_Posix(); - virtual FX_BOOL Open(FX_BSTR fileName, FX_DWORD dwMode); - virtual FX_BOOL Open(FX_WSTR fileName, FX_DWORD dwMode); + virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode); + virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode); virtual void Close(); virtual void Release(); virtual FX_FILESIZE GetSize() const; diff --git a/core/src/fxcrt/fxcrt_windows.cpp b/core/src/fxcrt/fxcrt_windows.cpp index 6b0f0f290d..ac9c60185d 100644 --- a/core/src/fxcrt/fxcrt_windows.cpp +++ b/core/src/fxcrt/fxcrt_windows.cpp @@ -7,7 +7,7 @@ #include "../../include/fxcrt/fx_ext.h" #include "fxcrt_windows.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_File_Exist(FX_BSTR fileName) +FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName) { FX_DWORD dwAttri = ::GetFileAttributesA(fileName.GetCStr()); if (dwAttri == -1) { @@ -15,7 +15,7 @@ FX_BOOL FX_File_Exist(FX_BSTR fileName) } return (dwAttri & FILE_ATTRIBUTE_DIRECTORY) == 0; } -FX_BOOL FX_File_Exist(FX_WSTR fileName) +FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName) { FX_DWORD dwAttri = ::GetFileAttributesW((LPCWSTR)fileName.GetPtr()); if (dwAttri == -1) { @@ -54,7 +54,7 @@ CFXCRT_FileAccess_Win64::~CFXCRT_FileAccess_Win64() { Close(); } -FX_BOOL CFXCRT_FileAccess_Win64::Open(FX_BSTR fileName, FX_DWORD dwMode) +FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) { if (m_hFile) { return FALSE; @@ -67,7 +67,7 @@ FX_BOOL CFXCRT_FileAccess_Win64::Open(FX_BSTR fileName, FX_DWORD dwMode) } return m_hFile != NULL; } -FX_BOOL CFXCRT_FileAccess_Win64::Open(FX_WSTR fileName, FX_DWORD dwMode) +FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) { if (m_hFile) { return FALSE; @@ -187,27 +187,27 @@ FX_BOOL CFXCRT_FileAccess_Win64::Truncate(FX_FILESIZE szFile) } return ::SetEndOfFile(m_hFile); } -FX_BOOL FX_File_Delete(FX_BSTR fileName) +FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName) { return ::DeleteFileA(fileName.GetCStr()); } -FX_BOOL FX_File_Delete(FX_WSTR fileName) +FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName) { return ::DeleteFileW((LPCWSTR)fileName.GetPtr()); } -FX_BOOL FX_File_Copy(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) +FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { return ::CopyFileA(fileNameSrc.GetCStr(), fileNameDst.GetCStr(), FALSE); } -FX_BOOL FX_File_Copy(FX_WSTR fileNameSrc, FX_WSTR fileNameDst) +FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return ::CopyFileW((LPCWSTR)fileNameSrc.GetPtr(), (LPCWSTR)fileNameDst.GetPtr(), FALSE); } -FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) +FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { return ::MoveFileA(fileNameSrc.GetCStr(), fileNameDst.GetCStr()); } -FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst) +FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return ::MoveFileW((LPCWSTR)fileNameSrc.GetPtr(), (LPCWSTR)fileNameDst.GetPtr()); } diff --git a/core/src/fxcrt/fxcrt_windows.h b/core/src/fxcrt/fxcrt_windows.h index 32531d568f..8dd2cddc82 100644 --- a/core/src/fxcrt/fxcrt_windows.h +++ b/core/src/fxcrt/fxcrt_windows.h @@ -15,8 +15,8 @@ class CFXCRT_FileAccess_Win64 : public IFXCRT_FileAccess public: CFXCRT_FileAccess_Win64(); virtual ~CFXCRT_FileAccess_Win64(); - virtual FX_BOOL Open(FX_BSTR fileName, FX_DWORD dwMode); - virtual FX_BOOL Open(FX_WSTR fileName, FX_DWORD dwMode); + virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode); + virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode); virtual void Close(); virtual void Release(); virtual FX_FILESIZE GetSize() const; diff --git a/core/src/fxcrt/xml_int.h b/core/src/fxcrt/xml_int.h index 0220301d17..9469a758cb 100644 --- a/core/src/fxcrt/xml_int.h +++ b/core/src/fxcrt/xml_int.h @@ -153,11 +153,11 @@ public: void GetAttrValue(CFX_WideString &value); FX_DWORD GetCharRef(); void GetTagName(CFX_ByteString &space, CFX_ByteString &name, FX_BOOL &bEndTag, FX_BOOL bStartTag = FALSE); - void SkipLiterals(FX_BSTR str); + void SkipLiterals(const CFX_ByteStringC& str); CXML_Element* ParseElement(CXML_Element* pParent, FX_BOOL bStartTag = FALSE); - void InsertContentSegment(FX_BOOL bCDATA, FX_WSTR content, CXML_Element* pElement); + void InsertContentSegment(FX_BOOL bCDATA, const CFX_WideStringC& content, CXML_Element* pElement); void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement); }; -void FX_XML_SplitQualifiedName(FX_BSTR bsFullName, CFX_ByteStringC &bsSpace, CFX_ByteStringC &bsName); +void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, CFX_ByteStringC &bsSpace, CFX_ByteStringC &bsName); #endif // CORE_SRC_FXCRT_XML_INT_H_ |