diff options
author | tsepez <tsepez@chromium.org> | 2016-06-07 18:17:30 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-07 18:17:30 -0700 |
commit | 649a78569e9487fc5d3cccee546be50c351560b7 (patch) | |
tree | a19a0787474e8ca578cc73fc49ca95a35821dc8b /core/fpdfapi/fpdf_font | |
parent | 1cd352e0a4bc19f96df199b0acfa32a344240d5e (diff) | |
download | pdfium-649a78569e9487fc5d3cccee546be50c351560b7.tar.xz |
Use static_casts for cpdf_type1font bsearch on mac.
Also sort the static table to be compatible with bsearch().
Review-Url: https://codereview.chromium.org/2047813002
Diffstat (limited to 'core/fpdfapi/fpdf_font')
-rw-r--r-- | core/fpdfapi/fpdf_font/cpdf_type1font.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp index 908b6e3a2f..3f1b5d1a40 100644 --- a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp @@ -23,24 +23,21 @@ struct GlyphNameMap { }; const GlyphNameMap g_GlyphNameSubsts[] = {{"ff", "uniFB00"}, - {"fi", "uniFB01"}, - {"fl", "uniFB02"}, {"ffi", "uniFB03"}, - {"ffl", "uniFB04"}}; + {"ffl", "uniFB04"}, + {"fi", "uniFB01"}, + {"fl", "uniFB02"}}; int compareString(const void* key, const void* element) { - return FXSYS_stricmp((const FX_CHAR*)key, - ((GlyphNameMap*)element)->m_pStrAdobe); + return FXSYS_stricmp(static_cast<const FX_CHAR*>(key), + static_cast<const GlyphNameMap*>(element)->m_pStrAdobe); } const FX_CHAR* GlyphNameRemap(const FX_CHAR* pStrAdobe) { - GlyphNameMap* found = (GlyphNameMap*)FXSYS_bsearch( - pStrAdobe, g_GlyphNameSubsts, - sizeof(g_GlyphNameSubsts) / sizeof(GlyphNameMap), sizeof(GlyphNameMap), - compareString); - if (found) - return found->m_pStrUnicode; - return nullptr; + const GlyphNameMap* found = static_cast<const GlyphNameMap*>(FXSYS_bsearch( + pStrAdobe, g_GlyphNameSubsts, FX_ArraySize(g_GlyphNameSubsts), + sizeof(GlyphNameMap), compareString)); + return found ? found->m_pStrUnicode : nullptr; } #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |