diff options
author | Artem Strygin <art-snake@yandex-team.ru> | 2017-08-23 16:55:41 +0300 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-23 14:33:20 +0000 |
commit | 1d3696d091bd0485de55daedb000cef87fa35aae (patch) | |
tree | aab4974d8305c46258eb211ec2e4ec28a40282e7 /core/fpdfapi/parser | |
parent | f9161c6f2bee8593dd8b352c47496bf3f6faa0df (diff) | |
download | pdfium-1d3696d091bd0485de55daedb000cef87fa35aae.tar.xz |
Remove useless code.
Change-Id: Ie1fa04cdcdd426cf76413e7e5fe714ba7922458c
Reviewed-on: https://pdfium-review.googlesource.com/11713
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.cpp | 63 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.h | 3 |
2 files changed, 0 insertions, 66 deletions
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index d298fb7249..24ba2e28b1 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -275,8 +275,6 @@ bool CPDF_DataAvail::CheckDocStatus(DownloadHints* pHints) { return CheckCrossRef(pHints); case PDF_DATAAVAIL_CROSSREF_ITEM: return CheckCrossRefItem(); - case PDF_DATAAVAIL_CROSSREF_STREAM: - return CheckAllCrossRefStream(pHints); case PDF_DATAAVAIL_TRAILER: return CheckTrailer(pHints); case PDF_DATAAVAIL_TRAILER_APPEND: @@ -782,49 +780,6 @@ bool CPDF_DataAvail::CheckEnd() { return true; } -int32_t CPDF_DataAvail::CheckCrossRefStream(DownloadHints* pHints, - FX_FILESIZE& xref_offset) { - xref_offset = 0; - uint32_t req_size = - (uint32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); - - if (!m_pFileAvail->IsDataAvail(m_Pos, req_size)) { - pHints->AddSegment(m_Pos, req_size); - return 0; - } - - int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam); - std::vector<uint8_t> buf(iSize); - m_pFileRead->ReadBlock(buf.data(), m_dwCurrentXRefSteam, iSize); - - auto file = pdfium::MakeRetain<CFX_MemoryStream>( - buf.data(), static_cast<size_t>(iSize), false); - m_parser.m_pSyntax->InitParser(file, 0); - - bool bNumber; - CFX_ByteString objnum = m_parser.m_pSyntax->GetNextWord(&bNumber); - if (!bNumber) - return -1; - - uint32_t objNum = FXSYS_atoui(objnum.c_str()); - std::unique_ptr<CPDF_Object> pObj = - m_parser.ParseIndirectObjectAt(nullptr, 0, objNum); - - if (!pObj) { - m_Pos += m_parser.m_pSyntax->GetPos(); - return 0; - } - - CPDF_Dictionary* pDict = pObj->GetDict(); - CPDF_Name* pName = ToName(pDict ? pDict->GetObjectFor("Type") : nullptr); - if (pName && pName->GetString() == "XRef") { - m_Pos += m_parser.m_pSyntax->GetPos(); - xref_offset = pObj->GetDict()->GetIntegerFor("Prev"); - return 1; - } - return -1; -} - void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset) { m_Pos = dwOffset; } @@ -949,24 +904,6 @@ bool CPDF_DataAvail::CheckCrossRefItem() { } } -bool CPDF_DataAvail::CheckAllCrossRefStream(DownloadHints* pHints) { - FX_FILESIZE xref_offset = 0; - int32_t nRet = CheckCrossRefStream(pHints, xref_offset); - if (nRet == 1) { - if (xref_offset) { - m_dwCurrentXRefSteam = xref_offset; - m_Pos = xref_offset; - } else { - m_docStatus = PDF_DATAAVAIL_LOADALLCROSSREF; - } - return true; - } - - if (nRet == -1) - m_docStatus = PDF_DATAAVAIL_ERROR; - return false; -} - bool CPDF_DataAvail::CheckCrossRef(DownloadHints* pHints) { int32_t iSize = 0; CFX_ByteString token; diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h index fe7b26b21d..db134dd3f5 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.h +++ b/core/fpdfapi/parser/cpdf_data_avail.h @@ -30,7 +30,6 @@ enum PDF_DATAAVAIL_STATUS { PDF_DATAAVAIL_END, PDF_DATAAVAIL_CROSSREF, PDF_DATAAVAIL_CROSSREF_ITEM, - PDF_DATAAVAIL_CROSSREF_STREAM, PDF_DATAAVAIL_TRAILER, PDF_DATAAVAIL_LOADALLCROSSREF, PDF_DATAAVAIL_ROOT, @@ -146,9 +145,7 @@ class CPDF_DataAvail final { bool CheckAcroFormSubObject(); bool CheckTrailerAppend(DownloadHints* pHints); bool CheckPageStatus(DownloadHints* pHints); - bool CheckAllCrossRefStream(DownloadHints* pHints); - int32_t CheckCrossRefStream(DownloadHints* pHints, FX_FILESIZE& xref_offset); bool IsLinearizedFile(uint8_t* pData, uint32_t dwLen); void SetStartOffset(FX_FILESIZE dwOffset); bool GetNextToken(CFX_ByteString* token); |