summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-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
11 files changed, 40 insertions, 42 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;
}