From ec8ff7d258ef25f7e3193572aeef220ff86784f0 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 7 Apr 2017 16:58:00 -0700 Subject: 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 Reviewed-by: Lei Zhang --- core/fxge/android/cfx_androidfontinfo.cpp | 8 ++++---- core/fxge/android/cfx_androidfontinfo.h | 4 ++-- core/fxge/ge/cfx_folderfontinfo.cpp | 8 ++++---- core/fxge/ge/cfx_folderfontinfo.h | 4 ++-- core/fxge/ge/cfx_fontmapper.cpp | 6 +++--- core/fxge/ifx_systemfontinfo.h | 4 ++-- core/fxge/win32/fx_win32_device.cpp | 12 ++++++------ 7 files changed, 23 insertions(+), 23 deletions(-) (limited to 'core/fxge') 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(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(hFont)->GetFamilyName(); + *name = static_cast(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(hFont)->GetCharset(); + *charset = static_cast(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(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; } -- cgit v1.2.3