Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: fpdfsdk/fpdfppo.cpp

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/fpdfformfill.cpp ('k') | fpdfsdk/fpdfsave.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfppo.cpp
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp
index f41f904e174bf80c3e17cb252880f2d4bc68dd51..22b23d1db1e5e454e76a942803428aac187f0b60 100644
--- a/fpdfsdk/fpdfppo.cpp
+++ b/fpdfsdk/fpdfppo.cpp
@@ -26,16 +26,16 @@ class CPDF_PageOrganizer {
CPDF_PageOrganizer();
~CPDF_PageOrganizer();
- FX_BOOL PDFDocInit(CPDF_Document* pDestPDFDoc, CPDF_Document* pSrcPDFDoc);
- FX_BOOL ExportPage(CPDF_Document* pSrcPDFDoc,
- std::vector<uint16_t>* pPageNums,
- CPDF_Document* pDestPDFDoc,
- int nIndex);
+ bool PDFDocInit(CPDF_Document* pDestPDFDoc, CPDF_Document* pSrcPDFDoc);
+ bool ExportPage(CPDF_Document* pSrcPDFDoc,
+ std::vector<uint16_t>* pPageNums,
+ CPDF_Document* pDestPDFDoc,
+ int nIndex);
CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary* pDict,
const CFX_ByteString& bsSrctag);
- FX_BOOL UpdateReference(CPDF_Object* pObj,
- CPDF_Document* pDoc,
- ObjectNumberMap* pObjNumberMap);
+ bool UpdateReference(CPDF_Object* pObj,
+ CPDF_Document* pDoc,
+ ObjectNumberMap* pObjNumberMap);
uint32_t GetNewObjId(CPDF_Document* pDoc,
ObjectNumberMap* pObjNumberMap,
CPDF_Reference* pRef);
@@ -45,22 +45,22 @@ CPDF_PageOrganizer::CPDF_PageOrganizer() {}
CPDF_PageOrganizer::~CPDF_PageOrganizer() {}
-FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
- CPDF_Document* pSrcPDFDoc) {
+bool CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
+ CPDF_Document* pSrcPDFDoc) {
if (!pDestPDFDoc || !pSrcPDFDoc)
- return FALSE;
+ return false;
CPDF_Dictionary* pNewRoot = pDestPDFDoc->GetRoot();
if (!pNewRoot)
- return FALSE;
+ return false;
CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo();
if (!DInfoDict)
- return FALSE;
+ return false;
CFX_ByteString producerstr;
producerstr.Format("PDFium");
- DInfoDict->SetFor("Producer", new CPDF_String(producerstr, FALSE));
+ DInfoDict->SetFor("Producer", new CPDF_String(producerstr, false));
CFX_ByteString cbRootType = pNewRoot->GetStringFor("Type", "");
if (cbRootType.IsEmpty())
@@ -86,13 +86,13 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
pDestPDFDoc->AddIndirectObject(new CPDF_Array));
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
- std::vector<uint16_t>* pPageNums,
- CPDF_Document* pDestPDFDoc,
- int nIndex) {
+bool CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
+ std::vector<uint16_t>* pPageNums,
+ CPDF_Document* pDestPDFDoc,
+ int nIndex) {
int curpage = nIndex;
std::unique_ptr<ObjectNumberMap> pObjNumberMap(new ObjectNumberMap);
int nSize = pdfium::CollectionSize<int>(*pPageNums);
@@ -100,7 +100,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
CPDF_Dictionary* pCurPageDict = pDestPDFDoc->CreateNewPage(curpage);
CPDF_Dictionary* pSrcPageDict = pSrcPDFDoc->GetPage(pPageNums->at(i) - 1);
if (!pSrcPageDict || !pCurPageDict)
- return FALSE;
+ return false;
// Clone the page dictionary
for (const auto& it : *pSrcPageDict) {
@@ -141,7 +141,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
if (!pCurPageDict->KeyExist("Resources")) {
pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Resources");
if (!pInheritable)
- return FALSE;
+ return false;
pCurPageDict->SetFor("Resources", pInheritable->Clone());
}
// 3 CropBox //Optional
@@ -167,7 +167,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
++curpage;
}
- return TRUE;
+ return true;
}
CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(
@@ -202,15 +202,15 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(
return nullptr;
}
-FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
- CPDF_Document* pDoc,
- ObjectNumberMap* pObjNumberMap) {
+bool CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
+ CPDF_Document* pDoc,
+ ObjectNumberMap* pObjNumberMap) {
switch (pObj->GetType()) {
case CPDF_Object::REFERENCE: {
CPDF_Reference* pReference = pObj->AsReference();
uint32_t newobjnum = GetNewObjId(pDoc, pObjNumberMap, pReference);
if (newobjnum == 0)
- return FALSE;
+ return false;
pReference->SetRef(pDoc, newobjnum);
break;
}
@@ -224,7 +224,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
if (key == "Parent" || key == "Prev" || key == "First")
continue;
if (!pNextObj)
- return FALSE;
+ return false;
if (!UpdateReference(pNextObj, pDoc, pObjNumberMap))
pDict->RemoveFor(key);
}
@@ -235,9 +235,9 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
for (size_t i = 0; i < pArray->GetCount(); ++i) {
CPDF_Object* pNextObj = pArray->GetObjectAt(i);
if (!pNextObj)
- return FALSE;
+ return false;
if (!UpdateReference(pNextObj, pDoc, pObjNumberMap))
- return FALSE;
+ return false;
}
break;
}
@@ -246,9 +246,9 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
CPDF_Dictionary* pDict = pStream->GetDict();
if (pDict) {
if (!UpdateReference(pDict, pDoc, pObjNumberMap))
- return FALSE;
+ return false;
} else {
- return FALSE;
+ return false;
}
break;
}
@@ -256,7 +256,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
break;
}
- return TRUE;
+ return true;
}
uint32_t CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc,
@@ -312,7 +312,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring,
CFX_ByteString cbCompareString("0123456789-,");
for (int i = 0; i < nLength; ++i) {
if (cbCompareString.Find(rangstring[i]) == -1)
- return FALSE;
+ return false;
}
CFX_ByteString cbMidRange;
int nStringFrom = 0;
@@ -326,22 +326,22 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring,
if (nMid == -1) {
long lPageNum = atol(cbMidRange.c_str());
if (lPageNum <= 0 || lPageNum > nCount)
- return FALSE;
+ return false;
pageArray->push_back((uint16_t)lPageNum);
} else {
int nStartPageNum = atol(cbMidRange.Mid(0, nMid).c_str());
if (nStartPageNum == 0)
- return FALSE;
+ return false;
++nMid;
int nEnd = cbMidRange.GetLength() - nMid;
if (nEnd == 0)
- return FALSE;
+ return false;
int nEndPageNum = atol(cbMidRange.Mid(nMid, nEnd).c_str());
if (nStartPageNum < 0 || nStartPageNum > nEndPageNum ||
nEndPageNum > nCount) {
- return FALSE;
+ return false;
}
for (int i = nStartPageNum; i <= nEndPageNum; ++i) {
pageArray->push_back(i);
@@ -350,7 +350,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring,
nStringFrom = nStringTo + 1;
}
}
- return TRUE;
+ return true;
}
DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
@@ -359,17 +359,17 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
int index) {
CPDF_Document* pDestDoc = CPDFDocumentFromFPDFDocument(dest_doc);
if (!dest_doc)
- return FALSE;
+ return false;
CPDF_Document* pSrcDoc = CPDFDocumentFromFPDFDocument(src_doc);
if (!pSrcDoc)
- return FALSE;
+ return false;
std::vector<uint16_t> pageArray;
int nCount = pSrcDoc->GetPageCount();
if (pagerange) {
if (!ParserPageRangeString(pagerange, &pageArray, nCount))
- return FALSE;
+ return false;
} else {
for (int i = 1; i <= nCount; ++i) {
pageArray.push_back(i);
@@ -385,21 +385,21 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc,
FPDF_DOCUMENT src_doc) {
CPDF_Document* pDstDoc = CPDFDocumentFromFPDFDocument(dest_doc);
if (!pDstDoc)
- return FALSE;
+ return false;
CPDF_Document* pSrcDoc = CPDFDocumentFromFPDFDocument(src_doc);
if (!pSrcDoc)
- return FALSE;
+ return false;
CPDF_Dictionary* pSrcDict = pSrcDoc->GetRoot();
pSrcDict = pSrcDict->GetDictFor("ViewerPreferences");
if (!pSrcDict)
- return FALSE;
+ return false;
CPDF_Dictionary* pDstDict = pDstDoc->GetRoot();
if (!pDstDict)
- return FALSE;
+ return false;
pDstDict->SetFor("ViewerPreferences", pSrcDict->CloneDirectObject());
- return TRUE;
+ return true;
}
« no previous file with comments | « fpdfsdk/fpdfformfill.cpp ('k') | fpdfsdk/fpdfsave.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698