From c4dce690f433a41c4429e872c2306e09b14c5d9f Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 26 Jun 2018 19:48:59 +0000 Subject: Use pdfium::span<> in cpdf_fontglobals.h Required moving some sizes to .h file for default construction of spans from c-style arrays. Change-Id: I45c42103f3575bc83e57a085ad4e8f16698468d3 Reviewed-on: https://pdfium-review.googlesource.com/36190 Reviewed-by: dsinclair Commit-Queue: Tom Sepez --- core/fpdfapi/font/cpdf_fontglobals.h | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'core/fpdfapi/font') diff --git a/core/fpdfapi/font/cpdf_fontglobals.h b/core/fpdfapi/font/cpdf_fontglobals.h index 2663490925..d5156aae65 100644 --- a/core/fpdfapi/font/cpdf_fontglobals.h +++ b/core/fpdfapi/font/cpdf_fontglobals.h @@ -29,36 +29,25 @@ class CPDF_FontGlobals { uint32_t index, std::unique_ptr pFont); - void SetEmbeddedCharset(size_t idx, const FXCMAP_CMap* map, uint32_t count) { - m_EmbeddedCharsets[idx].m_pMapList = map; - m_EmbeddedCharsets[idx].m_Count = count; + void SetEmbeddedCharset(size_t idx, pdfium::span map) { + m_EmbeddedCharsets[idx] = map; } - std::pair GetEmbeddedCharset(size_t idx) const { - return {m_EmbeddedCharsets[idx].m_Count, - m_EmbeddedCharsets[idx].m_pMapList.Get()}; + pdfium::span GetEmbeddedCharset(size_t idx) const { + return m_EmbeddedCharsets[idx]; } - void SetEmbeddedToUnicode(size_t idx, const uint16_t* map, uint32_t count) { - m_EmbeddedToUnicodes[idx].m_pMap = map; - m_EmbeddedToUnicodes[idx].m_Count = count; + void SetEmbeddedToUnicode(size_t idx, pdfium::span map) { + m_EmbeddedToUnicodes[idx] = map; } pdfium::span GetEmbeddedToUnicode(size_t idx) { - return pdfium::make_span(m_EmbeddedToUnicodes[idx].m_pMap, - m_EmbeddedToUnicodes[idx].m_Count); + return m_EmbeddedToUnicodes[idx]; } CPDF_CMapManager* GetCMapManager() { return &m_CMapManager; } private: CPDF_CMapManager m_CMapManager; - struct { - UnownedPtr m_pMapList; - uint32_t m_Count; - } m_EmbeddedCharsets[CIDSET_NUM_SETS]; - struct { - const uint16_t* m_pMap; - uint32_t m_Count; - } m_EmbeddedToUnicodes[CIDSET_NUM_SETS]; - + pdfium::span m_EmbeddedCharsets[CIDSET_NUM_SETS]; + pdfium::span m_EmbeddedToUnicodes[CIDSET_NUM_SETS]; std::map> m_StockMap; }; -- cgit v1.2.3