summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-17 18:07:43 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-17 18:07:43 +0000
commit1f867bb6e2c7b42e529c907053e0b9aecdd219ac (patch)
tree63cafaabd6d69c46e4a91e3035f54e3ec48f368e /core
parent20736f7f5884cf1e2827543c92b6e47f8282aeaf (diff)
downloadpdfium-1f867bb6e2c7b42e529c907053e0b9aecdd219ac.tar.xz
Remove default arguments from CFPF_SkiaFontMgr.
Fix some nits as well. Change-Id: Idfe3e737bc737fe4ad42581aa735398fdc0ebab5 Reviewed-on: https://pdfium-review.googlesource.com/40510 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fxge/android/cfpf_skiafontmgr.cpp31
-rw-r--r--core/fxge/android/cfpf_skiafontmgr.h12
2 files changed, 19 insertions, 24 deletions
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index 0b49f6283c..880de6bc01 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -22,13 +22,12 @@
#include "core/fxge/android/cfpf_skiapathfont.h"
#include "core/fxge/fx_freetype.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-static unsigned long FPF_SkiaStream_Read(FXFT_Stream stream,
- unsigned long offset,
- unsigned char* buffer,
- unsigned long count) {
+namespace {
+
+unsigned long FPF_SkiaStream_Read(FXFT_Stream stream,
+ unsigned long offset,
+ unsigned char* buffer,
+ unsigned long count) {
if (count == 0)
return 0;
@@ -37,19 +36,15 @@ static unsigned long FPF_SkiaStream_Read(FXFT_Stream stream,
if (!pFileRead)
return 0;
- if (!pFileRead->ReadBlock(buffer, (FX_FILESIZE)offset,
- static_cast<size_t>(count)))
+ if (!pFileRead->ReadBlock(buffer, static_cast<FX_FILESIZE>(offset),
+ static_cast<size_t>(count))) {
return 0;
+ }
return count;
}
-static void FPF_SkiaStream_Close(FXFT_Stream stream) {}
-#ifdef __cplusplus
-};
-#endif
-
-namespace {
+void FPF_SkiaStream_Close(FXFT_Stream stream) {}
struct FPF_SKIAFONTMAP {
uint32_t dwFamily;
@@ -251,7 +246,7 @@ uint32_t FPF_SkiaGetFaceCharset(TT_OS2* pOS2) {
} // namespace
-CFPF_SkiaFontMgr::CFPF_SkiaFontMgr() : m_bLoaded(false), m_FTLibrary(nullptr) {}
+CFPF_SkiaFontMgr::CFPF_SkiaFontMgr() = default;
CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr() {
for (const auto& pair : m_FamilyFonts) {
@@ -448,7 +443,7 @@ void CFPF_SkiaFontMgr::ScanPath(const ByteString& path) {
}
void CFPF_SkiaFontMgr::ScanFile(const ByteString& file) {
- FXFT_Face face = GetFontFace(file.AsStringView());
+ FXFT_Face face = GetFontFace(file.AsStringView(), 0);
if (!face)
return;
CFPF_SkiaPathFont* pFontDesc = new CFPF_SkiaPathFont;
@@ -469,7 +464,7 @@ void CFPF_SkiaFontMgr::ReportFace(FXFT_Face face,
pFontDesc->m_dwStyle |= FXFONT_ITALIC;
if (FT_IS_FIXED_WIDTH(face))
pFontDesc->m_dwStyle |= FXFONT_FIXED_PITCH;
- TT_OS2* pOS2 = (TT_OS2*)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
+ TT_OS2* pOS2 = static_cast<TT_OS2*>(FT_Get_Sfnt_Table(face, ft_sfnt_os2));
if (pOS2) {
if (pOS2->ulCodePageRange1 & (1 << 31))
pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC;
diff --git a/core/fxge/android/cfpf_skiafontmgr.h b/core/fxge/android/cfpf_skiafontmgr.h
index 11ad47a360..5e0bce2d78 100644
--- a/core/fxge/android/cfpf_skiafontmgr.h
+++ b/core/fxge/android/cfpf_skiafontmgr.h
@@ -28,23 +28,23 @@ class CFPF_SkiaFontMgr {
CFPF_SkiaFont* CreateFont(const ByteStringView& bsFamilyname,
uint8_t uCharset,
uint32_t dwStyle,
- uint32_t dwMatch = 0);
+ uint32_t dwMatch);
bool InitFTLibrary();
FXFT_Face GetFontFace(const RetainPtr<IFX_SeekableReadStream>& pFileRead,
- int32_t iFaceIndex = 0);
- FXFT_Face GetFontFace(const ByteStringView& bsFile, int32_t iFaceIndex = 0);
+ int32_t iFaceIndex);
+ FXFT_Face GetFontFace(const ByteStringView& bsFile, int32_t iFaceIndex);
FXFT_Face GetFontFace(const uint8_t* pBuffer,
size_t szBuffer,
- int32_t iFaceIndex = 0);
+ int32_t iFaceIndex);
private:
void ScanPath(const ByteString& path);
void ScanFile(const ByteString& file);
void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor* pFontDesc);
- bool m_bLoaded;
- FXFT_Library m_FTLibrary;
+ bool m_bLoaded = false;
+ FXFT_Library m_FTLibrary = nullptr;
std::vector<CFPF_SkiaFontDescriptor*> m_FontFaces;
std::map<uint32_t, CFPF_SkiaFont*> m_FamilyFonts;
};