summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-01-08 14:24:37 -0800
committerLei Zhang <thestig@chromium.org>2016-01-08 14:24:37 -0800
commit1b97664bc5b84c7a2b87cc656f8c6a0476f9b71f (patch)
tree11c6727d7fa3d2dac36b879c3bbd106326c7ca43 /core/src/fpdfapi/fpdf_parser
parent6a1c51b9eb666f2e120ec098d900663627ebcb3e (diff)
downloadpdfium-1b97664bc5b84c7a2b87cc656f8c6a0476f9b71f.tar.xz
Merge to XFA: Clean up misc nits found while fixing bugs.
Some bits regressed in commit 338805f. Also merge: IWYU fix after commit c5a8933. R=tsepez@chromium.org TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1544963002 . Review URL: https://codereview.chromium.org/1570973002 . (cherry picked from commit c5a8933f260ca1034fde902058442984e55c0f7a) (cherry picked from commit e6bd31873c3dba3f79c5ebbbefed636948629cc9) Review URL: https://codereview.chromium.org/1577453002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp15
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp12
3 files changed, 10 insertions, 21 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index c855a7c5c2..d7783e438b 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -324,9 +324,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
CFX_ByteString& ImageEncoding,
CPDF_Dictionary*& pImageParms,
FX_DWORD last_estimated_size,
- FX_BOOL bImageAcc)
-
-{
+ FX_BOOL bImageAcc) {
CPDF_Object* pDecoder = pDict ? pDict->GetElementValue("Filter") : nullptr;
if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName()))
return FALSE;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 010b9b7c47..ad97d1f369 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -360,13 +360,15 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
if (!m_pTrailer) {
return FALSE;
}
+
int32_t xrefsize = GetDirectInteger(m_pTrailer, "Size");
if (xrefsize <= 0 || xrefsize > kMaxXRefSize) {
return FALSE;
}
m_ObjectInfo[0].pos = 0;
m_V5Type.SetSize(xrefsize);
- CFX_FileSizeArray CrossRefList, XRefStreamList;
+ CFX_FileSizeArray CrossRefList;
+ CFX_FileSizeArray XRefStreamList;
CrossRefList.Add(xrefpos);
XRefStreamList.Add(GetDirectInteger(m_pTrailer, "XRefStm"));
@@ -1416,9 +1418,8 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(CPDF_IndirectObjects* pObjList,
}
m_Syntax.RestorePos(SavedPos);
if (pObj) {
- if (!objnum) {
+ if (!objnum)
pObj->m_ObjNum = parser_objnum;
- }
pObj->m_GenNum = parser_gennum;
}
return pObj;
@@ -1582,8 +1583,9 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess,
if (bLoadV4) {
m_pTrailer = LoadTrailerV4();
if (!m_pTrailer) {
- return FALSE;
+ return PDFPARSE_ERROR_SUCCESS;
}
+
int32_t xrefsize = GetDirectInteger(m_pTrailer, "Size");
if (xrefsize > 0) {
m_ObjectInfo[0].pos = 0;
@@ -2759,7 +2761,6 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
FX_BOOL LoadAllXref(IFX_DownloadHints* pHints);
FX_BOOL LoadAllFile(IFX_DownloadHints* pHints);
int32_t CheckLinearizedData(IFX_DownloadHints* pHints);
- FX_BOOL CheckFileResources(IFX_DownloadHints* pHints);
FX_BOOL CheckPageAnnots(int iPage, IFX_DownloadHints* pHints);
FX_BOOL CheckLinearizedFirstPage(int iPage, IFX_DownloadHints* pHints);
@@ -4296,7 +4297,7 @@ int CPDF_DataAvail::CheckLinearizedData(IFX_DownloadHints* pHints) {
pHints->AddSegment(m_dwLastXRefOffset, data_size.ValueOrDie());
return DataNotAvailable;
}
- FX_DWORD dwRet = (m_pDocument->GetParser())->LoadLinearizedMainXRefTable();
+ FX_DWORD dwRet = m_pDocument->GetParser()->LoadLinearizedMainXRefTable();
m_bMainXRefLoadTried = TRUE;
if (dwRet != PDFPARSE_ERROR_SUCCESS) {
return DataError;
@@ -4929,6 +4930,7 @@ int32_t CPDF_HintTables::CheckPage(int index, IFX_DownloadHints* pHints) {
}
return IPDF_DataAvail::DataAvailable;
}
+
FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
if (!pHintStream || !m_pLinearizedDict)
return FALSE;
@@ -4954,6 +4956,7 @@ FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
ReadSharedObjHintTable(&bs, pdfium::base::checked_cast<FX_DWORD>(
shared_hint_table_offset));
}
+
int CPDF_HintTables::ReadPrimaryHintStreamOffset() const {
if (!m_pLinearizedDict)
return -1;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp
index 3014ca280e..e091f14cbe 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp
@@ -20,18 +20,6 @@ bool CompareArray(const CFX_ArrayTemplate<TYPE>& array1,
return false;
return true;
}
-template bool CompareArray<uint8_t>(const CFX_ByteArray&,
- const uint8_t*,
- size_t);
-template bool CompareArray<FX_WORD>(const CFX_WordArray&,
- const FX_WORD*,
- size_t);
-template bool CompareArray<FX_DWORD>(const CFX_DWordArray&,
- const FX_DWORD*,
- size_t);
-template bool CompareArray<FX_FILESIZE>(const CFX_FileSizeArray&,
- const FX_FILESIZE*,
- size_t);
// Provide a way to read test data from a buffer instead of a file.
class CFX_TestBufferRead : public IFX_FileRead {