diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-14 16:58:33 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-14 16:58:33 -0800 |
commit | d983b09c3ae29a97cba8e9ec9c6351545f6087ee (patch) | |
tree | 5641a4bc6eddaa8069904c29c3e3897043411646 /core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp | |
parent | f86d3f946e2f1977c7eaea01dcb9d7ecb3064cd1 (diff) | |
download | pdfium-d983b09c3ae29a97cba8e9ec9c6351545f6087ee.tar.xz |
Merge to XFA: Remove FX_BSTRC.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1521563002 .
(cherry picked from commit 1956a174020686f91cd3b34294e91f4560fe45aa)
Review URL: https://codereview.chromium.org/1526823002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp')
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp index 2e38837137..2d7c4b0eec 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp @@ -69,16 +69,16 @@ void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) { m_ID2 = pIDArray->GetString(1); } FX_DWORD dwPageCount = 0; - CPDF_Object* pCount = pLinearized->GetElement(FX_BSTRC("N")); + CPDF_Object* pCount = pLinearized->GetElement("N"); if (ToNumber(pCount)) dwPageCount = pCount->GetInteger(); m_PageList.SetSize(dwPageCount); - CPDF_Object* pNo = pLinearized->GetElement(FX_BSTRC("P")); + CPDF_Object* pNo = pLinearized->GetElement("P"); if (ToNumber(pNo)) m_dwFirstPageNo = pNo->GetInteger(); - CPDF_Object* pObjNum = pLinearized->GetElement(FX_BSTRC("O")); + CPDF_Object* pObjNum = pLinearized->GetElement("O"); if (ToNumber(pObjNum)) m_dwFirstPageObjNum = pObjNum->GetInteger(); } @@ -99,7 +99,7 @@ CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages, int iPage, int nPagesToGo, int level) { - CPDF_Array* pKidList = pPages->GetArray(FX_BSTRC("Kids")); + CPDF_Array* pKidList = pPages->GetArray("Kids"); if (pKidList == NULL) { if (nPagesToGo == 0) { return pPages; @@ -119,14 +119,14 @@ CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages, if (pKid == pPages) { continue; } - if (!pKid->KeyExist(FX_BSTRC("Kids"))) { + if (!pKid->KeyExist("Kids")) { if (nPagesToGo == 0) { return pKid; } m_PageList.SetAt(iPage - nPagesToGo, pKid->GetObjNum()); nPagesToGo--; } else { - int nPages = pKid->GetInteger(FX_BSTRC("Count")); + int nPages = pKid->GetInteger("Count"); if (nPagesToGo < nPages) { return _FindPDFPage(pKid, iPage, nPagesToGo, level + 1); } @@ -156,7 +156,7 @@ CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { if (!pRoot) return nullptr; - CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages")); + CPDF_Dictionary* pPages = pRoot->GetDict("Pages"); if (!pPages) return nullptr; @@ -173,15 +173,15 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode, FX_DWORD objnum, int& index, int level) { - if (pNode->KeyExist(FX_BSTRC("Kids"))) { - CPDF_Array* pKidList = pNode->GetArray(FX_BSTRC("Kids")); + if (pNode->KeyExist("Kids")) { + CPDF_Array* pKidList = pNode->GetArray("Kids"); if (pKidList == NULL) { return -1; } if (level >= FX_MAX_PAGE_LEVEL) { return -1; } - FX_DWORD count = pNode->GetInteger(FX_BSTRC("Count")); + FX_DWORD count = pNode->GetInteger("Count"); if (count <= skip_count) { skip_count -= count; index += count; @@ -240,7 +240,7 @@ int CPDF_Document::GetPageIndex(FX_DWORD objnum) { if (pRoot == NULL) { return -1; } - CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages")); + CPDF_Dictionary* pPages = pRoot->GetDict("Pages"); if (pPages == NULL) { return -1; } @@ -254,11 +254,11 @@ static int _CountPages(CPDF_Dictionary* pPages, int level) { if (level > 128) { return 0; } - int count = pPages->GetInteger(FX_BSTRC("Count")); + int count = pPages->GetInteger("Count"); if (count > 0 && count < FPDF_PAGE_MAX_NUM) { return count; } - CPDF_Array* pKidList = pPages->GetArray(FX_BSTRC("Kids")); + CPDF_Array* pKidList = pPages->GetArray("Kids"); if (pKidList == NULL) { return 0; } @@ -268,13 +268,13 @@ static int _CountPages(CPDF_Dictionary* pPages, int level) { if (pKid == NULL) { continue; } - if (!pKid->KeyExist(FX_BSTRC("Kids"))) { + if (!pKid->KeyExist("Kids")) { count++; } else { count += _CountPages(pKid, level + 1); } } - pPages->SetAtInteger(FX_BSTRC("Count"), count); + pPages->SetAtInteger("Count", count); return count; } int CPDF_Document::_GetPageCount() const { @@ -282,11 +282,11 @@ int CPDF_Document::_GetPageCount() const { if (pRoot == NULL) { return 0; } - CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages")); + CPDF_Dictionary* pPages = pRoot->GetDict("Pages"); if (pPages == NULL) { return 0; } - if (!pPages->KeyExist(FX_BSTRC("Kids"))) { + if (!pPages->KeyExist("Kids")) { return 1; } return _CountPages(pPages, 0); @@ -299,7 +299,7 @@ FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum, continue; } CPDF_Object* pContents = - pPageDict ? pPageDict->GetElement(FX_BSTRC("Contents")) : NULL; + pPageDict ? pPageDict->GetElement("Contents") : NULL; if (pContents == NULL) { continue; } @@ -333,9 +333,7 @@ FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const { CPDF_Object* pObj; if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, (void*&)pObj)) { CPDF_Stream* pStream = pObj->AsStream(); - bForm = pStream && - pStream->GetDict()->GetString(FX_BSTRC("Subtype")) == - FX_BSTRC("Form"); + bForm = pStream && pStream->GetDict()->GetString("Subtype") == "Form"; return TRUE; } } |