From c582c0ddfea8ba01c8449ed7841cdb33c12e0a98 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 7 Mar 2016 17:03:30 -0500 Subject: Fix chromium-style errors. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1772543003 . --- core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 104 +++++++++++++++++++++ core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 12 +++ .../fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp | 1 + .../src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 4 +- 4 files changed, 120 insertions(+), 1 deletion(-) (limited to 'core/src/fpdfapi') diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index a9deba665c..a64b5010c4 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -173,6 +173,74 @@ CPDF_Font::~CPDF_Font() { } } +bool CPDF_Font::IsType1Font() const { + return false; +} + +bool CPDF_Font::IsTrueTypeFont() const { + return false; +} + +bool CPDF_Font::IsType3Font() const { + return false; +} + +bool CPDF_Font::IsCIDFont() const { + return false; +} + +const CPDF_Type1Font* CPDF_Font::AsType1Font() const { + return nullptr; +} + +CPDF_Type1Font* CPDF_Font::AsType1Font() { + return nullptr; +} + +const CPDF_TrueTypeFont* CPDF_Font::AsTrueTypeFont() const { + return nullptr; +} + +CPDF_TrueTypeFont* CPDF_Font::AsTrueTypeFont() { + return nullptr; +} + +const CPDF_Type3Font* CPDF_Font::AsType3Font() const { + return nullptr; +} + +CPDF_Type3Font* CPDF_Font::AsType3Font() { + return nullptr; +} + +const CPDF_CIDFont* CPDF_Font::AsCIDFont() const { + return nullptr; +} + +CPDF_CIDFont* CPDF_Font::AsCIDFont() { + return nullptr; +} + +FX_BOOL CPDF_Font::IsUnicodeCompatible() const { + return FALSE; +} + +int CPDF_Font::CountChar(const FX_CHAR* pString, int size) const { + return size; +} + +int CPDF_Font::GetCharSize(FX_DWORD charcode) const { + return 1; +} + +int CPDF_Font::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) { + ASSERT(false); +} + +int CPDF_Font::GlyphFromCharCodeExt(FX_DWORD charcode) { + return GlyphFromCharCode(charcode); +} + FX_BOOL CPDF_Font::IsVertWriting() const { FX_BOOL bVertWriting = FALSE; const CPDF_CIDFont* pCIDFont = AsCIDFont(); @@ -962,6 +1030,18 @@ FX_DWORD CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const { CPDF_Type1Font::CPDF_Type1Font() : m_Base14Font(-1) {} +bool CPDF_Type1Font::IsType1Font() const { + return true; +} + +const CPDF_Type1Font* CPDF_Type1Font::AsType1Font() const { + return this; +} + +CPDF_Type1Font* CPDF_Type1Font::AsType1Font() { + return this; +} + FX_BOOL CPDF_Type1Font::Load() { m_Base14Font = PDF_GetStandardFontName(&m_BaseFont); if (m_Base14Font >= 0) { @@ -1360,6 +1440,18 @@ CPDF_Object* CPDF_FontEncoding::Realize() { CPDF_TrueTypeFont::CPDF_TrueTypeFont() {} +bool CPDF_TrueTypeFont::IsTrueTypeFont() const { + return true; +} + +const CPDF_TrueTypeFont* CPDF_TrueTypeFont::AsTrueTypeFont() const { + return this; +} + +CPDF_TrueTypeFont* CPDF_TrueTypeFont::AsTrueTypeFont() { + return this; +} + FX_BOOL CPDF_TrueTypeFont::Load() { return LoadCommon(); } @@ -1572,6 +1664,18 @@ CPDF_Type3Font::~CPDF_Type3Font() { delete it.second; } +bool CPDF_Type3Font::IsType3Font() const { + return true; +} + +const CPDF_Type3Font* CPDF_Type3Font::AsType3Font() const { + return this; +} + +CPDF_Type3Font* CPDF_Type3Font::AsType3Font() { + return this; +} + FX_BOOL CPDF_Type3Font::Load() { m_pFontResources = m_pFontDict->GetDictBy("Resources"); CPDF_Array* pMatrix = m_pFontDict->GetArrayBy("FontMatrix"); diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 7c85b8213d..38406394c4 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -1068,6 +1068,18 @@ CPDF_CIDFont::~CPDF_CIDFont() { delete m_pTTGSUBTable; } +bool CPDF_CIDFont::IsCIDFont() const { + return true; +} + +const CPDF_CIDFont* CPDF_CIDFont::AsCIDFont() const { + return this; +} + +CPDF_CIDFont* CPDF_CIDFont::AsCIDFont() { + return this; +} + FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const { if (!m_pCMap) { return (FX_WORD)charcode; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp index 799e748761..95907ae8fd 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp @@ -56,6 +56,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FXSYS_memset(key, 0, keylen); FXSYS_memcpy(key, digest, copy_len); } + CPDF_CryptoHandler* CPDF_StandardSecurityHandler::CreateCryptoHandler() { return new CPDF_StandardCryptoHandler; } diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index 737bbe49be..e18775e54b 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -4144,7 +4144,7 @@ FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode& pageNodes, continue; switch (pNode->m_type) { - case PDF_PAGENODE_UNKOWN: + case PDF_PAGENODE_UNKNOWN: if (!CheckUnkownPageNode(pNode->m_dwPageNo, pNode, pHints)) { return FALSE; } @@ -4586,6 +4586,8 @@ IPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail( return FormAvailable; } +CPDF_PageNode::CPDF_PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} + CPDF_PageNode::~CPDF_PageNode() { for (int32_t i = 0; i < m_childNode.GetSize(); ++i) delete m_childNode[i]; -- cgit v1.2.3