summaryrefslogtreecommitdiff
path: root/core/fxge/ge/fx_ge_fontmap.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-13 17:51:27 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-13 17:51:27 -0700
commit71a452f8ce12e31cc4e0d8c7878567b0c7fc63c2 (patch)
treea0ee545eb67b14f9398df98196d88e5150893ce8 /core/fxge/ge/fx_ge_fontmap.cpp
parentafe94306e3c542f0d499e7f7706ee5dec4028d8a (diff)
downloadpdfium-71a452f8ce12e31cc4e0d8c7878567b0c7fc63c2.tar.xz
Make CFX_ByteString(const CFX_ByteStringC&) explicit.
Add missing helper function to CFX_ByteTextBuf to avoid the anti-pattern CFX_ByteString(sBuf.AsStringC()), using the name "Make" to indicate there's an allocation going on in this case. Change some method arguments to take pre-existing ByteStrings where possible. Review-Url: https://codereview.chromium.org/1977093002
Diffstat (limited to 'core/fxge/ge/fx_ge_fontmap.cpp')
-rw-r--r--core/fxge/ge/fx_ge_fontmap.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/fxge/ge/fx_ge_fontmap.cpp b/core/fxge/ge/fx_ge_fontmap.cpp
index 8524660043..e8af2dce53 100644
--- a/core/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/fxge/ge/fx_ge_fontmap.cpp
@@ -317,7 +317,7 @@ CFX_ByteString GetFontFamily(CFX_ByteString fontName, int nStyle) {
CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) {
CFX_ByteTextBuf buf;
if (!iLen || iLen <= iIndex) {
- return buf.AsStringC();
+ return buf.MakeString();
}
while (iIndex < iLen) {
if (pStyle[iIndex] == ',') {
@@ -326,7 +326,7 @@ CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) {
buf.AppendChar(pStyle[iIndex]);
++iIndex;
}
- return buf.AsStringC();
+ return buf.MakeString();
}
int32_t GetStyleType(const CFX_ByteString& bsStyle, FX_BOOL bRevert) {
@@ -688,7 +688,7 @@ static CFX_ByteString GetStringFromTable(const uint8_t* string_ptr,
if (string_ptr_length < static_cast<uint32_t>(offset + length)) {
return CFX_ByteString();
}
- return CFX_ByteStringC(string_ptr + offset, length);
+ return CFX_ByteString(string_ptr + offset, length);
}
CFX_ByteString GetNameFromTT(const uint8_t* name_table,
@@ -1368,12 +1368,15 @@ CFX_FolderFontInfo::~CFX_FolderFontInfo() {
delete pair.second;
}
}
+
void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) {
- m_PathList.push_back(path);
+ m_PathList.push_back(CFX_ByteString(path));
}
+
void CFX_FolderFontInfo::Release() {
delete this;
}
+
FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) {
m_pMapper = pMapper;
for (const auto& path : m_PathList)