summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-01-11 14:15:03 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-11 14:15:03 +0000
commit89fa5dfee5107736597682f174fdc95d0baec830 (patch)
tree35af8892240779553c5ebe339cd23d868fd86a51 /core
parent382129e2bdb1337a5a82cbd96478aab02f9aff7d (diff)
downloadpdfium-89fa5dfee5107736597682f174fdc95d0baec830.tar.xz
Use range-based for-loops in a few more places.
Change-Id: Id403abaf3d142dc30a661bc64ff48dbd5b10948e Reviewed-on: https://pdfium-review.googlesource.com/22736 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fxge/apple/fx_mac_imp.cpp6
-rw-r--r--core/fxge/cfx_unicodeencodingex.cpp5
-rw-r--r--core/fxge/fx_ge_linux.cpp12
3 files changed, 11 insertions, 12 deletions
diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp
index edd36bf2bc..3f75984f47 100644
--- a/core/fxge/apple/fx_mac_imp.cpp
+++ b/core/fxge/apple/fx_mac_imp.cpp
@@ -65,9 +65,9 @@ void* CFX_MacFontInfo::MapFont(int weight,
int pitch_family,
const char* cstr_face) {
ByteString face = cstr_face;
- for (size_t i = 0; i < FX_ArraySize(g_Base14Substs); ++i) {
- if (face == ByteStringView(g_Base14Substs[i].m_pName)) {
- face = g_Base14Substs[i].m_pSubstName;
+ for (const auto& sub : g_Base14Substs) {
+ if (face == ByteStringView(sub.m_pName)) {
+ face = sub.m_pSubstName;
return GetFont(face.c_str());
}
}
diff --git a/core/fxge/cfx_unicodeencodingex.cpp b/core/fxge/cfx_unicodeencodingex.cpp
index 3f28d4295e..a8db745612 100644
--- a/core/fxge/cfx_unicodeencodingex.cpp
+++ b/core/fxge/cfx_unicodeencodingex.cpp
@@ -93,9 +93,8 @@ std::unique_ptr<CFX_UnicodeEncodingEx> FX_CreateFontEncodingEx(
if (nEncodingID != FXFM_ENCODING_NONE)
return FXFM_CreateFontEncoding(pFont, nEncodingID);
- for (size_t i = 0; i < FX_ArraySize(g_EncodingID); ++i) {
- std::unique_ptr<CFX_UnicodeEncodingEx> pFontEncoding =
- FXFM_CreateFontEncoding(pFont, g_EncodingID[i]);
+ for (uint32_t id : g_EncodingID) {
+ auto pFontEncoding = FXFM_CreateFontEncoding(pFont, id);
if (pFontEncoding)
return pFontEncoding;
}
diff --git a/core/fxge/fx_ge_linux.cpp b/core/fxge/fx_ge_linux.cpp
index 22a3c4cd1b..65c9e56ff6 100644
--- a/core/fxge/fx_ge_linux.cpp
+++ b/core/fxge/fx_ge_linux.cpp
@@ -100,24 +100,24 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
break;
}
case FX_CHARSET_ChineseSimplified: {
- for (size_t i = 0; i < FX_ArraySize(g_LinuxGbFontList); ++i) {
- auto it = m_FontList.find(g_LinuxGbFontList[i]);
+ for (const char* name : g_LinuxGbFontList) {
+ auto it = m_FontList.find(name);
if (it != m_FontList.end())
return it->second.get();
}
break;
}
case FX_CHARSET_ChineseTraditional: {
- for (size_t i = 0; i < FX_ArraySize(g_LinuxB5FontList); ++i) {
- auto it = m_FontList.find(g_LinuxB5FontList[i]);
+ for (const char* name : g_LinuxB5FontList) {
+ auto it = m_FontList.find(name);
if (it != m_FontList.end())
return it->second.get();
}
break;
}
case FX_CHARSET_Hangul: {
- for (size_t i = 0; i < FX_ArraySize(g_LinuxHGFontList); ++i) {
- auto it = m_FontList.find(g_LinuxHGFontList[i]);
+ for (const char* name : g_LinuxHGFontList) {
+ auto it = m_FontList.find(name);
if (it != m_FontList.end())
return it->second.get();
}