From 803cf76a5801536afe3ac2baad0f9a66ec27eeb6 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 29 Aug 2018 18:25:44 +0000 Subject: Remove FPDFAPI_ prefix from internal cid/encoder functions These look too much like public/ FPDF functions otherwise and yet they are not exposed anywhere beyond core/fpdfapi. Disambiguate one method vs. top-level function usage as a result. Bug: pdfium:1141 Change-Id: I9cfdfced90386bb9ef6b2b86f568f2e6f8ee6a5a Reviewed-on: https://pdfium-review.googlesource.com/41530 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- core/fpdfapi/cmaps/cmap_int.h | 10 +++++----- core/fpdfapi/cmaps/fpdf_cmaps.cpp | 10 +++++----- core/fpdfapi/font/cpdf_cidfont.cpp | 4 ++-- core/fpdfapi/font/cpdf_cmap.cpp | 4 ++-- core/fpdfapi/page/cpdf_streamparser.cpp | 10 +++++----- core/fpdfapi/parser/fpdf_parser_decode.cpp | 26 +++++++++++++------------- core/fpdfapi/parser/fpdf_parser_decode.h | 18 +++++++++--------- core/fpdfapi/render/cpdf_dibbase.cpp | 6 +++--- 8 files changed, 44 insertions(+), 44 deletions(-) diff --git a/core/fpdfapi/cmaps/cmap_int.h b/core/fpdfapi/cmaps/cmap_int.h index 03650383cd..e532c763ff 100644 --- a/core/fpdfapi/cmaps/cmap_int.h +++ b/core/fpdfapi/cmaps/cmap_int.h @@ -29,10 +29,10 @@ struct FXCMAP_CMap { int8_t m_UseOffset; }; -const FXCMAP_CMap* FPDFAPI_FindEmbeddedCMap(const ByteString& name, - int charset, - int coding); -uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode); -uint32_t FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid); +const FXCMAP_CMap* FindEmbeddedCMap(const ByteString& name, + int charset, + int coding); +uint16_t CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode); +uint32_t CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid); #endif // CORE_FPDFAPI_CMAPS_CMAP_INT_H_ diff --git a/core/fpdfapi/cmaps/fpdf_cmaps.cpp b/core/fpdfapi/cmaps/fpdf_cmaps.cpp index 630942bde7..5d2143c3c3 100644 --- a/core/fpdfapi/cmaps/fpdf_cmaps.cpp +++ b/core/fpdfapi/cmaps/fpdf_cmaps.cpp @@ -32,9 +32,9 @@ const FXCMAP_CMap* FindNextCMap(const FXCMAP_CMap* pMap) { } // namespace -const FXCMAP_CMap* FPDFAPI_FindEmbeddedCMap(const ByteString& bsName, - int charset, - int coding) { +const FXCMAP_CMap* FindEmbeddedCMap(const ByteString& bsName, + int charset, + int coding) { CPDF_FontGlobals* pFontGlobals = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); @@ -48,7 +48,7 @@ const FXCMAP_CMap* FPDFAPI_FindEmbeddedCMap(const ByteString& bsName, return nullptr; } -uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode) { +uint16_t CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode) { ASSERT(pMap); const uint16_t loword = static_cast(charcode); if (charcode >> 16) { @@ -111,7 +111,7 @@ uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode) { return 0; } -uint32_t FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) { +uint32_t CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) { // TODO(dsinclair): This should be checking both pMap->m_WordMap and // pMap->m_DWordMap. There was a second while() but it was never reached as // the first always returns. Investigate and determine how this should diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp index 98478c378a..03442b5897 100644 --- a/core/fpdfapi/font/cpdf_cidfont.cpp +++ b/core/fpdfapi/font/cpdf_cidfont.cpp @@ -150,7 +150,7 @@ wchar_t EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap, if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) return 0; - uint16_t cid = FPDFAPI_CIDFromCharCode(pEmbedMap, charcode); + uint16_t cid = CIDFromCharCode(pEmbedMap, charcode); if (!cid) return 0; @@ -169,7 +169,7 @@ uint32_t EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, GetFontGlobals()->GetEmbeddedToUnicode(charset); for (uint32_t i = 0; i < map.size(); ++i) { if (map[i] == unicode) { - uint32_t charCode = FPDFAPI_CharCodeFromCID(pEmbedMap, i); + uint32_t charCode = CharCodeFromCID(pEmbedMap, i); if (charCode) return charCode; } diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp index 3e5732215d..97a8ed2700 100644 --- a/core/fpdfapi/font/cpdf_cmap.cpp +++ b/core/fpdfapi/font/cpdf_cmap.cpp @@ -282,7 +282,7 @@ void CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, m_MixedTwoByteLeadingBytes[b] = true; } } - m_pEmbedMap = FPDFAPI_FindEmbeddedCMap(bsName, m_Charset, m_Coding); + m_pEmbedMap = FindEmbeddedCMap(bsName, m_Charset, m_Coding); if (!m_pEmbedMap) return; @@ -316,7 +316,7 @@ uint16_t CPDF_CMap::CIDFromCharCode(uint32_t charcode) const { return static_cast(charcode); if (m_pEmbedMap) - return FPDFAPI_CIDFromCharCode(m_pEmbedMap.Get(), charcode); + return ::CIDFromCharCode(m_pEmbedMap.Get(), charcode); if (m_DirectCharcodeToCIDTable.empty()) return static_cast(charcode); diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp index 266f7db832..3d086b37ff 100644 --- a/core/fpdfapi/page/cpdf_streamparser.cpp +++ b/core/fpdfapi/page/cpdf_streamparser.cpp @@ -71,7 +71,7 @@ uint32_t DecodeInlineStream(const uint8_t* src_buf, uint32_t* dest_size) { if (decoder == "CCITTFaxDecode" || decoder == "CCF") { std::unique_ptr pDecoder = - FPDFAPI_CreateFaxDecoder({src_buf, limit}, width, height, pParam); + CreateFaxDecoder({src_buf, limit}, width, height, pParam); return DecodeAllScanlines(std::move(pDecoder), dest_buf, dest_size); } if (decoder == "ASCII85Decode" || decoder == "A85") @@ -79,12 +79,12 @@ uint32_t DecodeInlineStream(const uint8_t* src_buf, if (decoder == "ASCIIHexDecode" || decoder == "AHx") return HexDecode(src_buf, limit, dest_buf, dest_size); if (decoder == "FlateDecode" || decoder == "Fl") { - return FPDFAPI_FlateOrLZWDecode(false, src_buf, limit, pParam, *dest_size, - dest_buf, dest_size); + return FlateOrLZWDecode(false, src_buf, limit, pParam, *dest_size, dest_buf, + dest_size); } if (decoder == "LZWDecode" || decoder == "LZW") { - return FPDFAPI_FlateOrLZWDecode(true, src_buf, limit, pParam, 0, dest_buf, - dest_size); + return FlateOrLZWDecode(true, src_buf, limit, pParam, 0, dest_buf, + dest_size); } if (decoder == "DCTDecode" || decoder == "DCT") { std::unique_ptr pDecoder = diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp index ff4f63f0cb..8143517029 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp @@ -257,7 +257,7 @@ uint32_t RunLengthDecode(const uint8_t* src_buf, return std::min(i + 1, src_size); } -std::unique_ptr FPDFAPI_CreateFaxDecoder( +std::unique_ptr CreateFaxDecoder( pdfium::span src_span, int width, int height, @@ -283,7 +283,7 @@ std::unique_ptr FPDFAPI_CreateFaxDecoder( Rows); } -std::unique_ptr FPDFAPI_CreateFlateDecoder( +std::unique_ptr CreateFlateDecoder( pdfium::span src_span, int width, int height, @@ -307,13 +307,13 @@ std::unique_ptr FPDFAPI_CreateFlateDecoder( Columns); } -uint32_t FPDFAPI_FlateOrLZWDecode(bool bLZW, - const uint8_t* src_buf, - uint32_t src_size, - const CPDF_Dictionary* pParams, - uint32_t estimated_size, - uint8_t** dest_buf, - uint32_t* dest_size) { +uint32_t FlateOrLZWDecode(bool bLZW, + const uint8_t* src_buf, + uint32_t src_size, + const CPDF_Dictionary* pParams, + uint32_t estimated_size, + uint8_t** dest_buf, + uint32_t* dest_size) { int predictor = 0; int Colors = 0; int BitsPerComponent = 0; @@ -382,11 +382,11 @@ bool PDF_DataDecode(const uint8_t* src_buf, *pImageParams = pParam; return true; } - offset = FPDFAPI_FlateOrLZWDecode(false, last_buf, last_size, pParam, - estimated_size, &new_buf, &new_size); + offset = FlateOrLZWDecode(false, last_buf, last_size, pParam, + estimated_size, &new_buf, &new_size); } else if (decoder == "LZWDecode" || decoder == "LZW") { - offset = FPDFAPI_FlateOrLZWDecode(true, last_buf, last_size, pParam, - estimated_size, &new_buf, &new_size); + offset = FlateOrLZWDecode(true, last_buf, last_size, pParam, + estimated_size, &new_buf, &new_size); } else if (decoder == "ASCII85Decode" || decoder == "A85") { offset = A85Decode(last_buf, last_size, &new_buf, &new_size); } else if (decoder == "ASCIIHexDecode" || decoder == "AHx") { diff --git a/core/fpdfapi/parser/fpdf_parser_decode.h b/core/fpdfapi/parser/fpdf_parser_decode.h index bf70997397..da228d223d 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.h +++ b/core/fpdfapi/parser/fpdf_parser_decode.h @@ -38,13 +38,13 @@ uint32_t RunLengthDecode(const uint8_t* src_buf, uint8_t** dest_buf, uint32_t* dest_size); -std::unique_ptr FPDFAPI_CreateFaxDecoder( +std::unique_ptr CreateFaxDecoder( pdfium::span src_span, int width, int height, const CPDF_Dictionary* pParams); -std::unique_ptr FPDFAPI_CreateFlateDecoder( +std::unique_ptr CreateFlateDecoder( pdfium::span src_span, int width, int height, @@ -62,13 +62,13 @@ uint32_t HexDecode(const uint8_t* src_buf, uint8_t** dest_buf, uint32_t* dest_size); -uint32_t FPDFAPI_FlateOrLZWDecode(bool bLZW, - const uint8_t* src_buf, - uint32_t src_size, - const CPDF_Dictionary* pParams, - uint32_t estimated_size, - uint8_t** dest_buf, - uint32_t* dest_size); +uint32_t FlateOrLZWDecode(bool bLZW, + const uint8_t* src_buf, + uint32_t src_size, + const CPDF_Dictionary* pParams, + uint32_t estimated_size, + uint8_t** dest_buf, + uint32_t* dest_size); bool PDF_DataDecode(const uint8_t* src_buf, uint32_t src_size, diff --git a/core/fpdfapi/render/cpdf_dibbase.cpp b/core/fpdfapi/render/cpdf_dibbase.cpp index 70aea8e45b..a37a0aecd5 100644 --- a/core/fpdfapi/render/cpdf_dibbase.cpp +++ b/core/fpdfapi/render/cpdf_dibbase.cpp @@ -473,10 +473,10 @@ CPDF_DIBBase::LoadState CPDF_DIBBase::CreateDecoder() { pdfium::span src_span = m_pStreamAcc->GetSpan(); const CPDF_Dictionary* pParams = m_pStreamAcc->GetImageParam(); if (decoder == "CCITTFaxDecode") { - m_pDecoder = FPDFAPI_CreateFaxDecoder(src_span, m_Width, m_Height, pParams); + m_pDecoder = CreateFaxDecoder(src_span, m_Width, m_Height, pParams); } else if (decoder == "FlateDecode") { - m_pDecoder = FPDFAPI_CreateFlateDecoder(src_span, m_Width, m_Height, - m_nComponents, m_bpc, pParams); + m_pDecoder = CreateFlateDecoder(src_span, m_Width, m_Height, m_nComponents, + m_bpc, pParams); } else if (decoder == "RunLengthDecode") { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); m_pDecoder = pEncoders->GetBasicModule()->CreateRunLengthDecoder( -- cgit v1.2.3