diff options
author | tsepez <tsepez@chromium.org> | 2016-11-07 11:46:09 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-07 11:46:09 -0800 |
commit | c09625ca59701fabeb49dc59edcf33031b2c6672 (patch) | |
tree | 6fb3cab934f2df7561ef448a5e8ce1ed7b5bd022 /core | |
parent | 413e3518ce390860cb5560720e5fba3ca7c8f764 (diff) | |
download | pdfium-c09625ca59701fabeb49dc59edcf33031b2c6672.tar.xz |
Rename CPDF_Linearized to CPDF_LinearizedHeader
My OCD insists that classes be named after nouns, and "linearized"
feels like an adjective.
Remove a redundant "if" while at it.
Review-Url: https://codereview.chromium.org/2482973002
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_document_unittest.cpp | 7 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_hint_tables.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_hint_tables.h | 7 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_linearized_header.cpp (renamed from core/fpdfapi/parser/cpdf_linearized.cpp) | 14 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_linearized_header.h (renamed from core/fpdfapi/parser/cpdf_linearized.h) | 14 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.h | 4 |
11 files changed, 35 insertions, 35 deletions
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index e6d2c61ad3..1f43a4bdfe 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -15,7 +15,7 @@ #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_document.h" #include "core/fpdfapi/parser/cpdf_hint_tables.h" -#include "core/fpdfapi/parser/cpdf_linearized.h" +#include "core/fpdfapi/parser/cpdf_linearized_header.h" #include "core/fpdfapi/parser/cpdf_name.h" #include "core/fpdfapi/parser/cpdf_number.h" #include "core/fpdfapi/parser/cpdf_reference.h" @@ -783,7 +783,7 @@ bool CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) { return false; uint32_t objnum = FXSYS_atoui(wordObjNum.c_str()); - m_pLinearized = CPDF_Linearized::CreateForObject(pdfium::WrapUnique( + m_pLinearized = CPDF_LinearizedHeader::CreateForObject(pdfium::WrapUnique( ParseIndirectObjectAt(m_syntaxParser.m_HeaderOffset + 9, objnum))); if (!m_pLinearized || m_pLinearized->GetFileSize() != m_pFileRead->GetSize()) { diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h index bff9f2943b..e4fc7bad8b 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.h +++ b/core/fpdfapi/parser/cpdf_data_avail.h @@ -16,7 +16,7 @@ class CPDF_Dictionary; class CPDF_HintTables; class CPDF_IndirectObjectHolder; -class CPDF_Linearized; +class CPDF_LinearizedHeader; class CPDF_Parser; enum PDF_DATAAVAIL_STATUS { @@ -200,7 +200,7 @@ class CPDF_DataAvail final { CPDF_Object* m_pRoot; uint32_t m_dwRootObjNum; uint32_t m_dwInfoObjNum; - std::unique_ptr<CPDF_Linearized> m_pLinearized; + std::unique_ptr<CPDF_LinearizedHeader> m_pLinearized; CPDF_Object* m_pTrailer; bool m_bDocAvail; FX_FILESIZE m_dwHeaderOffset; diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index d9ffc0b28a..eb2ab554c7 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -17,7 +17,7 @@ #include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" -#include "core/fpdfapi/parser/cpdf_linearized.h" +#include "core/fpdfapi/parser/cpdf_linearized_header.h" #include "core/fpdfapi/parser/cpdf_number.h" #include "core/fpdfapi/parser/cpdf_parser.h" #include "core/fpdfapi/parser/cpdf_reference.h" @@ -380,7 +380,7 @@ void CPDF_Document::LoadDoc() { } void CPDF_Document::LoadLinearizedDoc( - const CPDF_Linearized* pLinearizationParams) { + const CPDF_LinearizedHeader* pLinearizationParams) { m_bLinearized = true; LoadDocInternal(); m_PageList.SetSize(pLinearizationParams->GetPageCount()); diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h index 1b18015200..cf1bcae6b5 100644 --- a/core/fpdfapi/parser/cpdf_document.h +++ b/core/fpdfapi/parser/cpdf_document.h @@ -26,7 +26,7 @@ class CPDF_Font; class CPDF_FontEncoding; class CPDF_IccProfile; class CPDF_Image; -class CPDF_Linearized; +class CPDF_LinearizedHeader; class CPDF_Parser; class CPDF_Pattern; class CPDF_StreamAcc; @@ -86,7 +86,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder { CPDF_IccProfile* LoadIccProfile(CPDF_Stream* pStream); void LoadDoc(); - void LoadLinearizedDoc(const CPDF_Linearized* pLinearizationParams); + void LoadLinearizedDoc(const CPDF_LinearizedHeader* pLinearizationParams); void LoadPages(); void CreateNewDoc(); diff --git a/core/fpdfapi/parser/cpdf_document_unittest.cpp b/core/fpdfapi/parser/cpdf_document_unittest.cpp index e20a5a1d1d..7b5ab43b5c 100644 --- a/core/fpdfapi/parser/cpdf_document_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_document_unittest.cpp @@ -9,7 +9,7 @@ #include "core/fpdfapi/cpdf_modulemgr.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" -#include "core/fpdfapi/parser/cpdf_linearized.h" +#include "core/fpdfapi/parser/cpdf_linearized_header.h" #include "core/fpdfapi/parser/cpdf_parser.h" #include "core/fxcrt/fx_memory.h" #include "testing/gtest/include/gtest/gtest.h" @@ -76,9 +76,10 @@ class CPDF_TestDocumentForPages : public CPDF_Document { std::unique_ptr<CPDF_Dictionary> m_pOwnedRootDict; }; -class TestLinearized : public CPDF_Linearized { +class TestLinearized : public CPDF_LinearizedHeader { public: - explicit TestLinearized(CPDF_Dictionary* dict) : CPDF_Linearized(dict) {} + explicit TestLinearized(CPDF_Dictionary* dict) + : CPDF_LinearizedHeader(dict) {} }; } // namespace diff --git a/core/fpdfapi/parser/cpdf_hint_tables.cpp b/core/fpdfapi/parser/cpdf_hint_tables.cpp index bbc57dace9..5c0f2a7fbe 100644 --- a/core/fpdfapi/parser/cpdf_hint_tables.cpp +++ b/core/fpdfapi/parser/cpdf_hint_tables.cpp @@ -12,7 +12,7 @@ #include "core/fpdfapi/parser/cpdf_data_avail.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_document.h" -#include "core/fpdfapi/parser/cpdf_linearized.h" +#include "core/fpdfapi/parser/cpdf_linearized_header.h" #include "core/fpdfapi/parser/cpdf_stream.h" #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fxcrt/fx_safe_types.h" @@ -35,7 +35,7 @@ bool IsValidPageOffsetHintTableBitCount(uint32_t bits) { } // namespace CPDF_HintTables::CPDF_HintTables(CPDF_DataAvail* pDataAvail, - CPDF_Linearized* pLinearized) + CPDF_LinearizedHeader* pLinearized) : m_pDataAvail(pDataAvail), m_pLinearized(pLinearized), m_nFirstPageSharedObjs(0), diff --git a/core/fpdfapi/parser/cpdf_hint_tables.h b/core/fpdfapi/parser/cpdf_hint_tables.h index 68b5059b05..e0bc6e0751 100644 --- a/core/fpdfapi/parser/cpdf_hint_tables.h +++ b/core/fpdfapi/parser/cpdf_hint_tables.h @@ -14,12 +14,13 @@ #include "core/fxcrt/fx_stream.h" class CFX_BitStream; -class CPDF_Linearized; +class CPDF_LinearizedHeader; class CPDF_Stream; class CPDF_HintTables { public: - CPDF_HintTables(CPDF_DataAvail* pDataAvail, CPDF_Linearized* pLinearized); + CPDF_HintTables(CPDF_DataAvail* pDataAvail, + CPDF_LinearizedHeader* pLinearized); virtual ~CPDF_HintTables(); bool GetPagePos(uint32_t index, @@ -53,7 +54,7 @@ class CPDF_HintTables { CPDF_DataAvail* const m_pDataAvail; // Owned by |m_pDataAvail|. - CPDF_Linearized* const m_pLinearized; + CPDF_LinearizedHeader* const m_pLinearized; uint32_t m_nFirstPageSharedObjs; FX_FILESIZE m_szFirstPageObjOffset; diff --git a/core/fpdfapi/parser/cpdf_linearized.cpp b/core/fpdfapi/parser/cpdf_linearized_header.cpp index ec57f100cb..9ecc051f8a 100644 --- a/core/fpdfapi/parser/cpdf_linearized.cpp +++ b/core/fpdfapi/parser/cpdf_linearized_header.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/parser/cpdf_linearized.h" +#include "core/fpdfapi/parser/cpdf_linearized_header.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" @@ -32,7 +32,7 @@ bool IsValidNumericDictionaryValue(const CPDF_Dictionary* pDict, } // namespace // static -std::unique_ptr<CPDF_Linearized> CPDF_Linearized::CreateForObject( +std::unique_ptr<CPDF_LinearizedHeader> CPDF_LinearizedHeader::CreateForObject( std::unique_ptr<CPDF_Object> pObj) { auto pDict = ToDictionary(std::move(pObj)); if (!pDict || !pDict->KeyExist("Linearized") || @@ -43,12 +43,10 @@ std::unique_ptr<CPDF_Linearized> CPDF_Linearized::CreateForObject( !IsValidNumericDictionaryValue<FX_FILESIZE>(pDict.get(), "E", 1) || !IsValidNumericDictionaryValue<uint32_t>(pDict.get(), "O", 1)) return nullptr; - return pdfium::WrapUnique(new CPDF_Linearized(pDict.get())); + return pdfium::WrapUnique(new CPDF_LinearizedHeader(pDict.get())); } -CPDF_Linearized::CPDF_Linearized(const CPDF_Dictionary* pDict) { - if (!pDict) - return; +CPDF_LinearizedHeader::CPDF_LinearizedHeader(const CPDF_Dictionary* pDict) { m_szFileSize = pDict->GetIntegerFor("L"); m_dwFirstPageNo = pDict->GetIntegerFor("P"); m_szLastXRefOffset = pDict->GetIntegerFor("T"); @@ -64,8 +62,8 @@ CPDF_Linearized::CPDF_Linearized(const CPDF_Dictionary* pDict) { } } -CPDF_Linearized::~CPDF_Linearized() {} +CPDF_LinearizedHeader::~CPDF_LinearizedHeader() {} -bool CPDF_Linearized::HasHintTable() const { +bool CPDF_LinearizedHeader::HasHintTable() const { return GetPageCount() > 1 && GetHintStart() > 0 && GetHintLength() > 0; } diff --git a/core/fpdfapi/parser/cpdf_linearized.h b/core/fpdfapi/parser/cpdf_linearized_header.h index caf538e3fe..0d6d725f00 100644 --- a/core/fpdfapi/parser/cpdf_linearized.h +++ b/core/fpdfapi/parser/cpdf_linearized_header.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef CORE_FPDFAPI_PARSER_CPDF_LINEARIZED_H_ -#define CORE_FPDFAPI_PARSER_CPDF_LINEARIZED_H_ +#ifndef CORE_FPDFAPI_PARSER_CPDF_LINEARIZED_HEADER_H_ +#define CORE_FPDFAPI_PARSER_CPDF_LINEARIZED_HEADER_H_ #include <memory> @@ -15,10 +15,10 @@ class CPDF_Dictionary; class CPDF_Object; -class CPDF_Linearized { +class CPDF_LinearizedHeader { public: - ~CPDF_Linearized(); - static std::unique_ptr<CPDF_Linearized> CreateForObject( + ~CPDF_LinearizedHeader(); + static std::unique_ptr<CPDF_LinearizedHeader> CreateForObject( std::unique_ptr<CPDF_Object> pObj); // Will only return values > 0. @@ -39,7 +39,7 @@ class CPDF_Linearized { FX_FILESIZE GetHintLength() const { return m_szHintLength; } protected: - explicit CPDF_Linearized(const CPDF_Dictionary* pDict); + explicit CPDF_LinearizedHeader(const CPDF_Dictionary* pDict); private: FX_FILESIZE m_szFileSize = 0; @@ -52,4 +52,4 @@ class CPDF_Linearized { FX_FILESIZE m_szHintLength = 0; }; -#endif // CORE_FPDFAPI_PARSER_CPDF_LINEARIZED_H_ +#endif // CORE_FPDFAPI_PARSER_CPDF_LINEARIZED_HEADER_H_ diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index 044d12d6ef..74136efbd8 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -12,7 +12,7 @@ #include "core/fpdfapi/parser/cpdf_crypto_handler.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_document.h" -#include "core/fpdfapi/parser/cpdf_linearized.h" +#include "core/fpdfapi/parser/cpdf_linearized_header.h" #include "core/fpdfapi/parser/cpdf_number.h" #include "core/fpdfapi/parser/cpdf_reference.h" #include "core/fpdfapi/parser/cpdf_security_handler.h" @@ -1449,7 +1449,7 @@ bool CPDF_Parser::IsLinearizedFile(IFX_SeekableReadStream* pFileAccess, return false; } - m_pLinearized = CPDF_Linearized::CreateForObject( + m_pLinearized = CPDF_LinearizedHeader::CreateForObject( pdfium::WrapUnique(m_pSyntax->GetObject(nullptr, objnum, gennum, true))); if (!m_pLinearized) return false; diff --git a/core/fpdfapi/parser/cpdf_parser.h b/core/fpdfapi/parser/cpdf_parser.h index b8ce7ab294..faac6c5195 100644 --- a/core/fpdfapi/parser/cpdf_parser.h +++ b/core/fpdfapi/parser/cpdf_parser.h @@ -19,7 +19,7 @@ class CPDF_CryptoHandler; class CPDF_Dictionary; class CPDF_Document; class CPDF_IndirectObjectHolder; -class CPDF_Linearized; +class CPDF_LinearizedHeader; class CPDF_Object; class CPDF_SecurityHandler; class CPDF_StreamAcc; @@ -158,7 +158,7 @@ class CPDF_Parser { std::set<FX_FILESIZE> m_SortedOffset; std::vector<CPDF_Dictionary*> m_Trailers; bool m_bVersionUpdated; - std::unique_ptr<CPDF_Linearized> m_pLinearized; + std::unique_ptr<CPDF_LinearizedHeader> m_pLinearized; uint32_t m_dwXrefStartObjNum; // A map of object numbers to indirect streams. Map owns the streams. |