Pass a ByteStringView into FindNativeTrueTypeFont().
Instead of passing in a ByteString, and then creating a ByteStringView
in every loop iteration.
Change-Id: I2d55359fa63a088cf8fcba255e1fc3f6fd96e864
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/73090
Reviewed-by: Hui Yingst <nigi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfdoc/cba_fontmap.cpp b/core/fpdfdoc/cba_fontmap.cpp
index 7ca0232..8c27ecb 100644
--- a/core/fpdfdoc/cba_fontmap.cpp
+++ b/core/fpdfdoc/cba_fontmap.cpp
@@ -32,17 +32,17 @@
namespace {
-bool FindNativeTrueTypeFont(ByteString sFontFaceName) {
+bool FindNativeTrueTypeFont(ByteStringView sFontFaceName) {
CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr();
CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper();
pFontMapper->LoadInstalledFonts();
for (const auto& font : pFontMapper->m_InstalledTTFonts) {
- if (font.Compare(sFontFaceName.AsStringView()))
+ if (font.Compare(sFontFaceName))
return true;
}
for (const auto& fontPair : pFontMapper->m_LocalizedTTFonts) {
- if (fontPair.first.Compare(sFontFaceName.AsStringView()))
+ if (fontPair.first.Compare(sFontFaceName))
return true;
}
return false;
@@ -415,7 +415,7 @@
nCharset = GetNativeCharset();
ByteString sFontName = CFX_Font::GetDefaultFontNameByCharset(nCharset);
- if (!FindNativeTrueTypeFont(sFontName))
+ if (!FindNativeTrueTypeFont(sFontName.AsStringView()))
return ByteString();
return sFontName;