diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2016-03-08 15:06:12 -0500 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2016-03-08 15:06:12 -0500 |
commit | 68b4a4abb713c97badbba54884a477564d41a139 (patch) | |
tree | 5d658965dd2833c802c7668d48a839a1de3dba49 /core/src | |
parent | 508f92f228e27cb0c549add66c608695c8345170 (diff) | |
download | pdfium-68b4a4abb713c97badbba54884a477564d41a139.tar.xz |
Reland "Fix chromium-style errors."
This reverts commit 594912241cd7d409b5f58a48ccffdc1904d844b2.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1769273002 .
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 104 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 12 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp | 1 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 4 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_buffer.cpp | 4 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_util.cpp | 2 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_stream.cpp | 27 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_main.cpp | 40 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_fontmap.cpp | 17 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_text.cpp | 3 |
10 files changed, 205 insertions, 9 deletions
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]; diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index 9578653019..f623d995c7 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -19,6 +19,8 @@ CFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size) m_pBuffer.reset(FX_Alloc(uint8_t, size)); } +CFX_BinaryBuf::~CFX_BinaryBuf() {} + void CFX_BinaryBuf::Delete(int start_index, int count) { if (!m_pBuffer || start_index < 0 || count < 0 || count > m_DataSize || start_index > m_DataSize - count) { @@ -364,6 +366,8 @@ FX_DWORD CFX_BitStream::GetBits(FX_DWORD nBits) { CFX_FileBufferArchive::CFX_FileBufferArchive() : m_Length(0), m_pFile(nullptr) {} +CFX_FileBufferArchive::~CFX_FileBufferArchive() {} + void CFX_FileBufferArchive::Clear() { m_Length = 0; m_pBuffer.reset(); diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp index 7228af1a8a..2422212d59 100644 --- a/core/src/fxcrt/fx_basic_util.cpp +++ b/core/src/fxcrt/fx_basic_util.cpp @@ -16,6 +16,8 @@ #include <direct.h> #endif +CFX_PrivateData::CFX_PrivateData() {} + CFX_PrivateData::~CFX_PrivateData() { ClearAll(); } diff --git a/core/src/fxcrt/fxcrt_stream.cpp b/core/src/fxcrt/fxcrt_stream.cpp new file mode 100644 index 0000000000..2f50153e9e --- /dev/null +++ b/core/src/fxcrt/fxcrt_stream.cpp @@ -0,0 +1,27 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "core/include/fxcrt/fx_stream.h" + +FX_BOOL IFX_FileWrite::WriteBlock(const void* pData, size_t size) { + return WriteBlock(pData, GetSize(), size); +} + +FX_BOOL IFX_FileRead::IsEOF() { + return FALSE; +} + +FX_FILESIZE IFX_FileRead::GetPosition() { + return 0; +} + +size_t IFX_FileRead::ReadBlock(void* buffer, size_t size) { + return 0; +} + +FX_BOOL IFX_FileStream::WriteBlock(const void* buffer, size_t size) { + return WriteBlock(buffer, GetSize(), size); +} diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index 4922373ec0..ab4c170af5 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -42,6 +42,7 @@ FX_DWORD ArgbEncode(int a, FX_COLORREF rgb) { return FXARGB_MAKE(a, FXSYS_GetRValue(rgb), FXSYS_GetGValue(rgb), FXSYS_GetBValue(rgb)); } + CFX_DIBSource::CFX_DIBSource() { m_bpp = 0; m_AlphaFlag = 0; @@ -50,15 +51,26 @@ CFX_DIBSource::CFX_DIBSource() { m_pPalette = NULL; m_pAlphaMask = NULL; } + CFX_DIBSource::~CFX_DIBSource() { FX_Free(m_pPalette); delete m_pAlphaMask; } + +uint8_t* CFX_DIBSource::GetBuffer() const { + return NULL; +} + +FX_BOOL CFX_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const { + return FALSE; +} + CFX_DIBitmap::CFX_DIBitmap() { m_bExtBuf = FALSE; m_pBuffer = NULL; m_pPalette = NULL; } + #define _MAX_OOM_LIMIT_ 12000000 FX_BOOL CFX_DIBitmap::Create(int width, int height, @@ -113,6 +125,7 @@ FX_BOOL CFX_DIBitmap::Create(int width, } return TRUE; } + FX_BOOL CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) { if (m_pBuffer) { return FALSE; @@ -127,24 +140,34 @@ FX_BOOL CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) { } return TRUE; } + CFX_DIBitmap::~CFX_DIBitmap() { - if (!m_bExtBuf) { + if (!m_bExtBuf) FX_Free(m_pBuffer); - } - m_pBuffer = NULL; + + m_pBuffer = nullptr; } + +uint8_t* CFX_DIBitmap::GetBuffer() const { + return m_pBuffer; +} + +const uint8_t* CFX_DIBitmap::GetScanline(int line) const { + return m_pBuffer ? m_pBuffer + line * m_Pitch : nullptr; +} + void CFX_DIBitmap::TakeOver(CFX_DIBitmap* pSrcBitmap) { - if (!m_bExtBuf) { + if (!m_bExtBuf) FX_Free(m_pBuffer); - } + FX_Free(m_pPalette); delete m_pAlphaMask; m_pBuffer = pSrcBitmap->m_pBuffer; m_pPalette = pSrcBitmap->m_pPalette; m_pAlphaMask = pSrcBitmap->m_pAlphaMask; - pSrcBitmap->m_pBuffer = NULL; - pSrcBitmap->m_pPalette = NULL; - pSrcBitmap->m_pAlphaMask = NULL; + pSrcBitmap->m_pBuffer = nullptr; + pSrcBitmap->m_pPalette = nullptr; + pSrcBitmap->m_pAlphaMask = nullptr; m_bpp = pSrcBitmap->m_bpp; m_bExtBuf = pSrcBitmap->m_bExtBuf; m_AlphaFlag = pSrcBitmap->m_AlphaFlag; @@ -152,6 +175,7 @@ void CFX_DIBitmap::TakeOver(CFX_DIBitmap* pSrcBitmap) { m_Height = pSrcBitmap->m_Height; m_Pitch = pSrcBitmap->m_Pitch; } + CFX_DIBitmap* CFX_DIBSource::Clone(const FX_RECT* pClip) const { FX_RECT rect(0, 0, m_Width, m_Height); if (pClip) { diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index 890de616d1..cd46148b7f 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -1281,8 +1281,23 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, m_pFontInfo->DeleteFont(hFont); return face; } + +void* IFX_SystemFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, + int weight, + FX_BOOL bItalic, + int pitch_family) { + return nullptr; +} #endif // PDF_ENABLE_XFA +int IFX_SystemFontInfo::GetFaceIndex(void* hFont) { + return 0; +} + +void* IFX_SystemFontInfo::RetainFont(void* hFont) { + return NULL; +} + int CFX_FontMapper::GetFaceSize() const { return pdfium::CollectionSize<int>(m_FaceArray); } @@ -1308,11 +1323,13 @@ unsigned long _FTStreamRead(FXFT_Stream stream, unsigned long count); void _FTStreamClose(FXFT_Stream stream); }; + #if _FX_OS_ == _FX_ANDROID_ IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) { return NULL; } #endif + CFX_FolderFontInfo::CFX_FolderFontInfo() {} CFX_FolderFontInfo::~CFX_FolderFontInfo() { for (const auto& pair : m_FontList) { diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index 8d54363d14..8fb03d86eb 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -1167,6 +1167,9 @@ FX_BOOL CFX_RenderDevice::DrawTextPath(int nChars, } return TRUE; } + +CFX_FontCache::CFX_FontCache() {} + CFX_FontCache::~CFX_FontCache() { FreeCache(TRUE); } |