summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfppo.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-27 12:08:12 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-27 12:08:12 -0700
commit8d2aae7ee320da3a8ffe01c57e38b3f98443257d (patch)
treee694c6f82ec72fa46e6172b4475996b30d3f6a3a /fpdfsdk/src/fpdfppo.cpp
parentff46aaf499edcf153ee2f57c7016587aa96dcfa0 (diff)
downloadpdfium-8d2aae7ee320da3a8ffe01c57e38b3f98443257d.tar.xz
Revert "FX Bool considered harmful, part 3"
This reverts commit ff46aaf499edcf153ee2f57c7016587aa96dcfa0. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255293002 .
Diffstat (limited to 'fpdfsdk/src/fpdfppo.cpp')
-rw-r--r--fpdfsdk/src/fpdfppo.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp
index 1ef69bf032..40d56b304d 100644
--- a/fpdfsdk/src/fpdfppo.cpp
+++ b/fpdfsdk/src/fpdfppo.cpp
@@ -15,14 +15,14 @@ public:
CPDF_PageOrganizer();
~CPDF_PageOrganizer();
- bool PDFDocInit(CPDF_Document* pDestPDFDoc, CPDF_Document* pSrcPDFDoc);
- bool ExportPage(CPDF_Document* pSrcPDFDoc,
+ FX_BOOL PDFDocInit(CPDF_Document* pDestPDFDoc, CPDF_Document* pSrcPDFDoc);
+ FX_BOOL ExportPage(CPDF_Document* pSrcPDFDoc,
CFX_WordArray* nPageNum,
CPDF_Document* pDestPDFDoc,
int nIndex);
CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary* pDict,
CFX_ByteString nSrctag);
- bool UpdateReference(CPDF_Object* pObj,
+ FX_BOOL UpdateReference(CPDF_Object* pObj,
CPDF_Document* pDoc,
ObjectNumberMap* pObjNumberMap);
FX_DWORD GetNewObjId(CPDF_Document* pDoc,
@@ -39,21 +39,21 @@ CPDF_PageOrganizer::~CPDF_PageOrganizer()
{
}
-bool CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
+FX_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;
//Set the document information////////////////////////////////////////////
CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo();
if (!DInfoDict)
- return false;
+ return FALSE;
CFX_ByteString producerstr;
producerstr.Format("PDFium");
@@ -89,10 +89,10 @@ bool CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
pNewPages->SetAt("Count", new CPDF_Number(0));
}
- return true;
+ return TRUE;
}
-bool CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
+FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
CFX_WordArray* nPageNum,
CPDF_Document* pDestPDFDoc,
int nIndex)
@@ -106,7 +106,7 @@ bool CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
CPDF_Dictionary* pSrcPageDict =
pSrcPDFDoc->GetPage(nPageNum->GetAt(i) - 1);
if (!pSrcPageDict || !pCurPageDict)
- return false;
+ return FALSE;
// Clone the page dictionary///////////
FX_POSITION SrcPos = pSrcPageDict->GetStartPos();
@@ -151,7 +151,7 @@ bool CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
if (!pCurPageDict->KeyExist("Resources")) {
pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Resources");
if (!pInheritable)
- return false;
+ return FALSE;
pCurPageDict->SetAt("Resources", pInheritable->Clone());
}
//3 CropBox //Optional
@@ -178,7 +178,7 @@ bool CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
++curpage;
}
- return true;
+ return TRUE;
}
CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(
@@ -220,7 +220,7 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(
return nullptr;
}
-bool CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
+FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
CPDF_Document* pDoc,
ObjectNumberMap* pObjNumberMap)
{
@@ -229,7 +229,7 @@ bool CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
CPDF_Reference* pReference = (CPDF_Reference*)pObj;
FX_DWORD newobjnum = GetNewObjId(pDoc, pObjNumberMap, pReference);
if (newobjnum == 0)
- return false;
+ return FALSE;
pReference->SetRef(pDoc, newobjnum);
break;
}
@@ -249,7 +249,7 @@ bool CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
if (!UpdateReference(pNextObj, pDoc, pObjNumberMap))
pDict->RemoveAt(key);
} else {
- return false;
+ return FALSE;
}
}
break;
@@ -260,9 +260,9 @@ bool CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
for (FX_DWORD i = 0; i < count; ++i) {
CPDF_Object* pNextObj = pArray->GetElement(i);
if (!pNextObj)
- return false;
+ return FALSE;
if (!UpdateReference(pNextObj, pDoc, pObjNumberMap))
- return false;
+ return FALSE;
}
break;
}
@@ -271,9 +271,9 @@ 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;
}
@@ -281,7 +281,7 @@ bool CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
break;
}
- return true;
+ return TRUE;
}
FX_DWORD CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc,
@@ -341,7 +341,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;
@@ -355,23 +355,23 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring,
if (nMid == -1) {
long lPageNum = atol(cbMidRange);
if (lPageNum <= 0 || lPageNum > nCount)
- return false;
+ return FALSE;
pageArray->Add((FX_WORD)lPageNum);
} else {
int nStartPageNum = atol(cbMidRange.Mid(0, nMid));
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));
if (nStartPageNum < 0 ||
nStartPageNum >nEndPageNum ||
nEndPageNum > nCount) {
- return false;
+ return FALSE;
}
for (int i = nStartPageNum; i <= nEndPageNum; ++i) {
pageArray->Add(i);
@@ -380,7 +380,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring,
nStringFrom = nStringTo + 1;
}
}
- return true;
+ return TRUE;
}
DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
@@ -389,14 +389,14 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
int index)
{
if (!dest_doc || !src_doc)
- return false;
+ return FALSE;
CFX_WordArray pageArray;
CPDF_Document* pSrcDoc = (CPDF_Document*)src_doc;
int nCount = pSrcDoc->GetPageCount();
if (pagerange) {
if (!ParserPageRangeString(pagerange,&pageArray,nCount))
- return false;
+ return FALSE;
} else {
for (int i = 1; i <= nCount; ++i) {
pageArray.Add(i);
@@ -421,12 +421,12 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc,
CPDF_Dictionary* pSrcDict = pSrcDoc->GetRoot();
pSrcDict = pSrcDict->GetDict(FX_BSTRC("ViewerPreferences"));;
if (!pSrcDict)
- return false;
+ return FALSE;
CPDF_Document* pDstDoc = (CPDF_Document*)dest_doc;
CPDF_Dictionary* pDstDict = pDstDoc->GetRoot();
if (!pDstDict)
- return false;
- pDstDict->SetAt(FX_BSTRC("ViewerPreferences"), pSrcDict->Clone(true));
- return true;
+ return FALSE;
+ pDstDict->SetAt(FX_BSTRC("ViewerPreferences"), pSrcDict->Clone(TRUE));
+ return TRUE;
}