From 6f0a64a1bf18ab6636404cdfb883897459083a4d Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 10 Jun 2015 16:51:15 -0700 Subject: Remove FX_BSTR and FX_WSTR typedefs. 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. --- core/src/fpdfdoc/doc_basic.cpp | 16 ++++++++-------- core/src/fpdfdoc/doc_form.cpp | 10 +++++----- core/src/fpdfdoc/doc_formcontrol.cpp | 12 ++++++------ core/src/fpdfdoc/doc_metadata.cpp | 2 +- core/src/fpdfdoc/doc_ocg.cpp | 6 +++--- core/src/fpdfdoc/doc_tagged.cpp | 14 +++++++------- core/src/fpdfdoc/tagged_int.h | 12 ++++++------ 7 files changed, 36 insertions(+), 36 deletions(-) (limited to 'core/src/fpdfdoc') 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: -- cgit v1.2.3