summaryrefslogtreecommitdiff
path: root/xfa/fgas/font
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-06-23 12:40:16 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-23 12:40:16 -0700
commit85d1f2c2f9f1e746bedb1b6f03576613f54fbc27 (patch)
treeff5b393fb9b89f006327bee7bc8c955522defb67 /xfa/fgas/font
parent6e12478cb298c3a8277493ee79ae0b73d6df8554 (diff)
downloadpdfium-85d1f2c2f9f1e746bedb1b6f03576613f54fbc27.tar.xz
Remove NULL in xfa/
This CL converts all NULL's to nullptr. All instances of comparison to nullptr have been removed. Review-Url: https://codereview.chromium.org/2095653002
Diffstat (limited to 'xfa/fgas/font')
-rw-r--r--xfa/fgas/font/fgas_font.h26
-rw-r--r--xfa/fgas/font/fgas_fontutils.cpp2
-rw-r--r--xfa/fgas/font/fgas_gefont.cpp82
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.cpp104
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.h38
5 files changed, 127 insertions, 125 deletions
diff --git a/xfa/fgas/font/fgas_font.h b/xfa/fgas/font/fgas_font.h
index 89641d7c72..7fcfbd715b 100644
--- a/xfa/fgas/font/fgas_font.h
+++ b/xfa/fgas/font/fgas_font.h
@@ -88,25 +88,25 @@ class IFGAS_FontMgr {
virtual CFGAS_GEFont* GetDefFontByCodePage(
uint16_t wCodePage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) = 0;
+ const FX_WCHAR* pszFontFamily = nullptr) = 0;
virtual CFGAS_GEFont* GetDefFontByCharset(
uint8_t nCharset,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) = 0;
+ const FX_WCHAR* pszFontFamily = nullptr) = 0;
virtual CFGAS_GEFont* GetDefFontByUnicode(
FX_WCHAR wUnicode,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) = 0;
+ const FX_WCHAR* pszFontFamily = nullptr) = 0;
virtual CFGAS_GEFont* GetDefFontByLanguage(
uint16_t wLanguage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) = 0;
+ const FX_WCHAR* pszFontFamily = nullptr) = 0;
virtual CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage = 0xFFFF) = 0;
virtual CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, int32_t iLength) = 0;
virtual CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream,
- const FX_WCHAR* pszFontAlias = NULL,
+ const FX_WCHAR* pszFontAlias = nullptr,
uint32_t dwFontStyles = 0,
uint16_t wCodePage = 0,
FX_BOOL bSaveStream = FALSE) = 0;
@@ -127,23 +127,23 @@ class IFGAS_FontMgr {
virtual CFGAS_GEFont* GetDefFontByCodePage(
uint16_t wCodePage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) = 0;
+ const FX_WCHAR* pszFontFamily = nullptr) = 0;
virtual CFGAS_GEFont* GetDefFontByCharset(
uint8_t nCharset,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) = 0;
+ const FX_WCHAR* pszFontFamily = nullptr) = 0;
virtual CFGAS_GEFont* GetDefFontByUnicode(
FX_WCHAR wUnicode,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) = 0;
+ const FX_WCHAR* pszFontFamily = nullptr) = 0;
virtual CFGAS_GEFont* GetDefFontByLanguage(
uint16_t wLanguage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) = 0;
+ const FX_WCHAR* pszFontFamily = nullptr) = 0;
virtual CFGAS_GEFont* GetFontByCodePage(
uint16_t wCodePage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) = 0;
+ const FX_WCHAR* pszFontFamily = nullptr) = 0;
inline CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
@@ -152,15 +152,15 @@ class IFGAS_FontMgr {
virtual CFGAS_GEFont* GetFontByCharset(
uint8_t nCharset,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) = 0;
+ const FX_WCHAR* pszFontFamily = nullptr) = 0;
virtual CFGAS_GEFont* GetFontByUnicode(
FX_WCHAR wUnicode,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) = 0;
+ const FX_WCHAR* pszFontFamily = nullptr) = 0;
virtual CFGAS_GEFont* GetFontByLanguage(
uint16_t wLanguage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) = 0;
+ const FX_WCHAR* pszFontFamily = nullptr) = 0;
virtual void ClearFontCache() = 0;
virtual void RemoveFont(CFGAS_GEFont* pFont) = 0;
};
diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp
index bccaf2cdb6..c31e1e08ca 100644
--- a/xfa/fgas/font/fgas_fontutils.cpp
+++ b/xfa/fgas/font/fgas_fontutils.cpp
@@ -149,5 +149,5 @@ const FGAS_FONTUSB* FGAS_GetUnicodeBitField(FX_WCHAR wUnicode) {
return &usb;
}
} while (iStart <= iEnd);
- return NULL;
+ return nullptr;
}
diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp
index 7863ef715b..a7d8c49cbf 100644
--- a/xfa/fgas/font/fgas_gefont.cpp
+++ b/xfa/fgas/font/fgas_gefont.cpp
@@ -16,15 +16,15 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(const FX_WCHAR* pszFontFamily,
uint16_t wCodePage,
IFGAS_FontMgr* pFontMgr) {
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- if (NULL != pFontMgr) {
+ if (pFontMgr) {
return pFontMgr->GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily);
}
- return NULL;
+ return nullptr;
#else
CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr);
if (!pFont->LoadFontInternal(pszFontFamily, dwFontStyles, wCodePage)) {
pFont->Release();
- return NULL;
+ return nullptr;
}
return pFont;
#endif
@@ -36,7 +36,7 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(CFX_Font* pExtFont,
CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr);
if (!pFont->LoadFontInternal(pExtFont)) {
pFont->Release();
- return NULL;
+ return nullptr;
}
return pFont;
}
@@ -73,17 +73,17 @@ CFGAS_GEFont::CFGAS_GEFont(IFGAS_FontMgr* pFontMgr)
m_bUseLogFontStyle(FALSE),
m_dwLogFontStyle(0),
#endif
- m_pFont(NULL),
+ m_pFont(nullptr),
m_pFontMgr(pFontMgr),
m_iRefCount(1),
m_bExtFont(FALSE),
- m_pStream(NULL),
- m_pFileRead(NULL),
- m_pFontEncoding(NULL),
- m_pCharWidthMap(NULL),
- m_pRectArray(NULL),
- m_pBBoxMap(NULL),
- m_pProvider(NULL) {
+ m_pStream(nullptr),
+ m_pFileRead(nullptr),
+ m_pFontEncoding(nullptr),
+ m_pCharWidthMap(nullptr),
+ m_pRectArray(nullptr),
+ m_pBBoxMap(nullptr),
+ m_pProvider(nullptr) {
}
CFGAS_GEFont::CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles)
@@ -92,17 +92,17 @@ CFGAS_GEFont::CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles)
m_bUseLogFontStyle(FALSE),
m_dwLogFontStyle(0),
#endif
- m_pFont(NULL),
+ m_pFont(nullptr),
m_pFontMgr(src.m_pFontMgr),
m_iRefCount(1),
m_bExtFont(FALSE),
- m_pStream(NULL),
- m_pFileRead(NULL),
- m_pFontEncoding(NULL),
- m_pCharWidthMap(NULL),
- m_pRectArray(NULL),
- m_pBBoxMap(NULL),
- m_pProvider(NULL) {
+ m_pStream(nullptr),
+ m_pFileRead(nullptr),
+ m_pFontEncoding(nullptr),
+ m_pCharWidthMap(nullptr),
+ m_pRectArray(nullptr),
+ m_pBBoxMap(nullptr),
+ m_pProvider(nullptr) {
ASSERT(src.m_pFont);
m_pFont = new CFX_Font;
m_pFont->LoadClone(src.m_pFont);
@@ -141,7 +141,7 @@ CFGAS_GEFont::~CFGAS_GEFont() {
void CFGAS_GEFont::Release() {
if (--m_iRefCount < 1) {
- if (m_pFontMgr != NULL) {
+ if (m_pFontMgr) {
m_pFontMgr->RemoveFont(this);
}
delete this;
@@ -160,7 +160,7 @@ FX_BOOL CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily,
return FALSE;
}
CFX_ByteString csFontFamily;
- if (pszFontFamily != NULL) {
+ if (pszFontFamily) {
csFontFamily = CFX_ByteString::FromUnicode(pszFontFamily);
}
uint32_t dwFlags = 0;
@@ -276,7 +276,7 @@ void CFGAS_GEFont::GetFamilyName(CFX_WideString& wsFamily) const {
}
uint32_t CFGAS_GEFont::GetFontStyles() const {
- ASSERT(m_pFont != NULL);
+ ASSERT(m_pFont);
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
if (m_bUseLogFontStyle) {
return m_dwLogFontStyle;
@@ -309,14 +309,14 @@ FX_BOOL CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode,
int32_t& iWidth,
FX_BOOL bRecursive,
FX_BOOL bCharCode) {
- ASSERT(m_pCharWidthMap != NULL);
+ ASSERT(m_pCharWidthMap);
iWidth = m_pCharWidthMap->GetAt(wUnicode, 0);
if (iWidth < 1) {
if (!m_pProvider ||
!m_pProvider->GetCharWidth(this, wUnicode, iWidth, bCharCode)) {
- CFGAS_GEFont* pFont = NULL;
+ CFGAS_GEFont* pFont = nullptr;
int32_t iGlyph = GetGlyphIndex(wUnicode, TRUE, &pFont, bCharCode);
- if (iGlyph != 0xFFFF && pFont != NULL) {
+ if (iGlyph != 0xFFFF && pFont) {
if (pFont == this) {
iWidth = m_pFont->GetGlyphWidth(iGlyph);
if (iWidth < 0) {
@@ -345,13 +345,13 @@ FX_BOOL CFGAS_GEFont::GetCharBBoxInternal(FX_WCHAR wUnicode,
CFX_Rect& bbox,
FX_BOOL bRecursive,
FX_BOOL bCharCode) {
- ASSERT(m_pRectArray != NULL);
- ASSERT(m_pBBoxMap != NULL);
- void* pRect = NULL;
+ ASSERT(m_pRectArray);
+ ASSERT(m_pBBoxMap);
+ void* pRect = nullptr;
if (!m_pBBoxMap->Lookup((void*)(uintptr_t)wUnicode, pRect)) {
- CFGAS_GEFont* pFont = NULL;
+ CFGAS_GEFont* pFont = nullptr;
int32_t iGlyph = GetGlyphIndex(wUnicode, TRUE, &pFont, bCharCode);
- if (iGlyph != 0xFFFF && pFont != NULL) {
+ if (iGlyph != 0xFFFF && pFont) {
if (pFont == this) {
FX_RECT rtBBox;
if (m_pFont->GetGlyphBBox(iGlyph, rtBBox)) {
@@ -390,22 +390,22 @@ int32_t CFGAS_GEFont::GetItalicAngle() const {
return m_pFont->GetSubstFont()->m_ItalicAngle;
}
int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bCharCode) {
- return GetGlyphIndex(wUnicode, TRUE, NULL, bCharCode);
+ return GetGlyphIndex(wUnicode, TRUE, nullptr, bCharCode);
}
int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode,
FX_BOOL bRecursive,
CFGAS_GEFont** ppFont,
FX_BOOL bCharCode) {
- ASSERT(m_pFontEncoding != NULL);
+ ASSERT(m_pFontEncoding);
int32_t iGlyphIndex = m_pFontEncoding->GlyphFromCharCode(wUnicode);
if (iGlyphIndex > 0) {
- if (ppFont != NULL) {
+ if (ppFont) {
*ppFont = this;
}
return iGlyphIndex;
}
const FGAS_FONTUSB* pFontUSB = FGAS_GetUnicodeBitField(wUnicode);
- if (pFontUSB == NULL) {
+ if (!pFontUSB) {
return 0xFFFF;
}
uint16_t wBitField = pFontUSB->wBitField;
@@ -415,7 +415,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode,
auto it = m_FontMapper.find(wUnicode);
CFGAS_GEFont* pFont = it != m_FontMapper.end() ? it->second : nullptr;
if (pFont && pFont != this) {
- iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, NULL, bCharCode);
+ iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, nullptr, bCharCode);
if (iGlyphIndex != 0xFFFF) {
int32_t i = m_SubstFonts.Find(pFont);
if (i > -1) {
@@ -436,7 +436,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode,
CFGAS_GEFont* pFont = m_pFontMgr->GetFontByUnicode(
wUnicode, GetFontStyles(), wsFamily.c_str());
if (!pFont)
- pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), NULL);
+ pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), nullptr);
#endif
if (pFont) {
if (pFont == this) {
@@ -446,7 +446,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode,
m_FontMapper[wUnicode] = pFont;
int32_t i = m_SubstFonts.GetSize();
m_SubstFonts.Add(pFont);
- iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, NULL, bCharCode);
+ iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, nullptr, bCharCode);
if (iGlyphIndex != 0xFFFF) {
iGlyphIndex |= ((i + 1) << 24);
if (ppFont)
@@ -466,13 +466,13 @@ int32_t CFGAS_GEFont::GetDescent() const {
void CFGAS_GEFont::Reset() {
for (int32_t i = 0; i < m_SubstFonts.GetSize(); i++)
m_SubstFonts[i]->Reset();
- if (m_pCharWidthMap != NULL) {
+ if (m_pCharWidthMap) {
m_pCharWidthMap->RemoveAll();
}
- if (m_pBBoxMap != NULL) {
+ if (m_pBBoxMap) {
m_pBBoxMap->RemoveAll();
}
- if (m_pRectArray != NULL) {
+ if (m_pRectArray) {
m_pRectArray->RemoveAll();
}
}
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index 34f5078962..47ec72b807 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -28,7 +28,7 @@ CFGAS_StdFontMgrImp::CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator)
m_StreamFonts(4),
m_DeriveFonts(4) {
if (m_pEnumerator) {
- m_pEnumerator(m_FontFaces, NULL, 0xFEFF);
+ m_pEnumerator(m_FontFaces, nullptr, 0xFEFF);
}
}
@@ -53,18 +53,19 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCodePage(
uint32_t dwFontStyles,
const FX_WCHAR* pszFontFamily) {
uint32_t dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles);
- CFGAS_GEFont* pFont = NULL;
+ CFGAS_GEFont* pFont = nullptr;
if (m_CPFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) {
- return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : NULL;
- }
- FX_FONTDESCRIPTOR const* pFD;
- if ((pFD = FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage)) == NULL) {
- if ((pFD = FindFont(NULL, dwFontStyles, TRUE, wCodePage)) == NULL) {
- if ((pFD = FindFont(NULL, dwFontStyles, FALSE, wCodePage)) == NULL)
- return NULL;
- }
+ return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : nullptr;
}
- ASSERT(pFD);
+ FX_FONTDESCRIPTOR const* pFD =
+ FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage);
+ if (!pFD)
+ pFD = FindFont(nullptr, dwFontStyles, TRUE, wCodePage);
+ if (!pFD)
+ pFD = FindFont(nullptr, dwFontStyles, FALSE, wCodePage);
+ if (!pFD)
+ return nullptr;
+
pFont =
CFGAS_GEFont::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this);
if (pFont) {
@@ -74,7 +75,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCodePage(
m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
return LoadFont(pFont, dwFontStyles, wCodePage);
}
- return NULL;
+ return nullptr;
}
CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCharset(
@@ -137,18 +138,17 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily,
uint16_t wCodePage) {
uint32_t dwHash =
FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage);
- CFGAS_GEFont* pFont = NULL;
+ CFGAS_GEFont* pFont = nullptr;
if (m_FamilyFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) {
- return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : NULL;
+ return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : nullptr;
}
- FX_FONTDESCRIPTOR const* pFD = NULL;
- if ((pFD = FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage)) == NULL) {
- if ((pFD = FindFont(pszFontFamily, dwFontStyles, FALSE, wCodePage)) ==
- NULL) {
- return NULL;
- }
- }
- ASSERT(pFD);
+ FX_FONTDESCRIPTOR const* pFD =
+ FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage);
+ if (!pFD)
+ pFD = FindFont(pszFontFamily, dwFontStyles, FALSE, wCodePage);
+ if (!pFD)
+ return nullptr;
+
if (wCodePage == 0xFFFF) {
wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet);
}
@@ -161,13 +161,13 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily,
m_CPFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
return LoadFont(pFont, dwFontStyles, wCodePage);
}
- return NULL;
+ return nullptr;
}
CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const uint8_t* pBuffer,
int32_t iLength) {
ASSERT(pBuffer && iLength > 0);
- CFGAS_GEFont* pFont = NULL;
+ CFGAS_GEFont* pFont = nullptr;
if (m_BufferFonts.Lookup((void*)pBuffer, (void*&)pFont)) {
if (pFont) {
return pFont->Retain();
@@ -179,7 +179,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const uint8_t* pBuffer,
m_BufferFonts.SetAt((void*)pBuffer, pFont);
return pFont->Retain();
}
- return NULL;
+ return nullptr;
}
CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream,
@@ -188,7 +188,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream,
uint16_t wCodePage,
FX_BOOL bSaveStream) {
ASSERT(pFontStream && pFontStream->GetLength() > 0);
- CFGAS_GEFont* pFont = NULL;
+ CFGAS_GEFont* pFont = nullptr;
if (m_StreamFonts.Lookup((void*)pFontStream, (void*&)pFont)) {
if (pFont) {
if (pszFontAlias) {
@@ -210,7 +210,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream,
}
return LoadFont(pFont, dwFontStyles, wCodePage);
}
- return NULL;
+ return nullptr;
}
CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(CFGAS_GEFont* pSrcFont,
@@ -224,7 +224,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(CFGAS_GEFont* pSrcFont,
(void*)(uintptr_t)wCodePage};
uint32_t dwHash = FX_HashCode_GetA(
CFX_ByteStringC((uint8_t*)buffer, sizeof(buffer)), false);
- CFGAS_GEFont* pFont = NULL;
+ CFGAS_GEFont* pFont = nullptr;
if (m_DeriveFonts.GetCount() > 0) {
m_DeriveFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont);
if (pFont) {
@@ -241,7 +241,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(CFGAS_GEFont* pSrcFont,
}
return pFont;
}
- return NULL;
+ return nullptr;
}
void CFGAS_StdFontMgrImp::ClearFontCache() {
@@ -255,7 +255,7 @@ void CFGAS_StdFontMgrImp::RemoveFont(CFX_MapPtrToPtr& fontMap,
void* pKey;
void* pFind;
while (pos) {
- pFind = NULL;
+ pFind = nullptr;
fontMap.GetNextAssoc(pos, pKey, pFind);
if (pFind != (void*)pFont) {
continue;
@@ -300,10 +300,10 @@ FX_FONTDESCRIPTOR const* CFGAS_StdFontMgrImp::FindFont(
if (pszFontFamily && m_pEnumerator) {
CFX_FontDescriptors namedFonts;
m_pEnumerator(namedFonts, pszFontFamily, wUnicode);
- params.pwsFamily = NULL;
+ params.pwsFamily = nullptr;
pDesc = FX_DefFontMatcher(&params, namedFonts);
- if (pDesc == NULL) {
- return NULL;
+ if (!pDesc) {
+ return nullptr;
}
for (int32_t i = m_FontFaces.GetSize() - 1; i >= 0; i--) {
FX_FONTDESCRIPTOR const* pMatch = m_FontFaces.GetPtrAt(i);
@@ -314,12 +314,12 @@ FX_FONTDESCRIPTOR const* CFGAS_StdFontMgrImp::FindFont(
int index = m_FontFaces.Add(*pDesc);
return m_FontFaces.GetPtrAt(index);
}
- return NULL;
+ return nullptr;
}
FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams,
const CFX_FontDescriptors& fonts) {
- FX_FONTDESCRIPTOR const* pBestFont = NULL;
+ FX_FONTDESCRIPTOR const* pBestFont = nullptr;
int32_t iBestSimilar = 0;
FX_BOOL bMatchStyle =
(pParams->dwMatchFlags & FX_FONTMATCHPARA_MacthStyle) > 0;
@@ -370,7 +370,7 @@ FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams,
pBestFont = pFont;
}
}
- return iBestSimilar < 1 ? NULL : pBestFont;
+ return iBestSimilar < 1 ? nullptr : pBestFont;
}
int32_t FX_GetSimilarValue(FX_FONTDESCRIPTOR const* pFont,
@@ -444,7 +444,7 @@ static int32_t CALLBACK FX_GdiFontEnumProc(ENUMLOGFONTEX* lpelfe,
static void FX_EnumGdiFonts(CFX_FontDescriptors& fonts,
const FX_WCHAR* pwsFaceName,
FX_WCHAR wUnicode) {
- HDC hDC = ::GetDC(NULL);
+ HDC hDC = ::GetDC(nullptr);
LOGFONTW lfFind;
FXSYS_memset(&lfFind, 0, sizeof(lfFind));
lfFind.lfCharSet = DEFAULT_CHARSET;
@@ -454,7 +454,7 @@ static void FX_EnumGdiFonts(CFX_FontDescriptors& fonts,
}
EnumFontFamiliesExW(hDC, (LPLOGFONTW)&lfFind,
(FONTENUMPROCW)FX_GdiFontEnumProc, (LPARAM)&fonts, 0);
- ::ReleaseDC(NULL, hDC);
+ ::ReleaseDC(nullptr, hDC);
}
FX_LPEnumAllFonts FX_GetDefFontEnumerator() {
@@ -488,10 +488,10 @@ CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() {}
CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() {
Restart:
void* pCurHandle =
- m_FolderQueue.GetSize() == 0
- ? NULL
- : m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle;
- if (NULL == pCurHandle) {
+ m_FolderQueue.GetSize() != 0
+ ? m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle
+ : nullptr;
+ if (!pCurHandle) {
if (m_FolderPaths.GetSize() < 1) {
return "";
}
@@ -531,7 +531,7 @@ Restart:
m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath +
bsFolderSpearator + bsName;
hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath.c_str());
- if (hpp.pFileHandle == NULL) {
+ if (!hpp.pFileHandle) {
continue;
}
m_FolderQueue.Add(hpp);
@@ -548,7 +548,7 @@ Restart:
FX_POSITION CFX_FontSourceEnum_File::GetStartPosition() {
m_wsNext = GetNextFile().UTF8Decode();
- if (0 == m_wsNext.GetLength()) {
+ if (m_wsNext.GetLength() == 0) {
return (FX_POSITION)0;
}
return (FX_POSITION)-1;
@@ -557,7 +557,7 @@ FX_POSITION CFX_FontSourceEnum_File::GetStartPosition() {
IFX_FileAccess* CFX_FontSourceEnum_File::GetNext(FX_POSITION& pos) {
IFX_FileAccess* pAccess = FX_CreateDefaultFileAccess(m_wsNext.AsStringC());
m_wsNext = GetNextFile().UTF8Decode();
- pos = 0 != m_wsNext.GetLength() ? pAccess : NULL;
+ pos = m_wsNext.GetLength() != 0 ? pAccess : nullptr;
return pAccess;
}
@@ -742,7 +742,7 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode(
uint32_t dwFontStyles,
const FX_WCHAR* pszFontFamily) {
CFGAS_GEFont* pFont = nullptr;
- if (m_FailedUnicodes2NULL.Lookup(wUnicode, pFont))
+ if (m_FailedUnicodes2Nullptr.Lookup(wUnicode, pFont))
return nullptr;
const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wUnicode);
uint16_t wCodePage = x ? x->wCodePage : 0xFFFF;
@@ -785,7 +785,7 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode(
return pFont;
}
if (!pszFontFamily)
- m_FailedUnicodes2NULL.SetAt(wUnicode, nullptr);
+ m_FailedUnicodes2Nullptr.SetAt(wUnicode, nullptr);
return nullptr;
}
@@ -1131,7 +1131,7 @@ void CFGAS_FontMgrImp::ClearFontCache() {
}
void CFGAS_FontMgrImp::RemoveFont(CFGAS_GEFont* pEFont) {
- if (NULL == pEFont) {
+ if (!pEFont) {
return;
}
IFX_FileRead* pFileRead;
@@ -1145,10 +1145,10 @@ void CFGAS_FontMgrImp::RemoveFont(CFGAS_GEFont* pEFont) {
uint32_t dwHash;
CFX_ArrayTemplate<CFGAS_GEFont*>* pFonts;
m_Hash2Fonts.GetNextAssoc(pos, dwHash, pFonts);
- if (NULL != pFonts) {
+ if (pFonts) {
for (int32_t i = 0; i < pFonts->GetSize(); i++) {
if (pFonts->GetAt(i) == pEFont) {
- pFonts->SetAt(i, NULL);
+ pFonts->SetAt(i, nullptr);
}
}
} else {
@@ -1239,7 +1239,7 @@ uint32_t CFGAS_FontMgrImp::GetFlags(FXFT_Face pFace) {
void CFGAS_FontMgrImp::GetNames(const uint8_t* name_table,
CFX_WideStringArray& Names) {
- if (NULL == name_table) {
+ if (!name_table) {
return;
}
uint8_t* lpTable = (uint8_t*)name_table;
@@ -1369,7 +1369,7 @@ void CFGAS_FontMgrImp::GetUSBCSB(FXFT_Face pFace,
uint32_t* USB,
uint32_t* CSB) {
TT_OS2* pOS2 = (TT_OS2*)FT_Get_Sfnt_Table(pFace, ft_sfnt_os2);
- if (NULL != pOS2) {
+ if (pOS2) {
USB[0] = pOS2->ulUnicodeRange1;
USB[1] = pOS2->ulUnicodeRange2;
USB[2] = pOS2->ulUnicodeRange3;
diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h
index f66729e21b..8c83884236 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.h
+++ b/xfa/fgas/font/fgas_stdfontmgr.h
@@ -30,25 +30,25 @@ class CFGAS_StdFontMgrImp : public IFGAS_FontMgr {
CFGAS_GEFont* GetDefFontByCodePage(
uint16_t wCodePage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) override;
+ const FX_WCHAR* pszFontFamily = nullptr) override;
CFGAS_GEFont* GetDefFontByCharset(
uint8_t nCharset,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) override;
+ const FX_WCHAR* pszFontFamily = nullptr) override;
CFGAS_GEFont* GetDefFontByUnicode(
FX_WCHAR wUnicode,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) override;
+ const FX_WCHAR* pszFontFamily = nullptr) override;
CFGAS_GEFont* GetDefFontByLanguage(
uint16_t wLanguage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) override;
+ const FX_WCHAR* pszFontFamily = nullptr) override;
CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage = 0xFFFF) override;
CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, int32_t iLength) override;
CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream,
- const FX_WCHAR* pszFontAlias = NULL,
+ const FX_WCHAR* pszFontAlias = nullptr,
uint32_t dwFontStyles = 0,
uint16_t wCodePage = 0,
FX_BOOL bSaveStream = FALSE) override;
@@ -152,33 +152,35 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr {
CFGAS_GEFont* GetDefFontByCodePage(
uint16_t wCodePage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) override;
+ const FX_WCHAR* pszFontFamily = nullptr) override;
CFGAS_GEFont* GetDefFontByCharset(
uint8_t nCharset,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) override;
+ const FX_WCHAR* pszFontFamily = nullptr) override;
CFGAS_GEFont* GetDefFontByUnicode(
FX_WCHAR wUnicode,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) override;
+ const FX_WCHAR* pszFontFamily = nullptr) override;
CFGAS_GEFont* GetDefFontByLanguage(
uint16_t wLanguage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) override;
+ const FX_WCHAR* pszFontFamily = nullptr) override;
CFGAS_GEFont* GetFontByCodePage(
uint16_t wCodePage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) override;
- CFGAS_GEFont* GetFontByCharset(uint8_t nCharset,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) override;
- CFGAS_GEFont* GetFontByUnicode(FX_WCHAR wUnicode,
- uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) override;
+ const FX_WCHAR* pszFontFamily = nullptr) override;
+ CFGAS_GEFont* GetFontByCharset(
+ uint8_t nCharset,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = nullptr) override;
+ CFGAS_GEFont* GetFontByUnicode(
+ FX_WCHAR wUnicode,
+ uint32_t dwFontStyles,
+ const FX_WCHAR* pszFontFamily = nullptr) override;
CFGAS_GEFont* GetFontByLanguage(
uint16_t wLanguage,
uint32_t dwFontStyles,
- const FX_WCHAR* pszFontFamily = NULL) override;
+ const FX_WCHAR* pszFontFamily = nullptr) override;
void ClearFontCache() override;
void RemoveFont(CFGAS_GEFont* pFont) override;
@@ -222,7 +224,7 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr {
CFX_MapPtrTemplate<uint32_t, CFX_FontDescriptorInfos*> m_Hash2CandidateList;
CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<CFGAS_GEFont*>*> m_Hash2Fonts;
CFX_MapPtrTemplate<CFGAS_GEFont*, IFX_FileRead*> m_IFXFont2FileRead;
- CFX_MapPtrTemplate<FX_WCHAR, CFGAS_GEFont*> m_FailedUnicodes2NULL;
+ CFX_MapPtrTemplate<FX_WCHAR, CFGAS_GEFont*> m_FailedUnicodes2Nullptr;
CFX_FontSourceEnum_File* const m_pFontSource;
};
#endif