summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-07 16:58:00 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-10 16:33:54 +0000
commitec8ff7d258ef25f7e3193572aeef220ff86784f0 (patch)
tree1c72cae7e3b43908840c9a6881b239850933680b
parent84b596d64aab8f8c6dd6145e9c210b145fc5631a (diff)
downloadpdfium-ec8ff7d258ef25f7e3193572aeef220ff86784f0.tar.xz
Fix bytestring passing conventions, part 2.
Change pass by reference to const reference or pointer. Change-Id: Ic007f14e6569679a846980a96cc627eac4ecd5d6 Reviewed-on: https://pdfium-review.googlesource.com/3953 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
-rw-r--r--core/fxcrt/fx_ext.h4
-rw-r--r--core/fxcrt/fx_extension.cpp14
-rw-r--r--core/fxcrt/xml/cxml_element.cpp12
-rw-r--r--core/fxcrt/xml/cxml_element.h6
-rw-r--r--core/fxge/android/cfx_androidfontinfo.cpp8
-rw-r--r--core/fxge/android/cfx_androidfontinfo.h4
-rw-r--r--core/fxge/ge/cfx_folderfontinfo.cpp8
-rw-r--r--core/fxge/ge/cfx_folderfontinfo.h4
-rw-r--r--core/fxge/ge/cfx_fontmapper.cpp6
-rw-r--r--core/fxge/ifx_systemfontinfo.h4
-rw-r--r--core/fxge/win32/fx_win32_device.cpp12
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.cpp21
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.h6
-rw-r--r--fpdfsdk/fpdf_ext.cpp5
-rw-r--r--fpdfsdk/fpdf_sysfontinfo.cpp12
-rw-r--r--fpdfsdk/pdfwindow/PWL_FontMap.cpp7
-rw-r--r--fpdfsdk/pdfwindow/PWL_FontMap.h2
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.cpp3
18 files changed, 66 insertions, 72 deletions
diff --git a/core/fxcrt/fx_ext.h b/core/fxcrt/fx_ext.h
index 7d42e90ce3..d7f21af9ff 100644
--- a/core/fxcrt/fx_ext.h
+++ b/core/fxcrt/fx_ext.h
@@ -98,9 +98,7 @@ struct FX_GUID {
uint8_t data4[8];
};
void FX_GUID_CreateV4(FX_GUID* pGUID);
-void FX_GUID_ToString(const FX_GUID* pGUID,
- CFX_ByteString& bsStr,
- bool bSeparator = true);
+CFX_ByteString FX_GUID_ToString(const FX_GUID* pGUID, bool bSeparator = true);
#endif // PDF_ENABLE_XFA
#endif // CORE_FXCRT_FX_EXT_H_
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index f13922e2da..acdce048e0 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -638,24 +638,24 @@ void FX_Random_GenerateCrypto(uint32_t* pBuffer, int32_t iCount) {
#ifdef PDF_ENABLE_XFA
static const char gs_FX_pHexChars[] = "0123456789ABCDEF";
+
void FX_GUID_CreateV4(FX_GUID* pGUID) {
FX_Random_GenerateMT((uint32_t*)pGUID, 4);
uint8_t& b = ((uint8_t*)pGUID)[6];
b = (b & 0x0F) | 0x40;
}
-void FX_GUID_ToString(const FX_GUID* pGUID,
- CFX_ByteString& bsStr,
- bool bSeparator) {
+
+CFX_ByteString FX_GUID_ToString(const FX_GUID* pGUID, bool bSeparator) {
+ CFX_ByteString bsStr;
char* pBuf = bsStr.GetBuffer(40);
- uint8_t b;
for (int32_t i = 0; i < 16; i++) {
- b = ((const uint8_t*)pGUID)[i];
+ uint8_t b = reinterpret_cast<const uint8_t*>(pGUID)[i];
*pBuf++ = gs_FX_pHexChars[b >> 4];
*pBuf++ = gs_FX_pHexChars[b & 0x0F];
- if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) {
+ if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9))
*pBuf++ = L'-';
}
- }
bsStr.ReleaseBuffer(bSeparator ? 36 : 32);
+ return bsStr;
}
#endif // PDF_ENABLE_XFA
diff --git a/core/fxcrt/xml/cxml_element.cpp b/core/fxcrt/xml/cxml_element.cpp
index 20ad54e88c..17caebfa14 100644
--- a/core/fxcrt/xml/cxml_element.cpp
+++ b/core/fxcrt/xml/cxml_element.cpp
@@ -65,16 +65,16 @@ CFX_ByteString CXML_Element::GetNamespaceURI(
}
void CXML_Element::GetAttrByIndex(int index,
- CFX_ByteString& space,
- CFX_ByteString& name,
- CFX_WideString& value) const {
+ CFX_ByteString* space,
+ CFX_ByteString* name,
+ CFX_WideString* value) const {
if (index < 0 || index >= m_AttrMap.GetSize())
return;
CXML_AttrItem& item = m_AttrMap.GetAt(index);
- space = item.m_QSpaceName;
- name = item.m_AttrName;
- value = item.m_Value;
+ *space = item.m_QSpaceName;
+ *name = item.m_AttrName;
+ *value = item.m_Value;
}
bool CXML_Element::HasAttr(const CFX_ByteStringC& name) const {
diff --git a/core/fxcrt/xml/cxml_element.h b/core/fxcrt/xml/cxml_element.h
index 2e18e187b7..349deba2c8 100644
--- a/core/fxcrt/xml/cxml_element.h
+++ b/core/fxcrt/xml/cxml_element.h
@@ -31,9 +31,9 @@ class CXML_Element {
const CXML_Element* GetParent() const { return m_pParent; }
uint32_t CountAttrs() const { return m_AttrMap.GetSize(); }
void GetAttrByIndex(int index,
- CFX_ByteString& space,
- CFX_ByteString& name,
- CFX_WideString& value) const;
+ CFX_ByteString* space,
+ CFX_ByteString* name,
+ CFX_WideString* value) const;
bool HasAttr(const CFX_ByteStringC& qName) const;
bool GetAttrValue(const CFX_ByteStringC& name,
CFX_WideString& attribute) const;
diff --git a/core/fxge/android/cfx_androidfontinfo.cpp b/core/fxge/android/cfx_androidfontinfo.cpp
index 6ab9c6479a..1183cdeaaa 100644
--- a/core/fxge/android/cfx_androidfontinfo.cpp
+++ b/core/fxge/android/cfx_androidfontinfo.cpp
@@ -63,19 +63,19 @@ uint32_t CFX_AndroidFontInfo::GetFontData(void* hFont,
return static_cast<CFPF_SkiaFont*>(hFont)->GetFontData(table, buffer, size);
}
-bool CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
+bool CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString* name) {
if (!hFont)
return false;
- name = static_cast<CFPF_SkiaFont*>(hFont)->GetFamilyName();
+ *name = static_cast<CFPF_SkiaFont*>(hFont)->GetFamilyName();
return true;
}
-bool CFX_AndroidFontInfo::GetFontCharset(void* hFont, int& charset) {
+bool CFX_AndroidFontInfo::GetFontCharset(void* hFont, int* charset) {
if (!hFont)
return false;
- charset = static_cast<CFPF_SkiaFont*>(hFont)->GetCharset();
+ *charset = static_cast<CFPF_SkiaFont*>(hFont)->GetCharset();
return false;
}
diff --git a/core/fxge/android/cfx_androidfontinfo.h b/core/fxge/android/cfx_androidfontinfo.h
index 076b956a0c..ce08f2558a 100644
--- a/core/fxge/android/cfx_androidfontinfo.h
+++ b/core/fxge/android/cfx_androidfontinfo.h
@@ -34,8 +34,8 @@ class CFX_AndroidFontInfo : public IFX_SystemFontInfo {
uint32_t table,
uint8_t* buffer,
uint32_t size) override;
- bool GetFaceName(void* hFont, CFX_ByteString& name) override;
- bool GetFontCharset(void* hFont, int& charset) override;
+ bool GetFaceName(void* hFont, CFX_ByteString* name) override;
+ bool GetFontCharset(void* hFont, int* charset) override;
void DeleteFont(void* hFont) override;
protected:
diff --git a/core/fxge/ge/cfx_folderfontinfo.cpp b/core/fxge/ge/cfx_folderfontinfo.cpp
index 15a8daf95c..ff8cc4c29f 100644
--- a/core/fxge/ge/cfx_folderfontinfo.cpp
+++ b/core/fxge/ge/cfx_folderfontinfo.cpp
@@ -366,14 +366,14 @@ uint32_t CFX_FolderFontInfo::GetFontData(void* hFont,
}
void CFX_FolderFontInfo::DeleteFont(void* hFont) {}
-bool CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
+
+bool CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString* name) {
if (!hFont)
return false;
- CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont;
- name = pFont->m_FaceName;
+ *name = static_cast<CFX_FontFaceInfo*>(hFont)->m_FaceName;
return true;
}
-bool CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) {
+bool CFX_FolderFontInfo::GetFontCharset(void* hFont, int* charset) {
return false;
}
diff --git a/core/fxge/ge/cfx_folderfontinfo.h b/core/fxge/ge/cfx_folderfontinfo.h
index 17940bdbee..ab2468ade0 100644
--- a/core/fxge/ge/cfx_folderfontinfo.h
+++ b/core/fxge/ge/cfx_folderfontinfo.h
@@ -41,8 +41,8 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
uint8_t* buffer,
uint32_t size) override;
void DeleteFont(void* hFont) override;
- bool GetFaceName(void* hFont, CFX_ByteString& name) override;
- bool GetFontCharset(void* hFont, int& charset) override;
+ bool GetFaceName(void* hFont, CFX_ByteString* name) override;
+ bool GetFontCharset(void* hFont, int* charset) override;
protected:
void ScanPath(const CFX_ByteString& path);
diff --git a/core/fxge/ge/cfx_fontmapper.cpp b/core/fxge/ge/cfx_fontmapper.cpp
index e8fb988fdb..0cff344599 100644
--- a/core/fxge/ge/cfx_fontmapper.cpp
+++ b/core/fxge/ge/cfx_fontmapper.cpp
@@ -677,9 +677,9 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
if (!hFont)
return nullptr;
- m_pFontInfo->GetFaceName(hFont, SubstName);
+ m_pFontInfo->GetFaceName(hFont, &SubstName);
if (Charset == FXFONT_DEFAULT_CHARSET)
- m_pFontInfo->GetFontCharset(hFont, Charset);
+ m_pFontInfo->GetFontCharset(hFont, &Charset);
uint32_t ttc_size = m_pFontInfo->GetFontData(hFont, kTableTTCF, nullptr, 0);
uint32_t font_size = m_pFontInfo->GetFontData(hFont, 0, nullptr, 0);
if (font_size == 0 && ttc_size == 0) {
@@ -742,7 +742,7 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(uint32_t dwUnicode,
face = GetCachedTTCFace(hFont, 0x74746366, ttc_size, font_size);
} else {
CFX_ByteString SubstName;
- m_pFontInfo->GetFaceName(hFont, SubstName);
+ m_pFontInfo->GetFaceName(hFont, &SubstName);
face = GetCachedFace(hFont, SubstName, weight, bItalic, font_size);
}
m_pFontInfo->DeleteFont(hFont);
diff --git a/core/fxge/ifx_systemfontinfo.h b/core/fxge/ifx_systemfontinfo.h
index 1453590148..ca7ca2c455 100644
--- a/core/fxge/ifx_systemfontinfo.h
+++ b/core/fxge/ifx_systemfontinfo.h
@@ -42,8 +42,8 @@ class IFX_SystemFontInfo {
uint32_t table,
uint8_t* buffer,
uint32_t size) = 0;
- virtual bool GetFaceName(void* hFont, CFX_ByteString& name) = 0;
- virtual bool GetFontCharset(void* hFont, int& charset) = 0;
+ virtual bool GetFaceName(void* hFont, CFX_ByteString* name) = 0;
+ virtual bool GetFontCharset(void* hFont, int* charset) = 0;
virtual int GetFaceIndex(void* hFont);
virtual void DeleteFont(void* hFont) = 0;
};
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index 39533e1ef6..73a1ac6a0e 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -347,8 +347,8 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo {
uint32_t table,
uint8_t* buffer,
uint32_t size) override;
- bool GetFaceName(void* hFont, CFX_ByteString& name) override;
- bool GetFontCharset(void* hFont, int& charset) override;
+ bool GetFaceName(void* hFont, CFX_ByteString* name) override;
+ bool GetFontCharset(void* hFont, int* charset) override;
void DeleteFont(void* hFont) override;
bool IsOpenTypeFromDiv(const LOGFONTA* plf);
@@ -664,7 +664,7 @@ uint32_t CFX_Win32FontInfo::GetFontData(void* hFont,
return size;
}
-bool CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
+bool CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString* name) {
char facebuf[100];
HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
int ret = ::GetTextFaceA(m_hDC, 100, facebuf);
@@ -672,16 +672,16 @@ bool CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
if (ret == 0) {
return false;
}
- name = facebuf;
+ *name = facebuf;
return true;
}
-bool CFX_Win32FontInfo::GetFontCharset(void* hFont, int& charset) {
+bool CFX_Win32FontInfo::GetFontCharset(void* hFont, int* charset) {
TEXTMETRIC tm;
HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
::GetTextMetrics(m_hDC, &tm);
::SelectObject(m_hDC, hOldFont);
- charset = tm.tmCharSet;
+ *charset = tm.tmCharSet;
return true;
}
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index 750b41627e..1c380e59c1 100644
--- a/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -45,7 +45,7 @@ void CBA_FontMap::Initialize() {
int32_t nCharset = FXFONT_DEFAULT_CHARSET;
if (!m_pDefaultFont) {
- m_pDefaultFont = GetAnnotDefaultFont(m_sDefaultFontName);
+ m_pDefaultFont = GetAnnotDefaultFont(&m_sDefaultFontName);
if (m_pDefaultFont) {
if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) {
nCharset = pSubstFont->m_Charset;
@@ -83,7 +83,7 @@ void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont,
AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
}
-CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias,
+CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString* sFontAlias,
int32_t nCharset) {
if (m_pAnnotDict->GetStringFor("Subtype") != "Widget")
return nullptr;
@@ -109,7 +109,7 @@ CPDF_Document* CBA_FontMap::GetDocument() {
}
CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
- CFX_ByteString& sFontAlias,
+ CFX_ByteString* sFontAlias,
int32_t nCharset) {
if (!pResDict)
return nullptr;
@@ -138,7 +138,7 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
if (!pSubst)
continue;
if (pSubst->m_Charset == nCharset) {
- sFontAlias = csKey;
+ *sFontAlias = csKey;
pFind = pFont;
}
}
@@ -194,7 +194,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
}
}
-CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) {
+CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString* sAlias) {
CPDF_Dictionary* pAcroFormDict = nullptr;
const bool bWidget = (m_pAnnotDict->GetStringFor("Subtype") == "Widget");
if (bWidget) {
@@ -218,27 +218,26 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) {
CPDF_SimpleParser syntax(sDA.AsStringC());
syntax.FindTagParamFromStart("Tf", 2);
+
CFX_ByteString sFontName(syntax.GetWord());
- sAlias = PDF_NameDecode(sFontName).Mid(1);
- CPDF_Dictionary* pFontDict = nullptr;
+ *sAlias = PDF_NameDecode(sFontName).Mid(1);
+ CPDF_Dictionary* pFontDict = nullptr;
if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictFor("AP")) {
if (CPDF_Dictionary* pNormalDict = pAPDict->GetDictFor("N")) {
if (CPDF_Dictionary* pNormalResDict =
pNormalDict->GetDictFor("Resources")) {
if (CPDF_Dictionary* pResFontDict = pNormalResDict->GetDictFor("Font"))
- pFontDict = pResFontDict->GetDictFor(sAlias);
+ pFontDict = pResFontDict->GetDictFor(*sAlias);
}
}
}
-
if (bWidget && !pFontDict && pAcroFormDict) {
if (CPDF_Dictionary* pDRDict = pAcroFormDict->GetDictFor("DR")) {
if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDictFor("Font"))
- pFontDict = pDRFontDict->GetDictFor(sAlias);
+ pFontDict = pDRFontDict->GetDictFor(*sAlias);
}
}
-
return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
}
diff --git a/fpdfsdk/formfiller/cba_fontmap.h b/fpdfsdk/formfiller/cba_fontmap.h
index c0e569a0d3..09a5a38116 100644
--- a/fpdfsdk/formfiller/cba_fontmap.h
+++ b/fpdfsdk/formfiller/cba_fontmap.h
@@ -26,14 +26,14 @@ class CBA_FontMap : public CPWL_FontMap {
// CPWL_FontMap:
void Initialize() override;
CPDF_Document* GetDocument() override;
- CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias,
+ CPDF_Font* FindFontSameCharset(CFX_ByteString* sFontAlias,
int32_t nCharset) override;
void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias) override;
CPDF_Font* FindResFontSameCharset(CPDF_Dictionary* pResDict,
- CFX_ByteString& sFontAlias,
+ CFX_ByteString* sFontAlias,
int32_t nCharset);
- CPDF_Font* GetAnnotDefaultFont(CFX_ByteString& csNameTag);
+ CPDF_Font* GetAnnotDefaultFont(CFX_ByteString* csNameTag);
void AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias);
CPDF_Document* m_pDocument;
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index 2db4aaf787..8773d680ea 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -79,9 +79,10 @@ bool CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) {
int count = pElement->CountAttrs();
int i = 0;
for (i = 0; i < count; i++) {
- CFX_ByteString space, name;
+ CFX_ByteString space;
+ CFX_ByteString name;
CFX_WideString value;
- pElement->GetAttrByIndex(i, space, name, value);
+ pElement->GetAttrByIndex(i, &space, &name, &value);
if (space == "xmlns" && name == "adhocwf" &&
value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") {
CXML_Element* pVersion =
diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp
index 3d15ca3a41..6939eba14d 100644
--- a/fpdfsdk/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/fpdf_sysfontinfo.cpp
@@ -58,7 +58,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo {
return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size);
}
- bool GetFaceName(void* hFont, CFX_ByteString& name) override {
+ bool GetFaceName(void* hFont, CFX_ByteString* name) override {
if (!m_pInfo->GetFaceName)
return false;
uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, nullptr, 0);
@@ -66,16 +66,16 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo {
return false;
char* buffer = FX_Alloc(char, size);
size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size);
- name = CFX_ByteString(buffer, size);
+ *name = CFX_ByteString(buffer, size);
FX_Free(buffer);
return true;
}
- bool GetFontCharset(void* hFont, int& charset) override {
+ bool GetFontCharset(void* hFont, int* charset) override {
if (!m_pInfo->GetFontCharset)
return false;
- charset = m_pInfo->GetFontCharset(m_pInfo, hFont);
+ *charset = m_pInfo->GetFontCharset(m_pInfo, hFont);
return true;
}
@@ -155,7 +155,7 @@ static unsigned long DefaultGetFaceName(struct _FPDF_SYSFONTINFO* pThis,
unsigned long buf_size) {
CFX_ByteString name;
auto* pDefault = static_cast<FPDF_SYSFONTINFO_DEFAULT*>(pThis);
- if (!pDefault->m_pFontInfo->GetFaceName(hFont, name))
+ if (!pDefault->m_pFontInfo->GetFaceName(hFont, &name))
return 0;
if (name.GetLength() >= (long)buf_size)
return name.GetLength() + 1;
@@ -168,7 +168,7 @@ static unsigned long DefaultGetFaceName(struct _FPDF_SYSFONTINFO* pThis,
static int DefaultGetFontCharset(struct _FPDF_SYSFONTINFO* pThis, void* hFont) {
int charset;
auto* pDefault = static_cast<FPDF_SYSFONTINFO_DEFAULT*>(pThis);
- if (!pDefault->m_pFontInfo->GetFontCharset(hFont, charset))
+ if (!pDefault->m_pFontInfo->GetFontCharset(hFont, &charset))
return 0;
return charset;
}
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
index a7c42698cd..ddf496fbb0 100644
--- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp
+++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
@@ -180,10 +180,7 @@ int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName,
return nFontIndex;
CFX_ByteString sAlias;
- CPDF_Font* pFont = nullptr;
- if (bFind)
- pFont = FindFontSameCharset(sAlias, nCharset);
-
+ CPDF_Font* pFont = bFind ? FindFontSameCharset(&sAlias, nCharset) : nullptr;
if (!pFont) {
CFX_ByteString sTemp = sFontName;
pFont = AddFontToDocument(GetDocument(), sTemp, nCharset);
@@ -193,7 +190,7 @@ int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName,
return AddFontData(pFont, sAlias, nCharset);
}
-CPDF_Font* CPWL_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias,
+CPDF_Font* CPWL_FontMap::FindFontSameCharset(CFX_ByteString* sFontAlias,
int32_t nCharset) {
return nullptr;
}
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.h b/fpdfsdk/pdfwindow/PWL_FontMap.h
index c14fcd7cd3..21535305ae 100644
--- a/fpdfsdk/pdfwindow/PWL_FontMap.h
+++ b/fpdfsdk/pdfwindow/PWL_FontMap.h
@@ -53,7 +53,7 @@ class CPWL_FontMap : public IPVT_FontMap {
protected:
virtual void Initialize();
virtual CPDF_Document* GetDocument();
- virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias,
+ virtual CPDF_Font* FindFontSameCharset(CFX_ByteString* sFontAlias,
int32_t nCharset);
virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index 83742d9609..4ef819a46d 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -4568,8 +4568,7 @@ void CXFA_FM2JSContext::Uuid(CFXJSE_Value* pThis,
FX_GUID guid;
FX_GUID_CreateV4(&guid);
- CFX_ByteString bsUId;
- FX_GUID_ToString(&guid, bsUId, !!iNum);
+ CFX_ByteString bsUId = FX_GUID_ToString(&guid, !!iNum);
args.GetReturnValue()->SetString(bsUId.AsStringC());
}