diff options
author | tsepez <tsepez@chromium.org> | 2016-04-04 16:41:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-04 16:41:35 -0700 |
commit | 28f97ff783c16f3391384ce97b765ce4eb310ac7 (patch) | |
tree | 69c4c8bc9dd39d5336c96f28b633d197dd207c81 /core/fpdfdoc | |
parent | ed9c4386713084f37548b46ab36f618021f716f5 (diff) | |
download | pdfium-28f97ff783c16f3391384ce97b765ce4eb310ac7.tar.xz |
Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC.
Having this happen implicitly can be dangerous because the lifetime
has to be considered; we should have caught the "red bots" in
https://codereview.chromium.org/1847333004/#ps60001 at compile time.
Review URL: https://codereview.chromium.org/1853233002
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r-- | core/fpdfdoc/cpvt_color.cpp | 2 | ||||
-rw-r--r-- | core/fpdfdoc/cpvt_fontmap.cpp | 5 | ||||
-rw-r--r-- | core/fpdfdoc/cpvt_generateap.cpp | 19 | ||||
-rw-r--r-- | core/fpdfdoc/doc_action.cpp | 4 | ||||
-rw-r--r-- | core/fpdfdoc/doc_annot.cpp | 4 | ||||
-rw-r--r-- | core/fpdfdoc/doc_basic.cpp | 12 | ||||
-rw-r--r-- | core/fpdfdoc/doc_bookmark.cpp | 4 | ||||
-rw-r--r-- | core/fpdfdoc/doc_form.cpp | 5 | ||||
-rw-r--r-- | core/fpdfdoc/doc_formcontrol.cpp | 20 | ||||
-rw-r--r-- | core/fpdfdoc/doc_formfield.cpp | 4 | ||||
-rw-r--r-- | core/fpdfdoc/doc_link.cpp | 4 | ||||
-rw-r--r-- | core/fpdfdoc/doc_ocg.cpp | 10 | ||||
-rw-r--r-- | core/fpdfdoc/doc_tagged.cpp | 9 | ||||
-rw-r--r-- | core/fpdfdoc/doc_utils.cpp | 67 |
14 files changed, 90 insertions, 79 deletions
diff --git a/core/fpdfdoc/cpvt_color.cpp b/core/fpdfdoc/cpvt_color.cpp index afeff23e15..7ddb9df0d0 100644 --- a/core/fpdfdoc/cpvt_color.cpp +++ b/core/fpdfdoc/cpvt_color.cpp @@ -10,7 +10,7 @@ // Static. CPVT_Color CPVT_Color::ParseColor(const CFX_ByteString& str) { - CPDF_SimpleParser syntax(str); + CPDF_SimpleParser syntax(str.AsByteStringC()); if (syntax.FindTagParamFromStart("g", 1)) return CPVT_Color(CPVT_Color::kGray, FX_atof(syntax.GetWord())); diff --git a/core/fpdfdoc/cpvt_fontmap.cpp b/core/fpdfdoc/cpvt_fontmap.cpp index 529f85169e..0aa7ac3486 100644 --- a/core/fpdfdoc/cpvt_fontmap.cpp +++ b/core/fpdfdoc/cpvt_fontmap.cpp @@ -38,8 +38,9 @@ void CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document* pDoc, return; if (CPDF_Dictionary* pFontList = pResDict->GetDictBy("Font")) { - if (!pFontList->KeyExist(sSysFontAlias)) - pFontList->SetAtReference(sSysFontAlias, pDoc, pPDFFont->GetFontDict()); + if (!pFontList->KeyExist(sSysFontAlias.AsByteStringC())) + pFontList->SetAtReference(sSysFontAlias.AsByteStringC(), pDoc, + pPDFFont->GetFontDict()); } pSysFont = pPDFFont; } diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index dd935de61e..c5e2cc7fab 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -36,7 +36,7 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, if (DA.IsEmpty()) return FALSE; - CPDF_SimpleParser syntax(DA); + CPDF_SimpleParser syntax(DA.AsByteStringC()); syntax.FindTagParamFromStart("Tf", 2); CFX_ByteString sFontName = syntax.GetWord(); sFontName = PDF_NameDecode(sFontName); @@ -54,12 +54,12 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, } CPDF_Dictionary* pDRFontDict = pDRDict ? pDRDict->GetDictBy("Font") : nullptr; if (pDRFontDict) { - pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1)); + pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1).AsByteStringC()); if (!pFontDict && !bUseFormRes) { pDRDict = pFormDict->GetDictBy("DR"); pDRFontDict = pDRDict->GetDictBy("Font"); if (pDRFontDict) - pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1)); + pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1).AsByteStringC()); } } if (!pDRFontDict) @@ -72,7 +72,8 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, pFontDict->SetAtName("BaseFont", "Helvetica"); pFontDict->SetAtName("Encoding", "WinAnsiEncoding"); pDoc->AddIndirectObject(pFontDict); - pDRFontDict->SetAtReference(sFontName.Mid(1), pDoc, pFontDict); + pDRFontDict->SetAtReference(sFontName.Mid(1).AsByteStringC(), pDoc, + pFontDict); } CPDF_Font* pDefFont = pDoc->LoadFont(pFontDict); if (!pDefFont) @@ -189,8 +190,9 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, pStreamResFontList = new CPDF_Dictionary; pStreamResList->SetAt("Font", pStreamResFontList); } - if (!pStreamResFontList->KeyExist(sFontName)) - pStreamResFontList->SetAtReference(sFontName, pDoc, pFontDict); + if (!pStreamResFontList->KeyExist(sFontName.AsByteStringC())) + pStreamResFontList->SetAtReference(sFontName.AsByteStringC(), pDoc, + pFontDict); } else { pStreamDict->SetAt("Resources", pFormDict->GetDictBy("DR")->Clone()); pStreamResList = pStreamDict->GetDictBy("Resources"); @@ -435,8 +437,9 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, pStreamResFontList = new CPDF_Dictionary; pStreamResList->SetAt("Font", pStreamResFontList); } - if (!pStreamResFontList->KeyExist(sFontName)) - pStreamResFontList->SetAtReference(sFontName, pDoc, pFontDict); + if (!pStreamResFontList->KeyExist(sFontName.AsByteStringC())) + pStreamResFontList->SetAtReference(sFontName.AsByteStringC(), pDoc, + pFontDict); } else { pStreamDict->SetAt("Resources", pFormDict->GetDictBy("DR")->Clone()); pStreamResList = pStreamDict->GetDictBy("Resources"); diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp index 2f08bfa3af..9a43b58e98 100644 --- a/core/fpdfdoc/doc_action.cpp +++ b/core/fpdfdoc/doc_action.cpp @@ -38,8 +38,8 @@ CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const { } if (pDest->IsString() || pDest->IsName()) { CPDF_NameTree name_tree(pDoc, "Dests"); - CFX_ByteStringC name = pDest->GetString(); - return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name)); + return CPDF_Dest( + name_tree.LookupNamedDest(pDoc, pDest->GetString().AsByteStringC())); } if (CPDF_Array* pArray = pDest->AsArray()) return CPDF_Dest(pArray); diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp index 276516589a..ca900acb9a 100644 --- a/core/fpdfdoc/doc_annot.cpp +++ b/core/fpdfdoc/doc_annot.cpp @@ -181,12 +181,12 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, CPDF_Dictionary* pDict = pAnnotDict->GetDictBy("Parent"); value = pDict ? pDict->GetStringBy("V") : CFX_ByteString(); } - if (value.IsEmpty() || !pDict->KeyExist(value)) + if (value.IsEmpty() || !pDict->KeyExist(value.AsByteStringC())) as = "Off"; else as = value; } - return pDict->GetStreamBy(as); + return pDict->GetStreamBy(as.AsByteStringC()); } return nullptr; } diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp index c711709e73..0c7f895405 100644 --- a/core/fpdfdoc/doc_basic.cpp +++ b/core/fpdfdoc/doc_basic.cpp @@ -90,12 +90,13 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, if (pLimits) { CFX_ByteString csLeft = pLimits->GetStringAt(0); CFX_ByteString csRight = pLimits->GetStringAt(1); - if (csLeft.Compare(csRight) > 0) { + if (csLeft.Compare(csRight.AsByteStringC()) > 0) { CFX_ByteString csTmp = csRight; csRight = csLeft; csLeft = csTmp; } - if (csName.Compare(csLeft) < 0 || csName.Compare(csRight) > 0) { + if (csName.Compare(csLeft.AsByteStringC()) < 0 || + csName.Compare(csRight.AsByteStringC()) > 0) { return NULL; } } @@ -104,7 +105,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, uint32_t dwCount = pNames->GetCount() / 2; for (uint32_t i = 0; i < dwCount; i++) { CFX_ByteString csValue = pNames->GetStringAt(i * 2); - int32_t iCompare = csValue.Compare(csName); + int32_t iCompare = csValue.Compare(csName.AsByteStringC()); if (iCompare <= 0) { if (ppFind) { *ppFind = pNames; @@ -500,7 +501,7 @@ int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const { CFX_ByteString bsOrig = bsLabel; for (int i = 0; i < nPages; i++) { bsLbl = PDF_EncodeText(GetLabel(i)); - if (!bsLbl.Compare(bsOrig)) { + if (!bsLbl.Compare(bsOrig.AsByteStringC())) { return i; } } @@ -512,6 +513,5 @@ int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const { return -1; } int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { - CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); - return GetPageByLabel(bsLabel); + return GetPageByLabel(PDF_EncodeText(wsLabel.GetPtr()).AsByteStringC()); } diff --git a/core/fpdfdoc/doc_bookmark.cpp b/core/fpdfdoc/doc_bookmark.cpp index 22ff7921ef..35a04043fe 100644 --- a/core/fpdfdoc/doc_bookmark.cpp +++ b/core/fpdfdoc/doc_bookmark.cpp @@ -80,8 +80,8 @@ CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const { return CPDF_Dest(); if (pDest->IsString() || pDest->IsName()) { CPDF_NameTree name_tree(pDocument, "Dests"); - CFX_ByteStringC name = pDest->GetString(); - return CPDF_Dest(name_tree.LookupNamedDest(pDocument, name)); + return CPDF_Dest(name_tree.LookupNamedDest( + pDocument, pDest->GetString().AsByteStringC())); } if (CPDF_Array* pArray = pDest->AsArray()) return CPDF_Dest(pArray); diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp index 2a6d739549..aa4b5c9f30 100644 --- a/core/fpdfdoc/doc_form.cpp +++ b/core/fpdfdoc/doc_form.cpp @@ -343,8 +343,9 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName( int num = 0; CFX_ByteString bsNum; while (TRUE) { - if (!pDict->KeyExist(csTmp + bsNum)) { - return csTmp + bsNum; + CFX_ByteString csKey = csTmp + bsNum; + if (!pDict->KeyExist(csKey.AsByteStringC())) { + return csKey; } if (m < iCount) { csTmp += csStr[m++]; diff --git a/core/fpdfdoc/doc_formcontrol.cpp b/core/fpdfdoc/doc_formcontrol.cpp index 1fcc4a386b..0a0a8c9a03 100644 --- a/core/fpdfdoc/doc_formcontrol.cpp +++ b/core/fpdfdoc/doc_formcontrol.cpp @@ -78,7 +78,7 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) { continue; } if (csKey2 != "Off") { - pSubDict->ReplaceKey(csKey2, csValue); + pSubDict->ReplaceKey(csKey2.AsByteStringC(), csValue.AsByteStringC()); break; } } @@ -202,7 +202,7 @@ CPDF_ApSettings CPDF_FormControl::GetMK() const { } bool CPDF_FormControl::HasMKEntry(CFX_ByteString csEntry) const { - return GetMK().HasMKEntry(csEntry); + return GetMK().HasMKEntry(csEntry.AsByteStringC()); } int CPDF_FormControl::GetRotation() { @@ -210,24 +210,24 @@ int CPDF_FormControl::GetRotation() { } FX_ARGB CPDF_FormControl::GetColor(int& iColorType, CFX_ByteString csEntry) { - return GetMK().GetColor(iColorType, csEntry); + return GetMK().GetColor(iColorType, csEntry.AsByteStringC()); } FX_FLOAT CPDF_FormControl::GetOriginalColor(int index, CFX_ByteString csEntry) { - return GetMK().GetOriginalColor(index, csEntry); + return GetMK().GetOriginalColor(index, csEntry.AsByteStringC()); } void CPDF_FormControl::GetOriginalColor(int& iColorType, FX_FLOAT fc[4], CFX_ByteString csEntry) { - GetMK().GetOriginalColor(iColorType, fc, csEntry); + GetMK().GetOriginalColor(iColorType, fc, csEntry.AsByteStringC()); } CFX_WideString CPDF_FormControl::GetCaption(CFX_ByteString csEntry) { - return GetMK().GetCaption(csEntry); + return GetMK().GetCaption(csEntry.AsByteStringC()); } CPDF_Stream* CPDF_FormControl::GetIcon(CFX_ByteString csEntry) { - return GetMK().GetIcon(csEntry); + return GetMK().GetIcon(csEntry.AsByteStringC()); } CPDF_IconFit CPDF_FormControl::GetIconFit() { @@ -286,7 +286,8 @@ CPDF_Font* CPDF_FormControl::GetDefaultControlFont() { if (CPDF_Dictionary* pDict = ToDictionary(pObj)) { CPDF_Dictionary* pFonts = pDict->GetDictBy("Font"); if (pFonts) { - CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag); + CPDF_Dictionary* pElement = + pFonts->GetDictBy(csFontNameTag.AsByteStringC()); if (pElement) { CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); if (pFont) { @@ -303,7 +304,8 @@ CPDF_Font* CPDF_FormControl::GetDefaultControlFont() { if (CPDF_Dictionary* pDict = ToDictionary(pObj)) { CPDF_Dictionary* pFonts = pDict->GetDictBy("Font"); if (pFonts) { - CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag); + CPDF_Dictionary* pElement = + pFonts->GetDictBy(csFontNameTag.AsByteStringC()); if (pElement) { CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); if (pFont) { diff --git a/core/fpdfdoc/doc_formfield.cpp b/core/fpdfdoc/doc_formfield.cpp index 0f8b3dd5ea..931f9e18d9 100644 --- a/core/fpdfdoc/doc_formfield.cpp +++ b/core/fpdfdoc/doc_formfield.cpp @@ -1054,7 +1054,7 @@ void CPDF_FormField::LoadDA() { if (DA.IsEmpty()) { return; } - CPDF_SimpleParser syntax(DA); + CPDF_SimpleParser syntax(DA.AsByteStringC()); syntax.FindTagParamFromStart("Tf", 2); CFX_ByteString font_name = syntax.GetWord(); CPDF_Dictionary* pFontDict = NULL; @@ -1062,7 +1062,7 @@ void CPDF_FormField::LoadDA() { m_pForm->m_pFormDict->GetDictBy("DR")->GetDictBy("Font")) pFontDict = m_pForm->m_pFormDict->GetDictBy("DR") ->GetDictBy("Font") - ->GetDictBy(font_name); + ->GetDictBy(font_name.AsByteStringC()); if (!pFontDict) { return; diff --git a/core/fpdfdoc/doc_link.cpp b/core/fpdfdoc/doc_link.cpp index 723955f9ea..d86bf203e4 100644 --- a/core/fpdfdoc/doc_link.cpp +++ b/core/fpdfdoc/doc_link.cpp @@ -81,8 +81,8 @@ CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) { if (pDest->IsString() || pDest->IsName()) { CPDF_NameTree name_tree(pDoc, "Dests"); - CFX_ByteStringC name = pDest->GetString(); - return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name)); + return CPDF_Dest( + name_tree.LookupNamedDest(pDoc, pDest->GetString().AsByteStringC())); } if (CPDF_Array* pArray = pDest->AsArray()) return CPDF_Dest(pArray); diff --git a/core/fpdfdoc/doc_ocg.cpp b/core/fpdfdoc/doc_ocg.cpp index a739c1675c..7464936b62 100644 --- a/core/fpdfdoc/doc_ocg.cpp +++ b/core/fpdfdoc/doc_ocg.cpp @@ -142,7 +142,7 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig, if (!pState) { continue; } - bState = pState->GetStringBy(csFind) != "OFF"; + bState = pState->GetStringBy(csFind.AsByteStringC()) != "OFF"; } } return bState; @@ -154,11 +154,11 @@ FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const { CFX_ByteString csState = FPDFDOC_OCG_GetUsageTypeString(m_eUsageType); CPDF_Dictionary* pUsage = pOCGDict->GetDictBy("Usage"); if (pUsage) { - CPDF_Dictionary* pState = pUsage->GetDictBy(csState); + CPDF_Dictionary* pState = pUsage->GetDictBy(csState.AsByteStringC()); if (pState) { CFX_ByteString csFind = csState + "State"; - if (pState->KeyExist(csFind)) { - return pState->GetStringBy(csFind) != "OFF"; + if (pState->KeyExist(csFind.AsByteStringC())) { + return pState->GetStringBy(csFind.AsByteStringC()) != "OFF"; } } if (csState != "View") { @@ -169,7 +169,7 @@ FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const { } } FX_BOOL bDefValid = FALSE; - return LoadOCGStateFromConfig(csState, pOCGDict, bDefValid); + return LoadOCGStateFromConfig(csState.AsByteStringC(), pOCGDict, bDefValid); } FX_BOOL CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary* pOCGDict) { diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp index 684789acc2..2a3554c499 100644 --- a/core/fpdfdoc/doc_tagged.cpp +++ b/core/fpdfdoc/doc_tagged.cpp @@ -205,7 +205,8 @@ CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, m_pDict = pDict; m_Type = pDict->GetStringBy("S"); if (pTree->m_pRoleMap) { - CFX_ByteString mapped = pTree->m_pRoleMap->GetStringBy(m_Type); + CFX_ByteString mapped = + pTree->m_pRoleMap->GetStringBy(m_Type.AsByteStringC()); if (!mapped.IsEmpty()) { m_Type = mapped; } @@ -373,14 +374,16 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, if (CPDF_Array* pArray = pC->AsArray()) { for (uint32_t i = 0; i < pArray->GetCount(); i++) { CFX_ByteString class_name = pArray->GetStringAt(i); - CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name); + CPDF_Dictionary* pClassDict = + pClassMap->GetDictBy(class_name.AsByteStringC()); if (pClassDict && pClassDict->GetStringBy("O") == owner) return pClassDict->GetDirectObjectBy(name); } return nullptr; } CFX_ByteString class_name = pC->GetString(); - CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name); + CPDF_Dictionary* pClassDict = + pClassMap->GetDictBy(class_name.AsByteStringC()); if (pClassDict && pClassDict->GetStringBy("O") == owner) return pClassDict->GetDirectObjectBy(name); return nullptr; diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp index f83d001af5..d3b3cac627 100644 --- a/core/fpdfdoc/doc_utils.cpp +++ b/core/fpdfdoc/doc_utils.cpp @@ -82,7 +82,7 @@ FX_BOOL CPDF_DefaultAppearance::HasFont() { if (m_csDA.IsEmpty()) { return FALSE; } - CPDF_SimpleParser syntax(m_csDA); + CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); return syntax.FindTagParamFromStart("Tf", 2); } CFX_ByteString CPDF_DefaultAppearance::GetFontString() { @@ -90,7 +90,7 @@ CFX_ByteString CPDF_DefaultAppearance::GetFontString() { if (m_csDA.IsEmpty()) { return csFont; } - CPDF_SimpleParser syntax(m_csDA); + CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); if (syntax.FindTagParamFromStart("Tf", 2)) { csFont += (CFX_ByteString)syntax.GetWord(); csFont += " "; @@ -107,11 +107,11 @@ void CPDF_DefaultAppearance::GetFont(CFX_ByteString& csFontNameTag, if (m_csDA.IsEmpty()) { return; } - CPDF_SimpleParser syntax(m_csDA); + CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); if (syntax.FindTagParamFromStart("Tf", 2)) { - csFontNameTag = (CFX_ByteString)syntax.GetWord(); + csFontNameTag = CFX_ByteString(syntax.GetWord()); csFontNameTag.Delete(0, 1); - fFontSize = FX_atof((CFX_ByteString)syntax.GetWord()); + fFontSize = FX_atof(syntax.GetWord()); } csFontNameTag = PDF_NameDecode(csFontNameTag); } @@ -119,7 +119,7 @@ FX_BOOL CPDF_DefaultAppearance::HasColor(FX_BOOL bStrokingOperation) { if (m_csDA.IsEmpty()) { return FALSE; } - CPDF_SimpleParser syntax(m_csDA); + CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) { return TRUE; } @@ -134,7 +134,7 @@ CFX_ByteString CPDF_DefaultAppearance::GetColorString( if (m_csDA.IsEmpty()) { return csColor; } - CPDF_SimpleParser syntax(m_csDA); + CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) { csColor += (CFX_ByteString)syntax.GetWord(); csColor += " "; @@ -174,25 +174,25 @@ void CPDF_DefaultAppearance::GetColor(int& iColorType, if (m_csDA.IsEmpty()) { return; } - CPDF_SimpleParser syntax(m_csDA); + CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) { iColorType = COLORTYPE_GRAY; - fc[0] = FX_atof((CFX_ByteString)syntax.GetWord()); + fc[0] = FX_atof(syntax.GetWord()); return; } if (syntax.FindTagParamFromStart(bStrokingOperation ? "RG" : "rg", 3)) { iColorType = COLORTYPE_RGB; - fc[0] = FX_atof((CFX_ByteString)syntax.GetWord()); - fc[1] = FX_atof((CFX_ByteString)syntax.GetWord()); - fc[2] = FX_atof((CFX_ByteString)syntax.GetWord()); + fc[0] = FX_atof(syntax.GetWord()); + fc[1] = FX_atof(syntax.GetWord()); + fc[2] = FX_atof(syntax.GetWord()); return; } if (syntax.FindTagParamFromStart(bStrokingOperation ? "K" : "k", 4)) { iColorType = COLORTYPE_CMYK; - fc[0] = FX_atof((CFX_ByteString)syntax.GetWord()); - fc[1] = FX_atof((CFX_ByteString)syntax.GetWord()); - fc[2] = FX_atof((CFX_ByteString)syntax.GetWord()); - fc[3] = FX_atof((CFX_ByteString)syntax.GetWord()); + fc[0] = FX_atof(syntax.GetWord()); + fc[1] = FX_atof(syntax.GetWord()); + fc[2] = FX_atof(syntax.GetWord()); + fc[3] = FX_atof(syntax.GetWord()); } } void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, @@ -203,27 +203,27 @@ void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, if (m_csDA.IsEmpty()) { return; } - CPDF_SimpleParser syntax(m_csDA); + CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) { iColorType = COLORTYPE_GRAY; - FX_FLOAT g = FX_atof((CFX_ByteString)syntax.GetWord()) * 255 + 0.5f; + FX_FLOAT g = FX_atof(syntax.GetWord()) * 255 + 0.5f; color = ArgbEncode(255, (int)g, (int)g, (int)g); return; } if (syntax.FindTagParamFromStart(bStrokingOperation ? "RG" : "rg", 3)) { iColorType = COLORTYPE_RGB; - FX_FLOAT r = FX_atof((CFX_ByteString)syntax.GetWord()) * 255 + 0.5f; - FX_FLOAT g = FX_atof((CFX_ByteString)syntax.GetWord()) * 255 + 0.5f; - FX_FLOAT b = FX_atof((CFX_ByteString)syntax.GetWord()) * 255 + 0.5f; + FX_FLOAT r = FX_atof(syntax.GetWord()) * 255 + 0.5f; + FX_FLOAT g = FX_atof(syntax.GetWord()) * 255 + 0.5f; + FX_FLOAT b = FX_atof(syntax.GetWord()) * 255 + 0.5f; color = ArgbEncode(255, (int)r, (int)g, (int)b); return; } if (syntax.FindTagParamFromStart(bStrokingOperation ? "K" : "k", 4)) { iColorType = COLORTYPE_CMYK; - FX_FLOAT c = FX_atof((CFX_ByteString)syntax.GetWord()); - FX_FLOAT m = FX_atof((CFX_ByteString)syntax.GetWord()); - FX_FLOAT y = FX_atof((CFX_ByteString)syntax.GetWord()); - FX_FLOAT k = FX_atof((CFX_ByteString)syntax.GetWord()); + FX_FLOAT c = FX_atof(syntax.GetWord()); + FX_FLOAT m = FX_atof(syntax.GetWord()); + FX_FLOAT y = FX_atof(syntax.GetWord()); + FX_FLOAT k = FX_atof(syntax.GetWord()); FX_FLOAT r = 1.0f - std::min(1.0f, c + k); FX_FLOAT g = 1.0f - std::min(1.0f, m + k); FX_FLOAT b = 1.0f - std::min(1.0f, y + k); @@ -235,7 +235,7 @@ FX_BOOL CPDF_DefaultAppearance::HasTextMatrix() { if (m_csDA.IsEmpty()) { return FALSE; } - CPDF_SimpleParser syntax(m_csDA); + CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); return syntax.FindTagParamFromStart("Tm", 6); } CFX_ByteString CPDF_DefaultAppearance::GetTextMatrixString() { @@ -243,7 +243,7 @@ CFX_ByteString CPDF_DefaultAppearance::GetTextMatrixString() { if (m_csDA.IsEmpty()) { return csTM; } - CPDF_SimpleParser syntax(m_csDA); + CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); if (syntax.FindTagParamFromStart("Tm", 6)) { for (int i = 0; i < 6; i++) { csTM += (CFX_ByteString)syntax.GetWord(); @@ -258,11 +258,11 @@ CFX_Matrix CPDF_DefaultAppearance::GetTextMatrix() { if (m_csDA.IsEmpty()) { return tm; } - CPDF_SimpleParser syntax(m_csDA); + CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); if (syntax.FindTagParamFromStart("Tm", 6)) { FX_FLOAT f[6]; for (int i = 0; i < 6; i++) { - f[i] = FX_atof((CFX_ByteString)syntax.GetWord()); + f[i] = FX_atof(syntax.GetWord()); } tm.Set(f[0], f[1], f[2], f[3], f[4], f[5]); } @@ -387,7 +387,7 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, if (!pFonts) { return NULL; } - CPDF_Dictionary* pElement = pFonts->GetDictBy(csAlias); + CPDF_Dictionary* pElement = pFonts->GetDictBy(csAlias.AsByteStringC()); if (!pElement) { return NULL; } @@ -606,7 +606,8 @@ void AddInterFormFont(CPDF_Dictionary*& pFormDict, csNameTag.Remove(' '); csNameTag = CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4, csNameTag); - pFonts->SetAtReference(csNameTag, pDocument, pFont->GetFontDict()); + pFonts->SetAtReference(csNameTag.AsByteStringC(), pDocument, + pFont->GetFontDict()); } CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, @@ -650,7 +651,7 @@ void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont) { } CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); - pFonts->RemoveAt(csTag); + pFonts->RemoveAt(csTag.AsByteStringC()); } void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) { if (!pFormDict || csNameTag.IsEmpty()) { @@ -664,7 +665,7 @@ void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) { if (!pFonts) { return; } - pFonts->RemoveAt(csNameTag); + pFonts->RemoveAt(csNameTag.AsByteStringC()); } CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict, |