summaryrefslogtreecommitdiff
path: root/core/src/fxge/ge/fx_ge_linux.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-08-19 09:49:24 -0700
committerTom Sepez <tsepez@chromium.org>2015-08-19 09:49:24 -0700
commit09d33bcd82a82cb55039d41651df13e17d6c3e59 (patch)
tree7a748b7570ff6ad0321c4334319bac101da0e6af /core/src/fxge/ge/fx_ge_linux.cpp
parent1b0023986bc22ce362097b25deb9746b693ef235 (diff)
downloadpdfium-09d33bcd82a82cb55039d41651df13e17d6c3e59.tar.xz
Merge to XFA: CFX_MapByteStringToPtr considered harmful (combo patch).
New manual edits: two unused members deleted, one adapted. fde_csscache.cpp fde_csscache.h fpdfxfa_doc.h fx_ge_fontmap.cpp (cherry picked from commit 1d9dbd53b205b2b4d9e75a7eeb95e80837917ea3) (cherry picked from commit cb4d0ea68308e3c51a6ba9551b393bb2f639afc4) (cherry picked from commit 9cf44c2ed09a8b2ff243eb6dbb72a8cceae1b5ff) (cherry picked from commit 2a2a6aa7f51352fc481e78f6ad9d41f2738bcc48) (cherry picked from commit ce4ffb8183af3fa2bb5133f0f7370a88e064c516) Original Review URL: https://codereview.chromium.org/1297723002 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1301793002 .
Diffstat (limited to 'core/src/fxge/ge/fx_ge_linux.cpp')
-rw-r--r--core/src/fxge/ge/fx_ge_linux.cpp47
1 files changed, 23 insertions, 24 deletions
diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp
index bad3854afe..4e713dc412 100644
--- a/core/src/fxge/ge/fx_ge_linux.cpp
+++ b/core/src/fxge/ge/fx_ge_linux.cpp
@@ -105,7 +105,6 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
if (iBaseFont < 12) {
return GetFont(face);
}
- void* p = NULL;
FX_BOOL bCJK = TRUE;
switch (charset) {
case FXFONT_SHIFTJIS_CHARSET: {
@@ -113,34 +112,36 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
if (index < 0) {
break;
}
- for (int32_t i = 0; i < LINUX_GPNAMESIZE; i++)
- if (m_FontList.Lookup(LinuxGpFontList[index].NameArr[i], p)) {
- return p;
+ for (int32_t i = 0; i < LINUX_GPNAMESIZE; i++) {
+ auto it = m_FontList.find(LinuxGpFontList[index].NameArr[i]);
+ if (it != m_FontList.end()) {
+ return it->second;
}
+ }
} break;
case FXFONT_GB2312_CHARSET: {
- static int32_t s_gbCount =
- sizeof(g_LinuxGbFontList) / sizeof(const FX_CHAR*);
- for (int32_t i = 0; i < s_gbCount; i++)
- if (m_FontList.Lookup(g_LinuxGbFontList[i], p)) {
- return p;
+ for (int32_t i = 0; i < FX_ArraySize(g_LinuxGbFontList); ++i) {
+ auto it = m_FontList.find(g_LinuxGbFontList[i]);
+ if (it != m_FontList.end()) {
+ return it->second;
}
+ }
} break;
case FXFONT_CHINESEBIG5_CHARSET: {
- static int32_t s_b5Count =
- sizeof(g_LinuxB5FontList) / sizeof(const FX_CHAR*);
- for (int32_t i = 0; i < s_b5Count; i++)
- if (m_FontList.Lookup(g_LinuxB5FontList[i], p)) {
- return p;
+ for (int32_t i = 0; i < FX_ArraySize(g_LinuxB5FontList); ++i) {
+ auto it = m_FontList.find(g_LinuxB5FontList[i]);
+ if (it != m_FontList.end()) {
+ return it->second;
}
+ }
} break;
case FXFONT_HANGEUL_CHARSET: {
- static int32_t s_hgCount =
- sizeof(g_LinuxHGFontList) / sizeof(const FX_CHAR*);
- for (int32_t i = 0; i < s_hgCount; i++)
- if (m_FontList.Lookup(g_LinuxHGFontList[i], p)) {
- return p;
+ for (int32_t i = 0; i < FX_ArraySize(g_LinuxHGFontList); ++i) {
+ auto it = m_FontList.find(g_LinuxHGFontList[i]);
+ if (it != m_FontList.end()) {
+ return it->second;
}
+ }
} break;
default:
bCJK = FALSE;
@@ -201,11 +202,9 @@ void* CFX_LinuxFontInfo::FindFont(int weight,
CFX_FontFaceInfo* pFind = NULL;
FX_DWORD charset_flag = _LinuxGetCharset(charset);
int32_t iBestSimilar = 0;
- FX_POSITION pos = m_FontList.GetStartPosition();
- while (pos) {
- CFX_ByteString bsName;
- CFX_FontFaceInfo* pFont = NULL;
- m_FontList.GetNextAssoc(pos, bsName, (void*&)pFont);
+ for (const auto& it : m_FontList) {
+ const CFX_ByteString& bsName = it.first;
+ CFX_FontFaceInfo* pFont = it.second;
if (!(pFont->m_Charsets & charset_flag) &&
charset != FXFONT_DEFAULT_CHARSET) {
continue;