From b4a75830cc03dc6c44c4e0f3b5e31d05a0d8596a Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 4 May 2017 10:20:28 -0700 Subject: Remove CFX_GlyphMap It's only instantiated in one place, and then nothing is ever put into the map. Change-Id: I8ebee324e0ec63c139309275c8de115d38063dc6 Reviewed-on: https://pdfium-review.googlesource.com/4877 Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fpdfapi/font/ttgsubtable.cpp | 49 --------------------------------------- core/fpdfapi/font/ttgsubtable.h | 13 ----------- 2 files changed, 62 deletions(-) diff --git a/core/fpdfapi/font/ttgsubtable.cpp b/core/fpdfapi/font/ttgsubtable.cpp index 5b3d4cd4b9..b8d6946657 100644 --- a/core/fpdfapi/font/ttgsubtable.cpp +++ b/core/fpdfapi/font/ttgsubtable.cpp @@ -12,55 +12,6 @@ #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -CFX_GlyphMap::CFX_GlyphMap() {} - -CFX_GlyphMap::~CFX_GlyphMap() {} - -extern "C" { -static int _CompareInt(const void* p1, const void* p2) { - return (*(uint32_t*)p1) - (*(uint32_t*)p2); -} -}; - -struct _IntPair { - int32_t key; - int32_t value; -}; - -void CFX_GlyphMap::SetAt(int key, int value) { - uint32_t count = m_Buffer.GetSize() / sizeof(_IntPair); - _IntPair* buf = (_IntPair*)m_Buffer.GetBuffer(); - _IntPair pair = {key, value}; - if (count == 0 || key > buf[count - 1].key) { - m_Buffer.AppendBlock(&pair, sizeof(_IntPair)); - return; - } - int low = 0, high = count - 1; - while (low <= high) { - int mid = (low + high) / 2; - if (buf[mid].key < key) { - low = mid + 1; - } else if (buf[mid].key > key) { - high = mid - 1; - } else { - buf[mid].value = value; - return; - } - } - m_Buffer.InsertBlock(low * sizeof(_IntPair), &pair, sizeof(_IntPair)); -} - -bool CFX_GlyphMap::Lookup(int key, int& value) { - void* pResult = - bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_IntPair), - sizeof(_IntPair), _CompareInt); - if (!pResult) { - return false; - } - value = ((uint32_t*)pResult)[1]; - return true; -} - CFX_CTTGSUBTable::CFX_CTTGSUBTable() : m_bFeautureMapLoad(false), loaded(false) {} diff --git a/core/fpdfapi/font/ttgsubtable.h b/core/fpdfapi/font/ttgsubtable.h index 4b937f0473..c3bff43957 100644 --- a/core/fpdfapi/font/ttgsubtable.h +++ b/core/fpdfapi/font/ttgsubtable.h @@ -17,18 +17,6 @@ #include "core/fxge/fx_font.h" #include "core/fxge/fx_freetype.h" -class CFX_GlyphMap { - public: - CFX_GlyphMap(); - ~CFX_GlyphMap(); - - void SetAt(int key, int value); - bool Lookup(int key, int& value); - - protected: - CFX_BinaryBuf m_Buffer; -}; - class CFX_CTTGSUBTable { public: CFX_CTTGSUBTable(); @@ -154,7 +142,6 @@ class CFX_CTTGSUBTable { virtual ~TCoverageFormatBase() {} uint16_t CoverageFormat; - CFX_GlyphMap m_glyphMap; private: TCoverageFormatBase(const TCoverageFormatBase&); -- cgit v1.2.3