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

Unified Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

Issue 1544963002: Clean up misc nits found while fixing bugs. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 11 months 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
Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 010b9b7c47213306e2d0d0a6ef1e50dbbd5cf9e5..ad97d1f3696de7929a92287c5e98990606791175 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;
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698