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/src | |
parent | e4503ea9947d2f9c61704da20271b413a364a9c0 (diff) | |
download | pdfium-6f0a64a1bf18ab6636404cdfb883897459083a4d.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/src')
46 files changed, 220 insertions, 219 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index 717386041d..8cfbd1b40e 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -106,11 +106,11 @@ void CPDF_PageContentGenerate::ProcessForm(CFX_ByteTextBuf& buf, const uint8_t* } CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); CPDF_Dictionary* pFormDict = CPDF_Dictionary::Create(); - pFormDict->SetAtName(FX_BSTR("Type"), FX_BSTR("XObject")); - pFormDict->SetAtName(FX_BSTR("Subtype"), FX_BSTR("Form")); + pFormDict->SetAtName("Type", "XObject"); + pFormDict->SetAtName("Subtype", "Form"); CFX_FloatRect bbox = m_pPage->GetPageBBox(); matrix.TransformRect(bbox); - pFormDict->SetAtRect(FX_BSTR("BBox"), bbox); + pFormDict->SetAtRect("BBox", bbox); pStream->InitStream((uint8_t*)data, size, pFormDict); buf << "q " << matrix << " cm "; CFX_ByteString name = RealizeResource(pStream, "XObject"); diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 7176a62435..18913a0020 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -1170,8 +1170,8 @@ void CPDF_Document::DeletePage(int iPage) } m_PageList.RemoveAt(iPage); } -CPDF_Object* FPDFAPI_GetPageAttr(CPDF_Dictionary* pPageDict, FX_BSTR name); -void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, FX_BSTR name) +CPDF_Object* FPDFAPI_GetPageAttr(CPDF_Dictionary* pPageDict, const CFX_ByteStringC& name); +void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, const CFX_ByteStringC& name) { if (pPageDict->KeyExist(name)) { return; diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h index 6f32f4fa98..aa46f16f75 100644 --- a/core/src/fpdfapi/fpdf_font/font_int.h +++ b/core/src/fpdfapi/fpdf_font/font_int.h @@ -57,7 +57,7 @@ public: CPDF_CMapParser(); ~CPDF_CMapParser() {} FX_BOOL Initialize(CPDF_CMap*); - void ParseWord(FX_BSTR str); + void ParseWord(const CFX_ByteStringC& str); CFX_BinaryBuf m_AddMaps; private: CPDF_CMap* m_pCMap; diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index c6922d11f8..48a96dc554 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -391,7 +391,7 @@ int CPDF_Font::GetCharTypeWidth(FX_DWORD charcode) return m_Font.GetGlyphWidth(glyph_index); } int _PDF_GetStandardFontName(CFX_ByteString& name); -CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc, FX_BSTR name) +CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc, const CFX_ByteStringC& name) { CFX_ByteString fontname(name); int font_id = _PDF_GetStandardFontName(fontname); @@ -532,7 +532,7 @@ FX_DWORD CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) } return 0; } -static FX_DWORD _StringToCode(FX_BSTR str) +static FX_DWORD _StringToCode(const CFX_ByteStringC& str) { const FX_CHAR* buf = str.GetCStr(); int len = str.GetLength(); @@ -584,7 +584,7 @@ static CFX_WideString _StringDataAdd(CFX_WideString str) } return ret; } -static CFX_WideString _StringToWideString(FX_BSTR str) +static CFX_WideString _StringToWideString(const CFX_ByteStringC& str) { const FX_CHAR* buf = str.GetCStr(); int len = str.GetLength(); diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index bec2c90144..ed5ef5c5fe 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -119,7 +119,7 @@ FX_BOOL CPDF_CMapParser::Initialize(CPDF_CMap* pCMap) m_AddMaps.EstimateSize(0, 10240); return TRUE; } -static FX_DWORD CMap_GetCode(FX_BSTR word) +static FX_DWORD CMap_GetCode(const CFX_ByteStringC& word) { int num = 0; if (word.GetAt(0) == '<') { @@ -146,7 +146,7 @@ static FX_DWORD CMap_GetCode(FX_BSTR word) } return num; } -static FX_BOOL _CMap_GetCodeRange(_CMap_CodeRange& range, FX_BSTR first, FX_BSTR second) +static FX_BOOL _CMap_GetCodeRange(_CMap_CodeRange& range, const CFX_ByteStringC& first, const CFX_ByteStringC& second) { if (first.GetLength() == 0 || first.GetAt(0) != '<') { return FALSE; @@ -177,11 +177,11 @@ static FX_BOOL _CMap_GetCodeRange(_CMap_CodeRange& range, FX_BSTR first, FX_BSTR } return TRUE; } -static CFX_ByteString CMap_GetString(FX_BSTR word) +static CFX_ByteString CMap_GetString(const CFX_ByteStringC& word) { return word.Mid(1, word.GetLength() - 2); } -void CPDF_CMapParser::ParseWord(FX_BSTR word) +void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) { if (word.IsEmpty()) { return; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index 046cebeb98..688066e3a3 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -902,7 +902,7 @@ CPDF_Page::~CPDF_Page() pModule->DestroyPageCache(m_pPageRender); } } -CPDF_Object* FPDFAPI_GetPageAttr(CPDF_Dictionary* pPageDict, FX_BSTR name) +CPDF_Object* FPDFAPI_GetPageAttr(CPDF_Dictionary* pPageDict, const CFX_ByteStringC& name) { int level = 0; while (1) { @@ -921,7 +921,7 @@ CPDF_Object* FPDFAPI_GetPageAttr(CPDF_Dictionary* pPageDict, FX_BSTR name) } } } -CPDF_Object* CPDF_Page::GetPageAttr(FX_BSTR name) const +CPDF_Object* CPDF_Page::GetPageAttr(const CFX_ByteStringC& name) const { return FPDFAPI_GetPageAttr(m_pFormDict, name); } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp index 6c3d8c6a29..1c0629f45a 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -360,7 +360,7 @@ CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict, FX_BOOL findOnl return pFont; } -CPDF_Font* CPDF_DocPageData::GetStandardFont(FX_BSTR fontName, CPDF_FontEncoding* pEncoding) +CPDF_Font* CPDF_DocPageData::GetStandardFont(const CFX_ByteStringC& fontName, CPDF_FontEncoding* pEncoding) { if (fontName.IsEmpty()) return nullptr; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp index 3ce4baf20c..8752acf536 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -376,7 +376,7 @@ CPDF_GeneralStateData::~CPDF_GeneralStateData() pDocCache->ReleaseTransferFunc(m_pTR); } } -static int GetBlendType(FX_BSTR mode) +static int GetBlendType(const CFX_ByteStringC& mode) { switch (mode.GetID()) { case FXBSTR_ID('N', 'o', 'r', 'm'): @@ -417,7 +417,7 @@ static int GetBlendType(FX_BSTR mode) } return FXDIB_BLEND_NORMAL; } -void CPDF_GeneralStateData::SetBlendMode(FX_BSTR blend_mode) +void CPDF_GeneralStateData::SetBlendMode(const CFX_ByteStringC& blend_mode) { if (blend_mode.GetLength() > 15) { return; @@ -677,7 +677,7 @@ void CPDF_ContentMarkData::DeleteLastMark() } m_Marks.RemoveAt(size - 1); } -FX_BOOL CPDF_ContentMark::HasMark(FX_BSTR mark) const +FX_BOOL CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const { if (m_pObject == NULL) { return FALSE; @@ -690,7 +690,7 @@ FX_BOOL CPDF_ContentMark::HasMark(FX_BSTR mark) const } return FALSE; } -FX_BOOL CPDF_ContentMark::LookupMark(FX_BSTR mark, CPDF_Dictionary*& pDict) const +FX_BOOL CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const { if (m_pObject == NULL) { return FALSE; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index d898feecf4..ebe75484e0 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -438,7 +438,7 @@ const _FX_BSTR _PDF_InlineValueAbbr[] = { _FX_BSTRC("CCITTFaxDecode"), _FX_BSTRC("CCF"), _FX_BSTRC("DCTDecode"), _FX_BSTRC("DCT"), }; -static CFX_ByteStringC _PDF_FindFullName(const _FX_BSTR* table, int count, FX_BSTR abbr) +static CFX_ByteStringC _PDF_FindFullName(const _FX_BSTR* table, int count, const CFX_ByteStringC& abbr) { int i = 0; while (i < count) { @@ -496,7 +496,7 @@ void _PDF_ReplaceAbbr(CPDF_Object* pObj) } } } -static CFX_ByteStringC _PDF_FindAbbrName(const _FX_BSTR* table, int count, FX_BSTR fullName) +static CFX_ByteStringC _PDF_FindAbbrName(const _FX_BSTR* table, int count, const CFX_ByteStringC& fullName) { int i = 0; while (i < count) { @@ -1178,7 +1178,7 @@ void CPDF_StreamContentParser::Handle_SetFont() m_pCurStates->m_TextState.SetFont(pFont); } } -CPDF_Object* CPDF_StreamContentParser::FindResourceObj(FX_BSTR type, const CFX_ByteString& name) +CPDF_Object* CPDF_StreamContentParser::FindResourceObj(const CFX_ByteStringC& type, const CFX_ByteString& name) { if (m_pResources == NULL) { return NULL; diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h index 3e6abc2059..11214133a2 100644 --- a/core/src/fpdfapi/fpdf_page/pageint.h +++ b/core/src/fpdfapi/fpdf_page/pageint.h @@ -206,7 +206,7 @@ public: CPDF_Font* FindFont(const CFX_ByteString& name); CPDF_ColorSpace* FindColorSpace(const CFX_ByteString& name); CPDF_Pattern* FindPattern(const CFX_ByteString& name, FX_BOOL bShading); - CPDF_Object* FindResourceObj(FX_BSTR type, const CFX_ByteString& name); + CPDF_Object* FindResourceObj(const CFX_ByteStringC& type, const CFX_ByteString& name); void Handle_CloseFillStrokePath(); void Handle_FillStrokePath(); void Handle_CloseEOFillStrokePath(); @@ -335,7 +335,7 @@ class CPDF_DocPageData void Clear(FX_BOOL bRelease = FALSE); CPDF_Font* GetFont(CPDF_Dictionary* pFontDict, FX_BOOL findOnly); - CPDF_Font* GetStandardFont(FX_BSTR fontName, CPDF_FontEncoding* pEncoding); + CPDF_Font* GetStandardFont(const CFX_ByteStringC& fontName, CPDF_FontEncoding* pEncoding); void ReleaseFont(CPDF_Dictionary* pFontDict); CPDF_ColorSpace* GetColorSpace(CPDF_Object* pCSObj, CPDF_Dictionary* pResources); CPDF_ColorSpace* GetCopiedColorSpace(CPDF_Object* pCSObj); diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp index 973a14e33b..b4366ba277 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp @@ -103,7 +103,7 @@ FX_DWORD CPDF_StandardSecurityHandler::GetPermissions() { return m_Permissions; } -static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, FX_BSTR name, int& cipher, int& keylen) +static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, const CFX_ByteStringC& name, int& cipher, int& keylen) { int Version = pEncryptDict->GetInteger(FX_BSTRC("V")); cipher = FXCIPHER_RC4; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp index 97e68b5c0c..f0cabe5412 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp @@ -66,7 +66,7 @@ void CFX_DataFilter::ReportEOF(FX_DWORD left_input) m_bEOF = TRUE; m_SrcPos -= left_input; } -CFX_DataFilter* FPDF_CreateFilter(FX_BSTR name, const CPDF_Dictionary* pParam, int width, int height) +CFX_DataFilter* FPDF_CreateFilter(const CFX_ByteStringC& name, const CPDF_Dictionary* pParam, int width, int height) { FX_DWORD id = name.GetID(); switch (id) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index 192be3a45c..bfac0e37e0 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -353,11 +353,11 @@ CPDF_Number::CPDF_Number(FX_BOOL bInteger, void* pData) : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(bInteger), m_Integer(*(int*)pData) { } -CPDF_Number::CPDF_Number(FX_BSTR str) : CPDF_Object(PDFOBJ_NUMBER) { +CPDF_Number::CPDF_Number(const CFX_ByteStringC& str) : CPDF_Object(PDFOBJ_NUMBER) { FX_atonum(str, m_bInteger, &m_Integer); } -void CPDF_Number::SetString(FX_BSTR str) +void CPDF_Number::SetString(const CFX_ByteStringC& str) { FX_atonum(str, m_bInteger, &m_Integer); } @@ -588,19 +588,19 @@ CPDF_Object* CPDF_Dictionary::GetNextElement(FX_POSITION& pos, CFX_ByteString& k m_Map.GetNextAssoc(pos, key, (void*&)p); return p; } -CPDF_Object* CPDF_Dictionary::GetElement(FX_BSTR key) const +CPDF_Object* CPDF_Dictionary::GetElement(const CFX_ByteStringC& key) const { CPDF_Object* p = NULL; m_Map.Lookup(key, (void*&)p); return p; } -CPDF_Object* CPDF_Dictionary::GetElementValue(FX_BSTR key) const +CPDF_Object* CPDF_Dictionary::GetElementValue(const CFX_ByteStringC& key) const { CPDF_Object* p = NULL; m_Map.Lookup(key, (void*&)p); return p ? p->GetDirect() : NULL; } -CFX_ByteString CPDF_Dictionary::GetString(FX_BSTR key) const +CFX_ByteString CPDF_Dictionary::GetString(const CFX_ByteStringC& key) const { CPDF_Object* p = NULL; m_Map.Lookup(key, (void*&)p); @@ -609,7 +609,7 @@ CFX_ByteString CPDF_Dictionary::GetString(FX_BSTR key) const else return CFX_ByteString(); } -CFX_ByteStringC CPDF_Dictionary::GetConstString(FX_BSTR key) const +CFX_ByteStringC CPDF_Dictionary::GetConstString(const CFX_ByteStringC& key) const { CPDF_Object* p = NULL; m_Map.Lookup(key, (void*&)p); @@ -618,7 +618,7 @@ CFX_ByteStringC CPDF_Dictionary::GetConstString(FX_BSTR key) const else return CFX_ByteStringC(); } -CFX_WideString CPDF_Dictionary::GetUnicodeText(FX_BSTR key, CFX_CharMap* pCharMap) const +CFX_WideString CPDF_Dictionary::GetUnicodeText(const CFX_ByteStringC& key, CFX_CharMap* pCharMap) const { CPDF_Object* p = NULL; m_Map.Lookup(key, (void*&)p); @@ -634,7 +634,7 @@ CFX_WideString CPDF_Dictionary::GetUnicodeText(FX_BSTR key, CFX_CharMap* pCharMa } return CFX_WideString(); } -CFX_ByteString CPDF_Dictionary::GetString(FX_BSTR key, FX_BSTR def) const +CFX_ByteString CPDF_Dictionary::GetString(const CFX_ByteStringC& key, const CFX_ByteStringC& def) const { CPDF_Object* p = NULL; m_Map.Lookup(key, (void*&)p); @@ -643,7 +643,7 @@ CFX_ByteString CPDF_Dictionary::GetString(FX_BSTR key, FX_BSTR def) const } return CFX_ByteString(def); } -CFX_ByteStringC CPDF_Dictionary::GetConstString(FX_BSTR key, FX_BSTR def) const +CFX_ByteStringC CPDF_Dictionary::GetConstString(const CFX_ByteStringC& key, const CFX_ByteStringC& def) const { CPDF_Object* p = NULL; m_Map.Lookup(key, (void*&)p); @@ -652,7 +652,7 @@ CFX_ByteStringC CPDF_Dictionary::GetConstString(FX_BSTR key, FX_BSTR def) const else return CFX_ByteStringC(def); } -int CPDF_Dictionary::GetInteger(FX_BSTR key) const +int CPDF_Dictionary::GetInteger(const CFX_ByteStringC& key) const { CPDF_Object* p = NULL; m_Map.Lookup(key, (void*&)p); @@ -661,7 +661,7 @@ int CPDF_Dictionary::GetInteger(FX_BSTR key) const } return 0; } -int CPDF_Dictionary::GetInteger(FX_BSTR key, int def) const +int CPDF_Dictionary::GetInteger(const CFX_ByteStringC& key, int def) const { CPDF_Object* p = NULL; m_Map.Lookup(key, (void*&)p); @@ -670,7 +670,7 @@ int CPDF_Dictionary::GetInteger(FX_BSTR key, int def) const } return def; } -FX_FLOAT CPDF_Dictionary::GetNumber(FX_BSTR key) const +FX_FLOAT CPDF_Dictionary::GetNumber(const CFX_ByteStringC& key) const { CPDF_Object* p = NULL; m_Map.Lookup(key, (void*&)p); @@ -679,7 +679,7 @@ FX_FLOAT CPDF_Dictionary::GetNumber(FX_BSTR key) const } return 0; } -FX_BOOL CPDF_Dictionary::GetBoolean(FX_BSTR key, FX_BOOL bDefault) const +FX_BOOL CPDF_Dictionary::GetBoolean(const CFX_ByteStringC& key, FX_BOOL bDefault) const { CPDF_Object* p = NULL; m_Map.Lookup(key, (void*&)p); @@ -688,7 +688,7 @@ FX_BOOL CPDF_Dictionary::GetBoolean(FX_BSTR key, FX_BOOL bDefault) const } return bDefault; } -CPDF_Dictionary* CPDF_Dictionary::GetDict(FX_BSTR key) const +CPDF_Dictionary* CPDF_Dictionary::GetDict(const CFX_ByteStringC& key) const { CPDF_Object* p = GetElementValue(key); if (p == NULL) { @@ -700,7 +700,7 @@ CPDF_Dictionary* CPDF_Dictionary::GetDict(FX_BSTR key) const } return NULL; } -CPDF_Array* CPDF_Dictionary::GetArray(FX_BSTR key) const +CPDF_Array* CPDF_Dictionary::GetArray(const CFX_ByteStringC& key) const { CPDF_Object* p = GetElementValue(key); if (p == NULL || p->GetType() != PDFOBJ_ARRAY) { @@ -708,7 +708,7 @@ CPDF_Array* CPDF_Dictionary::GetArray(FX_BSTR key) const } return (CPDF_Array*)p; } -CPDF_Stream* CPDF_Dictionary::GetStream(FX_BSTR key) const +CPDF_Stream* CPDF_Dictionary::GetStream(const CFX_ByteStringC& key) const { CPDF_Object* p = GetElementValue(key); if (p == NULL || p->GetType() != PDFOBJ_STREAM) { @@ -716,7 +716,7 @@ CPDF_Stream* CPDF_Dictionary::GetStream(FX_BSTR key) const } return (CPDF_Stream*)p; } -CFX_FloatRect CPDF_Dictionary::GetRect(FX_BSTR key) const +CFX_FloatRect CPDF_Dictionary::GetRect(const CFX_ByteStringC& key) const { CFX_FloatRect rect; CPDF_Array* pArray = GetArray(key); @@ -725,7 +725,7 @@ CFX_FloatRect CPDF_Dictionary::GetRect(FX_BSTR key) const } return rect; } -CFX_AffineMatrix CPDF_Dictionary::GetMatrix(FX_BSTR key) const +CFX_AffineMatrix CPDF_Dictionary::GetMatrix(const CFX_ByteStringC& key) const { CFX_AffineMatrix matrix; CPDF_Array* pArray = GetArray(key); @@ -734,12 +734,12 @@ CFX_AffineMatrix CPDF_Dictionary::GetMatrix(FX_BSTR key) const } return matrix; } -FX_BOOL CPDF_Dictionary::KeyExist(FX_BSTR key) const +FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const { void* value; return m_Map.Lookup(key, value); } -void CPDF_Dictionary::SetAt(FX_BSTR key, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs) +void CPDF_Dictionary::SetAt(const CFX_ByteStringC& key, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs) { ASSERT(m_Type == PDFOBJ_DICTIONARY); CPDF_Object* p = NULL; @@ -759,12 +759,12 @@ void CPDF_Dictionary::SetAt(FX_BSTR key, CPDF_Object* pObj, CPDF_IndirectObjects m_Map.RemoveKey(key); } } -void CPDF_Dictionary::AddValue(FX_BSTR key, CPDF_Object* pObj) +void CPDF_Dictionary::AddValue(const CFX_ByteStringC& key, CPDF_Object* pObj) { ASSERT(m_Type == PDFOBJ_DICTIONARY); m_Map.AddValue(key, pObj); } -void CPDF_Dictionary::RemoveAt(FX_BSTR key) +void CPDF_Dictionary::RemoveAt(const CFX_ByteStringC& key) { ASSERT(m_Type == PDFOBJ_DICTIONARY); CPDF_Object* p = NULL; @@ -775,7 +775,7 @@ void CPDF_Dictionary::RemoveAt(FX_BSTR key) p->Release(); m_Map.RemoveKey(key); } -void CPDF_Dictionary::ReplaceKey(FX_BSTR oldkey, FX_BSTR newkey) +void CPDF_Dictionary::ReplaceKey(const CFX_ByteStringC& oldkey, const CFX_ByteStringC& newkey) { ASSERT(m_Type == PDFOBJ_DICTIONARY); CPDF_Object* p = NULL; @@ -807,37 +807,37 @@ FX_BOOL CPDF_Dictionary::Identical(CPDF_Dictionary* pOther) const } return TRUE; } -void CPDF_Dictionary::SetAtInteger(FX_BSTR key, int i) +void CPDF_Dictionary::SetAtInteger(const CFX_ByteStringC& key, int i) { SetAt(key, new CPDF_Number(i)); } -void CPDF_Dictionary::SetAtName(FX_BSTR key, const CFX_ByteString& name) +void CPDF_Dictionary::SetAtName(const CFX_ByteStringC& key, const CFX_ByteString& name) { SetAt(key, new CPDF_Name(name)); } -void CPDF_Dictionary::SetAtString(FX_BSTR key, const CFX_ByteString& str) +void CPDF_Dictionary::SetAtString(const CFX_ByteStringC& key, const CFX_ByteString& str) { SetAt(key, new CPDF_String(str)); } -void CPDF_Dictionary::SetAtReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum) +void CPDF_Dictionary::SetAtReference(const CFX_ByteStringC& key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum) { SetAt(key, new CPDF_Reference(pDoc, objnum)); } -void CPDF_Dictionary::AddReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum) +void CPDF_Dictionary::AddReference(const CFX_ByteStringC& key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum) { AddValue(key, new CPDF_Reference(pDoc, objnum)); } -void CPDF_Dictionary::SetAtNumber(FX_BSTR key, FX_FLOAT f) +void CPDF_Dictionary::SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f) { CPDF_Number* pNumber = new CPDF_Number; pNumber->SetNumber(f); SetAt(key, pNumber); } -void CPDF_Dictionary::SetAtBoolean(FX_BSTR key, FX_BOOL bValue) +void CPDF_Dictionary::SetAtBoolean(const CFX_ByteStringC& key, FX_BOOL bValue) { SetAt(key, new CPDF_Boolean(bValue)); } -void CPDF_Dictionary::SetAtRect(FX_BSTR key, const CFX_FloatRect& rect) +void CPDF_Dictionary::SetAtRect(const CFX_ByteStringC& key, const CFX_FloatRect& rect) { CPDF_Array* pArray = new CPDF_Array; pArray->AddNumber(rect.left); @@ -846,7 +846,7 @@ void CPDF_Dictionary::SetAtRect(FX_BSTR key, const CFX_FloatRect& rect) pArray->AddNumber(rect.top); SetAt(key, pArray); } -void CPDF_Dictionary::SetAtMatrix(FX_BSTR key, const CFX_AffineMatrix& matrix) +void CPDF_Dictionary::SetAtMatrix(const CFX_ByteStringC& key, const CFX_AffineMatrix& matrix) { CPDF_Array* pArray = new CPDF_Array; pArray->AddNumber16(matrix.a); diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index 3a03f33b29..4fd7974684 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -331,7 +331,7 @@ FX_FILESIZE CPDF_Parser::GetObjectOffset(FX_DWORD objnum) } return 0; } -static int32_t GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) +static int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteStringC& key) { CPDF_Object* pObj = pDict->GetElement(key); if (pObj == NULL) { @@ -342,7 +342,7 @@ static int32_t GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key) } return 0; } -static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, FX_BSTR key, int32_t iType) +static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, const CFX_ByteStringC& key, int32_t iType) { CPDF_Object* pObj = pDict->GetElement(key); if (!pObj) { @@ -2545,7 +2545,7 @@ FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, } return TRUE; } -FX_BOOL CPDF_SyntaxParser::SearchWord(FX_BSTR tag, FX_BOOL bWholeWord, FX_BOOL bForward, FX_FILESIZE limit) +FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, FX_BOOL bWholeWord, FX_BOOL bForward, FX_FILESIZE limit) { int32_t taglen = tag.GetLength(); if (taglen == 0) { @@ -2616,7 +2616,7 @@ struct _SearchTagRecord { FX_DWORD m_Len; FX_DWORD m_Offset; }; -int32_t CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX_FILESIZE limit) +int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags, FX_BOOL bWholeWord, FX_FILESIZE limit) { int32_t ntags = 1, i; for (i = 0; i < tags.GetLength(); i ++) @@ -2678,7 +2678,7 @@ end: FX_Free(pPatterns); return found; } -FX_FILESIZE CPDF_SyntaxParser::FindTag(FX_BSTR tag, FX_FILESIZE limit) +FX_FILESIZE CPDF_SyntaxParser::FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit) { int32_t taglen = tag.GetLength(); int32_t match = 0; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index e6474550a2..61134f5df4 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -49,7 +49,7 @@ CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize) m_dwSize = dwSize; m_dwCurPos = 0; } -CPDF_SimpleParser::CPDF_SimpleParser(FX_BSTR str) +CPDF_SimpleParser::CPDF_SimpleParser(const CFX_ByteStringC& str) { m_pData = str.GetPtr(); m_dwSize = str.GetLength(); @@ -194,7 +194,7 @@ CFX_ByteStringC CPDF_SimpleParser::GetWord() } return CFX_ByteStringC(pStart, dwSize); } -FX_BOOL CPDF_SimpleParser::SearchToken(FX_BSTR token) +FX_BOOL CPDF_SimpleParser::SearchToken(const CFX_ByteStringC& token) { int token_len = token.GetLength(); while (m_dwCurPos < m_dwSize - token_len) { @@ -209,7 +209,7 @@ FX_BOOL CPDF_SimpleParser::SearchToken(FX_BSTR token) m_dwCurPos += token_len; return TRUE; } -FX_BOOL CPDF_SimpleParser::SkipWord(FX_BSTR token) +FX_BOOL CPDF_SimpleParser::SkipWord(const CFX_ByteStringC& token) { while (1) { CFX_ByteStringC word = GetWord(); @@ -222,7 +222,7 @@ FX_BOOL CPDF_SimpleParser::SkipWord(FX_BSTR token) } return FALSE; } -FX_BOOL CPDF_SimpleParser::FindTagPair(FX_BSTR start_token, FX_BSTR end_token, +FX_BOOL CPDF_SimpleParser::FindTagPair(const CFX_ByteStringC& start_token, const CFX_ByteStringC& end_token, FX_DWORD& start_pos, FX_DWORD& end_pos) { if (!start_token.IsEmpty()) { @@ -243,7 +243,7 @@ FX_BOOL CPDF_SimpleParser::FindTagPair(FX_BSTR start_token, FX_BSTR end_token, } return FALSE; } -FX_BOOL CPDF_SimpleParser::FindTagParam(FX_BSTR token, int nParams) +FX_BOOL CPDF_SimpleParser::FindTagParam(const CFX_ByteStringC& token, int nParams) { nParams ++; FX_DWORD* pBuf = FX_Alloc(FX_DWORD, nParams); @@ -287,7 +287,7 @@ static int _hex2dec(char ch) } return 0; } -CFX_ByteString PDF_NameDecode(FX_BSTR bstr) +CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) { int size = bstr.GetLength(); const FX_CHAR* pSrc = bstr.GetCStr(); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index 2cbe2e8eb6..5851aabbe0 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -603,8 +603,9 @@ int CPDF_DIBSource::CreateDecoder() if (decoder == FX_BSTRC("CCITTFaxDecode")) { m_pDecoder = FPDFAPI_CreateFaxDecoder(src_data, src_size, m_Width, m_Height, pParams); } else if (decoder == FX_BSTRC("DCTDecode")) { - m_pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder(src_data, src_size, m_Width, m_Height, - m_nComponents, pParams ? pParams->GetInteger(FX_BSTR("ColorTransform"), 1) : 1); + m_pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( + src_data, src_size, m_Width, m_Height, m_nComponents, + pParams ? pParams->GetInteger("ColorTransform", 1) : 1); if (!m_pDecoder) { FX_BOOL bTransform = FALSE; int comps, bpc; diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp index f9e692cb69..e559c0ef16 100644 --- a/core/src/fpdfdoc/doc_basic.cpp +++ b/core/src/fpdfdoc/doc_basic.cpp @@ -72,7 +72,7 @@ CFX_ByteString CPDF_Dest::GetRemoteName() } return m_pObj->GetString(); } -CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc, FX_BSTR category) +CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteStringC& category) { if (pDoc->GetRoot() && pDoc->GetRoot()->GetDict(FX_BSTRC("Names"))) m_pRoot = pDoc->GetRoot()->GetDict(FX_BSTRC("Names"))->GetDict(category); @@ -229,7 +229,7 @@ CPDF_Object* CPDF_NameTree::LookupValue(const CFX_ByteString& csName) const int nIndex = 0; return SearchNameNode(m_pRoot, csName, nIndex, NULL); } -CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, FX_BSTR sName) +CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, const CFX_ByteStringC& sName) { CPDF_Object* pValue = LookupValue(sName); if (pValue == NULL) { @@ -282,7 +282,7 @@ static CFX_WideString ChangeSlashToPDF(const FX_WCHAR* str) return result; } #endif -static CFX_WideString FILESPEC_DecodeFileName(FX_WSTR filepath) +static CFX_WideString FILESPEC_DecodeFileName(const CFX_WideStringC& filepath) { if (filepath.GetLength() <= 1) { return CFX_WideString(); @@ -362,7 +362,7 @@ FX_BOOL CPDF_FileSpec::IsURL() const } return ((CPDF_Dictionary*)m_pObj)->GetString(FX_BSTRC("FS")) == FX_BSTRC("URL"); } -CFX_WideString FILESPEC_EncodeFileName(FX_WSTR filepath) +CFX_WideString FILESPEC_EncodeFileName(const CFX_WideStringC& filepath) { if (filepath.GetLength() <= 1) { return CFX_WideString(); @@ -417,7 +417,7 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const } return NULL; } -static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object *pObj, FX_WSTR wsFileName, FX_BOOL bURL) +static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object *pObj, const CFX_WideStringC& wsFileName, FX_BOOL bURL) { ASSERT(pObj != NULL); CFX_WideString wsStr; @@ -435,7 +435,7 @@ static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object *pObj, FX_WSTR wsFileName, pDict->SetAtString(FX_BSTRC("UF"), PDF_EncodeText(wsStr)); } } -void CPDF_FileSpec::SetFileName(FX_WSTR wsFileName, FX_BOOL bURL) +void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName, FX_BOOL bURL) { ASSERT(m_pObj != NULL); if (m_pObj->GetType() == PDFOBJ_DICTIONARY && bURL) { @@ -540,7 +540,7 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const wsLabel.Format(L"%d", nPage + 1); return wsLabel; } -int32_t CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const +int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const { if (m_pDocument == NULL) { return -1; @@ -565,7 +565,7 @@ int32_t CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const } return -1; } -int32_t CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const +int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); return GetPageByLabel(bsLabel); diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index 753ade0411..27432dfe57 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -1294,8 +1294,8 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(const CPDF_Dictionary* pFieldDi pField = m_pFieldTree->GetField(csWName); if (pField == NULL) { CPDF_Dictionary *pParent = (CPDF_Dictionary*)pFieldDict; - if (!pFieldDict->KeyExist(FX_BSTR("T")) && - pFieldDict->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("Widget")) { + if (!pFieldDict->KeyExist(FX_BSTRC("T")) && + pFieldDict->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("Widget")) { pParent = pFieldDict->GetDict(FX_BSTRC("Parent")); if (!pParent) { pParent = (CPDF_Dictionary*)pFieldDict; @@ -1386,7 +1386,7 @@ CPDF_FormField* CPDF_InterForm::CheckRequiredFields(const CFX_PtrArray *fields, } return NULL; } -CFDF_Document* CPDF_InterForm::ExportToFDF(FX_WSTR pdf_path, FX_BOOL bSimpleFileSpec) const +CFDF_Document* CPDF_InterForm::ExportToFDF(const CFX_WideStringC& pdf_path, FX_BOOL bSimpleFileSpec) const { CFX_PtrArray fields; int nCount = m_pFieldTree->m_Root.CountFields(); @@ -1396,8 +1396,8 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(FX_WSTR pdf_path, FX_BOOL bSimpleFile } return ExportToFDF(pdf_path, fields, TRUE, bSimpleFileSpec); } -CFX_WideString FILESPEC_EncodeFileName(FX_WSTR filepath); -CFDF_Document* CPDF_InterForm::ExportToFDF(FX_WSTR pdf_path, CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude, FX_BOOL bSimpleFileSpec) const +CFX_WideString FILESPEC_EncodeFileName(const CFX_WideStringC& filepath); +CFDF_Document* CPDF_InterForm::ExportToFDF(const CFX_WideStringC& pdf_path, CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude, FX_BOOL bSimpleFileSpec) const { CFDF_Document* pDoc = CFDF_Document::CreateNewDoc(); if (pDoc == NULL) { diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp index 1ab63234d6..da28a0b824 100644 --- a/core/src/fpdfdoc/doc_formcontrol.cpp +++ b/core/src/fpdfdoc/doc_formcontrol.cpp @@ -339,7 +339,7 @@ int CPDF_FormControl::GetControlAlignment() return pObj->GetInteger(); } } -FX_BOOL CPDF_ApSettings::HasMKEntry(FX_BSTR csEntry) +FX_BOOL CPDF_ApSettings::HasMKEntry(const CFX_ByteStringC& csEntry) { if (m_pDict == NULL) { return FALSE; @@ -353,7 +353,7 @@ int CPDF_ApSettings::GetRotation() } return m_pDict->GetInteger(FX_BSTRC("R")); } -FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, FX_BSTR csEntry) +FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, const CFX_ByteStringC& csEntry) { iColorType = COLORTYPE_TRANSPARENT; if (m_pDict == NULL) { @@ -388,7 +388,7 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, FX_BSTR csEntry) } return color; } -FX_FLOAT CPDF_ApSettings::GetOriginalColor(int index, FX_BSTR csEntry) +FX_FLOAT CPDF_ApSettings::GetOriginalColor(int index, const CFX_ByteStringC& csEntry) { if (m_pDict == NULL) { return 0; @@ -399,7 +399,7 @@ FX_FLOAT CPDF_ApSettings::GetOriginalColor(int index, FX_BSTR csEntry) } return 0; } -void CPDF_ApSettings::GetOriginalColor(int& iColorType, FX_FLOAT fc[4], FX_BSTR csEntry) +void CPDF_ApSettings::GetOriginalColor(int& iColorType, FX_FLOAT fc[4], const CFX_ByteStringC& csEntry) { iColorType = COLORTYPE_TRANSPARENT; for (int i = 0; i < 4; i ++) { @@ -429,7 +429,7 @@ void CPDF_ApSettings::GetOriginalColor(int& iColorType, FX_FLOAT fc[4], FX_BSTR fc[3] = pEntry->GetNumber(3); } } -CFX_WideString CPDF_ApSettings::GetCaption(FX_BSTR csEntry) +CFX_WideString CPDF_ApSettings::GetCaption(const CFX_ByteStringC& csEntry) { CFX_WideString csCaption; if (m_pDict == NULL) { @@ -437,7 +437,7 @@ CFX_WideString CPDF_ApSettings::GetCaption(FX_BSTR csEntry) } return m_pDict->GetUnicodeText(csEntry); } -CPDF_Stream* CPDF_ApSettings::GetIcon(FX_BSTR csEntry) +CPDF_Stream* CPDF_ApSettings::GetIcon(const CFX_ByteStringC& csEntry) { if (m_pDict == NULL) { return NULL; diff --git a/core/src/fpdfdoc/doc_metadata.cpp b/core/src/fpdfdoc/doc_metadata.cpp index 0239e0ad55..f0c507f8cf 100644 --- a/core/src/fpdfdoc/doc_metadata.cpp +++ b/core/src/fpdfdoc/doc_metadata.cpp @@ -73,7 +73,7 @@ void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc) pElmntRdf = pXmlElmnt->GetElement(NULL, FX_BSTRC("RDF")); } } -int32_t CPDF_Metadata::GetString(FX_BSTR bsItem, CFX_WideString &wsStr) +int32_t CPDF_Metadata::GetString(const CFX_ByteStringC& bsItem, CFX_WideString &wsStr) { if (!((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt) { return -1; diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp index 318e9318ce..1906603178 100644 --- a/core/src/fpdfdoc/doc_ocg.cpp +++ b/core/src/fpdfdoc/doc_ocg.cpp @@ -25,7 +25,7 @@ static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object *pObject, const CPDF_Dict } return -1; } -static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary *pDict, FX_BSTR csElement, FX_BSTR csDef = FX_BSTRC("")) +static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary *pDict, const CFX_ByteStringC& csElement, const CFX_ByteStringC& csDef = FX_BSTRC("")) { FXSYS_assert(pDict != NULL); CPDF_Object *pIntent = pDict->GetElementValue(FX_BSTRC("Intent")); @@ -46,7 +46,7 @@ static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary *pDict, FX_BSTR csEle bsIntent = pIntent->GetString(); return bsIntent == FX_BSTRC("All") || bsIntent == csElement; } -static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document *pDoc, const CPDF_Dictionary *pOCGDict, FX_BSTR bsState) +static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document *pDoc, const CPDF_Dictionary *pOCGDict, const CFX_ByteStringC& bsState) { FXSYS_assert(pDoc && pOCGDict); CPDF_Dictionary *pOCProperties = pDoc->GetRoot()->GetDict(FX_BSTRC("OCProperties")); @@ -101,7 +101,7 @@ CPDF_OCContext::~CPDF_OCContext() { m_OCGStates.RemoveAll(); } -FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(FX_BSTR csConfig, const CPDF_Dictionary *pOCGDict, FX_BOOL &bValidConfig) const +FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig, const CPDF_Dictionary *pOCGDict, FX_BOOL &bValidConfig) const { CPDF_Dictionary *pConfig = FPDFDOC_OCG_GetConfig(m_pDocument, pOCGDict, csConfig); if (!pConfig) { diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp index a724565c3f..510dd20c6e 100644 --- a/core/src/fpdfdoc/doc_tagged.cpp +++ b/core/src/fpdfdoc/doc_tagged.cpp @@ -312,7 +312,7 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum, CPDF_Object* pKidObj, } } } -static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, FX_BSTR owner, FX_FLOAT nLevel = 0.0F) +static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, const CFX_ByteStringC& owner, FX_FLOAT nLevel = 0.0F) { if (nLevel > nMaxRecursion) { return NULL; @@ -340,7 +340,7 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, FX_BSTR owner, FX_FLOA } return NULL; } -CPDF_Object* CPDF_StructElementImpl::GetAttr(FX_BSTR owner, FX_BSTR name, FX_BOOL bInheritable, FX_FLOAT fLevel) +CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_BOOL bInheritable, FX_FLOAT fLevel) { if (fLevel > nMaxRecursion) { return NULL; @@ -391,7 +391,7 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(FX_BSTR owner, FX_BSTR name, FX_BOO } return NULL; } -CPDF_Object* CPDF_StructElementImpl::GetAttr(FX_BSTR owner, FX_BSTR name, FX_BOOL bInheritable, int subindex) +CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_BOOL bInheritable, int subindex) { CPDF_Object* pAttr = GetAttr(owner, name, bInheritable); if (pAttr == NULL || subindex == -1 || pAttr->GetType() != PDFOBJ_ARRAY) { @@ -403,7 +403,7 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(FX_BSTR owner, FX_BSTR name, FX_BOO } return pArray->GetElementValue(subindex); } -CFX_ByteString CPDF_StructElementImpl::GetName(FX_BSTR owner, FX_BSTR name, FX_BSTR default_value, FX_BOOL bInheritable, int subindex) +CFX_ByteString CPDF_StructElementImpl::GetName(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, const CFX_ByteStringC& default_value, FX_BOOL bInheritable, int subindex) { CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NAME) { @@ -411,7 +411,7 @@ CFX_ByteString CPDF_StructElementImpl::GetName(FX_BSTR owner, FX_BSTR name, FX_B } return pAttr->GetString(); } -FX_ARGB CPDF_StructElementImpl::GetColor(FX_BSTR owner, FX_BSTR name, FX_ARGB default_value, FX_BOOL bInheritable, int subindex) +FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_ARGB default_value, FX_BOOL bInheritable, int subindex) { CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); if (pAttr == NULL || pAttr->GetType() != PDFOBJ_ARRAY) { @@ -420,7 +420,7 @@ FX_ARGB CPDF_StructElementImpl::GetColor(FX_BSTR owner, FX_BSTR name, FX_ARGB de CPDF_Array* pArray = (CPDF_Array*)pAttr; return 0xff000000 | ((int)(pArray->GetNumber(0) * 255) << 16) | ((int)(pArray->GetNumber(1) * 255) << 8) | (int)(pArray->GetNumber(2) * 255); } -FX_FLOAT CPDF_StructElementImpl::GetNumber(FX_BSTR owner, FX_BSTR name, FX_FLOAT default_value, FX_BOOL bInheritable, int subindex) +FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_FLOAT default_value, FX_BOOL bInheritable, int subindex) { CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NUMBER) { @@ -428,7 +428,7 @@ FX_FLOAT CPDF_StructElementImpl::GetNumber(FX_BSTR owner, FX_BSTR name, FX_FLOAT } return pAttr->GetNumber(); } -int CPDF_StructElementImpl::GetInteger(FX_BSTR owner, FX_BSTR name, int default_value, FX_BOOL bInheritable, int subindex) +int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, int default_value, FX_BOOL bInheritable, int subindex) { CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NUMBER) { diff --git a/core/src/fpdfdoc/tagged_int.h b/core/src/fpdfdoc/tagged_int.h index 44ba527a60..4ac8d750d3 100644 --- a/core/src/fpdfdoc/tagged_int.h +++ b/core/src/fpdfdoc/tagged_int.h @@ -67,16 +67,16 @@ public: return &m_ObjectArray; } - CPDF_Object* GetAttr(FX_BSTR owner, FX_BSTR name, FX_BOOL bInheritable = FALSE, FX_FLOAT fLevel = 0.0F); + CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_BOOL bInheritable = FALSE, FX_FLOAT fLevel = 0.0F); - CFX_ByteString GetName(FX_BSTR owner, FX_BSTR name, FX_BSTR default_value, FX_BOOL bInheritable = FALSE, int subindex = -1); - FX_ARGB GetColor(FX_BSTR owner, FX_BSTR name, FX_ARGB default_value, FX_BOOL bInheritable = FALSE, int subindex = -1); - FX_FLOAT GetNumber(FX_BSTR owner, FX_BSTR name, FX_FLOAT default_value, FX_BOOL bInheritable = FALSE, int subindex = -1); - int GetInteger(FX_BSTR owner, FX_BSTR name, int default_value, FX_BOOL bInheritable = FALSE, int subindex = -1); + CFX_ByteString GetName(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, const CFX_ByteStringC& default_value, FX_BOOL bInheritable = FALSE, int subindex = -1); + FX_ARGB GetColor(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_ARGB default_value, FX_BOOL bInheritable = FALSE, int subindex = -1); + FX_FLOAT GetNumber(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_FLOAT default_value, FX_BOOL bInheritable = FALSE, int subindex = -1); + int GetInteger(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, int default_value, FX_BOOL bInheritable = FALSE, int subindex = -1); CFX_PtrArray m_ObjectArray; void LoadKids(CPDF_Dictionary* pDict); void LoadKid(FX_DWORD PageObjNum, CPDF_Object* pObj, CPDF_StructKid* pKid); - CPDF_Object* GetAttr(FX_BSTR owner, FX_BSTR name, FX_BOOL bInheritable, int subindex); + CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_BOOL bInheritable, int subindex); CPDF_StructElementImpl* Retain(); void Release(); protected: diff --git a/core/src/fpdftext/unicodenormalization.cpp b/core/src/fpdftext/unicodenormalization.cpp index 7b01830582..fa3d8120f9 100644 --- a/core/src/fpdftext/unicodenormalization.cpp +++ b/core/src/fpdftext/unicodenormalization.cpp @@ -49,7 +49,7 @@ FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) } return (FX_STRSIZE)wFind; } -FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, FX_WCHAR* pDst) +FX_STRSIZE FX_WideString_GetNormalization(const CFX_WideStringC& wsSrc, FX_WCHAR* pDst) { FX_STRSIZE nCount = 0; for (FX_STRSIZE len = 0; len < wsSrc.GetLength(); len ++) { @@ -62,7 +62,7 @@ FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, FX_WCHAR* pDst) } return nCount; } -FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, CFX_WideString &wsDst) +FX_STRSIZE FX_WideString_GetNormalization(const CFX_WideStringC& wsSrc, CFX_WideString &wsDst) { FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_WCHAR*)NULL); if (!nLen) { diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index 24f2cecbb5..4c270db403 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; 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 db1a5b4b2a..6a15dfb2fa 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 0ce98f87e4..301ba53968 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)) { 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 c2f1f6433b..dcf91d1a97 100644 --- a/core/src/fxcrt/fx_xml_parser.cpp +++ b/core/src/fxcrt/fx_xml_parser.cpp @@ -150,7 +150,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()) { @@ -512,7 +512,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; @@ -561,7 +561,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() @@ -569,7 +569,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() @@ -617,7 +617,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; @@ -644,19 +644,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) { @@ -665,7 +665,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); @@ -676,7 +676,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) { @@ -685,13 +685,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) { @@ -734,7 +734,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) { @@ -749,7 +749,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; @@ -779,7 +779,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; @@ -792,7 +792,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); @@ -812,7 +812,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 9ad2e5a450..a0243754bd 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 7a4e77a28d..4f58c103f0 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 05ed6196dd..c16f25624a 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_ diff --git a/core/src/fxge/android/fpf_skiafont.cpp b/core/src/fxge/android/fpf_skiafont.cpp index 213a6595aa..e94f20f876 100644 --- a/core/src/fxge/android/fpf_skiafont.cpp +++ b/core/src/fxge/android/fpf_skiafont.cpp @@ -166,7 +166,7 @@ FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, uint8_t* pBuffer, FX_DWORD } return dwSize; } -FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset) +FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, const CFX_ByteStringC& bsFamily, FX_DWORD dwStyle, uint8_t uCharset) { if (!pFontMgr || !pFontDes) { return FALSE; diff --git a/core/src/fxge/android/fpf_skiafont.h b/core/src/fxge/android/fpf_skiafont.h index af33402846..f3a61c9611 100644 --- a/core/src/fxge/android/fpf_skiafont.h +++ b/core/src/fxge/android/fpf_skiafont.h @@ -45,7 +45,7 @@ public: virtual int32_t GetHeight() const; virtual int32_t GetItalicAngle() const; virtual FX_DWORD GetFontData(FX_DWORD dwTable, uint8_t* pBuffer, FX_DWORD dwSize); - FX_BOOL InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset); + FX_BOOL InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescriptor *pFontDes, const CFX_ByteStringC& bsFamily, FX_DWORD dwStyle, uint8_t uCharset); protected: CFPF_SkiaFontMgr *m_pFontMgr; CFPF_SkiaFontDescriptor *m_pFontDes; diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index 214d67477b..0851a93b72 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -181,7 +181,7 @@ static FX_DWORD FPF_SkiaGetCharset(uint8_t uCharset) } return FPF_SKIACHARSET_Default; } -static FX_DWORD FPF_SKIANormalizeFontName(FX_BSTR bsfamily) +static FX_DWORD FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) { FX_DWORD dwHash = 0; int32_t iLength = bsfamily.GetLength(); @@ -195,7 +195,7 @@ static FX_DWORD FPF_SKIANormalizeFontName(FX_BSTR bsfamily) } return dwHash; } -static FX_DWORD FPF_SKIAGetFamilyHash(FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset) +static FX_DWORD FPF_SKIAGetFamilyHash(const CFX_ByteStringC& bsFamily, FX_DWORD dwStyle, uint8_t uCharset) { CFX_ByteString bsFont(bsFamily); if (dwStyle & FXFONT_BOLD) { @@ -215,13 +215,13 @@ static FX_BOOL FPF_SkiaIsCJK(uint8_t uCharset) return (uCharset == FXFONT_GB2312_CHARSET) || (uCharset == FXFONT_CHINESEBIG5_CHARSET) || (uCharset == FXFONT_HANGEUL_CHARSET) || (uCharset == FXFONT_SHIFTJIS_CHARSET); } -static FX_BOOL FPF_SkiaMaybeSymbol(FX_BSTR bsFacename) +static FX_BOOL FPF_SkiaMaybeSymbol(const CFX_ByteStringC& bsFacename) { CFX_ByteString bsName = bsFacename; bsName.MakeLower(); return bsName.Find("symbol") > -1; } -static FX_BOOL FPF_SkiaMaybeArabic(FX_BSTR bsFacename) +static FX_BOOL FPF_SkiaMaybeArabic(const CFX_ByteStringC& bsFacename) { CFX_ByteString bsName = bsFacename; bsName.MakeLower(); @@ -273,13 +273,13 @@ void CFPF_SkiaFontMgr::LoadSystemFonts() void CFPF_SkiaFontMgr::LoadPrivateFont(IFX_FileRead* pFontFile) { } -void CFPF_SkiaFontMgr::LoadPrivateFont(FX_BSTR bsFileName) +void CFPF_SkiaFontMgr::LoadPrivateFont(const CFX_ByteStringC& bsFileName) { } void CFPF_SkiaFontMgr::LoadPrivateFont(void* pBuffer, size_t szBuffer) { } -IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, uint8_t uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch) +IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, uint8_t uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch) { FX_DWORD dwHash = FPF_SKIAGetFamilyHash(bsFamilyname, dwStyle, uCharset); IFPF_Font *pFont = NULL; @@ -388,7 +388,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead *pFileRead, int32_t iFaceIn FXFT_Set_Pixel_Sizes(face, 0, 64); return face; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace(FX_BSTR bsFile, int32_t iFaceIndex ) +FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex ) { if (bsFile.IsEmpty()) { return NULL; @@ -425,7 +425,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const uint8_t* pBuffer, size_t szBuffer, FXFT_Set_Pixel_Sizes(face, 0, 64); return face; } -void CFPF_SkiaFontMgr::ScanPath(FX_BSTR path) +void CFPF_SkiaFontMgr::ScanPath(const CFX_ByteStringC& path) { void *handle = FX_OpenFolder(path.GetCStr()); if (!handle) { @@ -456,7 +456,7 @@ void CFPF_SkiaFontMgr::ScanPath(FX_BSTR path) } FX_CloseFolder(handle); } -void CFPF_SkiaFontMgr::ScanFile(FX_BSTR file) +void CFPF_SkiaFontMgr::ScanFile(const CFX_ByteStringC& file) { FXFT_Face face = GetFontFace(file); if (face) { diff --git a/core/src/fxge/android/fpf_skiafontmgr.h b/core/src/fxge/android/fpf_skiafontmgr.h index ba9ea9134a..5acf14e3ac 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.h +++ b/core/src/fxge/android/fpf_skiafontmgr.h @@ -97,16 +97,16 @@ public: FX_BOOL InitFTLibrary(); virtual void LoadSystemFonts(); virtual void LoadPrivateFont(IFX_FileRead* pFontFile); - virtual void LoadPrivateFont(FX_BSTR bsFileName); + virtual void LoadPrivateFont(const CFX_ByteStringC& bsFileName); virtual void LoadPrivateFont(void* pBuffer, size_t szBuffer); - virtual IFPF_Font* CreateFont(FX_BSTR bsFamilyname, uint8_t uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0); + virtual IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname, uint8_t uCharset, FX_DWORD dwStyle, FX_DWORD dwMatch = 0); FXFT_Face GetFontFace(IFX_FileRead *pFileRead, int32_t iFaceIndex = 0); - FXFT_Face GetFontFace(FX_BSTR bsFile, int32_t iFaceIndex = 0); + FXFT_Face GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex = 0); FXFT_Face GetFontFace(const uint8_t* pBuffer, size_t szBuffer, int32_t iFaceIndex = 0); protected: - void ScanPath(FX_BSTR path); - void ScanFile(FX_BSTR file); + void ScanPath(const CFX_ByteStringC& path); + void ScanFile(const CFX_ByteStringC& file); void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor *pFontDesc); void OutputSystemFonts(); FX_BOOL m_bLoaded; diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index afa9918690..ba5725d2f2 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -1298,7 +1298,7 @@ CFX_FolderFontInfo::~CFX_FolderFontInfo() delete (CFontFaceInfo*)value; } } -void CFX_FolderFontInfo::AddPath(FX_BSTR path) +void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) { m_PathList.Add(path); } diff --git a/core/src/reflow/layoutprovider_taggedpdf.cpp b/core/src/reflow/layoutprovider_taggedpdf.cpp index 4a5a22bd61..57ce4303e2 100644 --- a/core/src/reflow/layoutprovider_taggedpdf.cpp +++ b/core/src/reflow/layoutprovider_taggedpdf.cpp @@ -21,7 +21,7 @@ CPDF_LayoutElement::~CPDF_LayoutElement() } m_ChildArray.RemoveAll(); } -LayoutType CPDF_LayoutElement::ConvertLayoutType(FX_BSTR name) +LayoutType CPDF_LayoutElement::ConvertLayoutType(const CFX_ByteStringC& name) { if(name == (const char*)("Document")) { return LayoutDocument; @@ -127,7 +127,7 @@ LayoutType CPDF_LayoutElement::ConvertLayoutType(FX_BSTR name) } CFX_ByteStringC CPDF_LayoutElement::ConvertLayoutType(LayoutType type) { - FX_BSTR name = ""; + const CFX_ByteStringC& name = ""; if(type == LayoutArifact) { return "Arifact"; } else if( type == LayoutDocument) { diff --git a/core/src/reflow/layoutprovider_taggedpdf.h b/core/src/reflow/layoutprovider_taggedpdf.h index 3e11f17067..fa6c994bf0 100644 --- a/core/src/reflow/layoutprovider_taggedpdf.h +++ b/core/src/reflow/layoutprovider_taggedpdf.h @@ -36,7 +36,7 @@ public: CPDF_StructElement* m_pTaggedElement; CPDF_LayoutElement* m_pParentElement; CFX_PtrArray m_ChildArray; - LayoutType ConvertLayoutType(FX_BSTR name); + LayoutType ConvertLayoutType(const CFX_ByteStringC& name); CFX_ByteStringC ConvertLayoutType(LayoutType type); CFX_ByteStringC ConvertLayoutAttr(LayoutAttr attr); LayoutEnum ConvertLayoutEnum(CFX_ByteStringC Enum); |