diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-27 12:26:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-27 12:26:01 -0700 |
commit | 43854a5073602a4613131aa6dbac5f7b9a095bcd (patch) | |
tree | 653ebf0cd690e13d1ca9e315ffeb34f8ac85cfbb /xfa/fgas/font | |
parent | b2f6f9158f54cee1825830c7ed57fe9d89cff26e (diff) | |
download | pdfium-43854a5073602a4613131aa6dbac5f7b9a095bcd.tar.xz |
Standardize on ASSERT.
There are currently three ways to assert in the code (ASSERT, FXSYS_assert and
assert). This CL standardizes on ASSERT. The benefit of ASSERT is that it can
be overridden if the platform requies and we can pickup the Chromium version
if it has already been defined in the build.
This does change behaviour. Currently FXSYS_assert is always defined but ASSERT
is only defined in debug builds. So, the FXSYS_assert's would fire in Release
builds. That will no longer happen.
BUG=pdfium:219
Review-Url: https://codereview.chromium.org/1914303003
Diffstat (limited to 'xfa/fgas/font')
-rw-r--r-- | xfa/fgas/font/fgas_fontutils.cpp | 2 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_gefont.cpp | 14 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_stdfontmgr.cpp | 16 |
3 files changed, 16 insertions, 16 deletions
diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp index 21d5d0b5a5..bccaf2cdb6 100644 --- a/xfa/fgas/font/fgas_fontutils.cpp +++ b/xfa/fgas/font/fgas_fontutils.cpp @@ -136,7 +136,7 @@ static const FGAS_FONTUSB g_FXGdiFontUSBTable[] = { const FGAS_FONTUSB* FGAS_GetUnicodeBitField(FX_WCHAR wUnicode) { int32_t iEnd = sizeof(g_FXGdiFontUSBTable) / sizeof(FGAS_FONTUSB) - 1; - FXSYS_assert(iEnd >= 0); + ASSERT(iEnd >= 0); int32_t iStart = 0, iMid; do { iMid = (iStart + iEnd) / 2; diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp index ed41076535..7bf877f8c2 100644 --- a/xfa/fgas/font/fgas_gefont.cpp +++ b/xfa/fgas/font/fgas_gefont.cpp @@ -130,8 +130,8 @@ CFX_GEFont::CFX_GEFont(const CFX_GEFont& src, uint32_t dwFontStyles) m_SubstFonts(), m_FontMapper(16) { m_pFont = new CFX_Font; - FXSYS_assert(m_pFont != NULL); - FXSYS_assert(src.m_pFont != NULL); + ASSERT(m_pFont != NULL); + ASSERT(src.m_pFont != NULL); m_pFont->LoadClone(src.m_pFont); CFX_SubstFont* pSubst = m_pFont->GetSubstFont(); if (!pSubst) { @@ -357,7 +357,7 @@ void CFX_GEFont::GetPsName(CFX_WideString& wsName) const { wsName = m_pFont->GetPsName(); } uint32_t CFX_GEFont::GetFontStyles() const { - FXSYS_assert(m_pFont != NULL); + ASSERT(m_pFont != NULL); #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (m_bUseLogFontStyle) { return m_dwLogFontStyle; @@ -390,7 +390,7 @@ FX_BOOL CFX_GEFont::GetCharWidth(FX_WCHAR wUnicode, int32_t& iWidth, FX_BOOL bRecursive, FX_BOOL bCharCode) { - FXSYS_assert(m_pCharWidthMap != NULL); + ASSERT(m_pCharWidthMap != NULL); iWidth = m_pCharWidthMap->GetAt(wUnicode, 0); if (iWidth < 1) { if (!m_pProvider || @@ -426,8 +426,8 @@ FX_BOOL CFX_GEFont::GetCharBBox(FX_WCHAR wUnicode, CFX_Rect& bbox, FX_BOOL bRecursive, FX_BOOL bCharCode) { - FXSYS_assert(m_pRectArray != NULL); - FXSYS_assert(m_pBBoxMap != NULL); + ASSERT(m_pRectArray != NULL); + ASSERT(m_pBBoxMap != NULL); void* pRect = NULL; if (!m_pBBoxMap->Lookup((void*)(uintptr_t)wUnicode, pRect)) { IFX_Font* pFont = NULL; @@ -478,7 +478,7 @@ int32_t CFX_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bRecursive, IFX_Font** ppFont, FX_BOOL bCharCode) { - FXSYS_assert(m_pFontEncoding != NULL); + ASSERT(m_pFontEncoding != NULL); int32_t iGlyphIndex = m_pFontEncoding->GlyphFromCharCode(wUnicode); if (iGlyphIndex > 0) { if (ppFont != NULL) { diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index 4b2a1422d2..dedc8b0ad2 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -63,7 +63,7 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByCodePage( return NULL; } } - FXSYS_assert(pFD != NULL); + ASSERT(pFD != NULL); pFont = IFX_Font::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this); if (pFont != NULL) { m_Fonts.Add(pFont); @@ -144,7 +144,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, return NULL; } } - FXSYS_assert(pFD != NULL); + ASSERT(pFD != NULL); if (wCodePage == 0xFFFF) { wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet); } @@ -159,7 +159,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, return NULL; } IFX_Font* CFX_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, int32_t iLength) { - FXSYS_assert(pBuffer != NULL && iLength > 0); + ASSERT(pBuffer != NULL && iLength > 0); IFX_Font* pFont = NULL; if (m_BufferFonts.Lookup((void*)pBuffer, (void*&)pFont)) { if (pFont != NULL) { @@ -175,7 +175,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, int32_t iLength) { return NULL; } IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFileName) { - FXSYS_assert(pszFileName != NULL); + ASSERT(pszFileName != NULL); uint32_t dwHash = FX_HashCode_GetW(pszFileName, false); IFX_Font* pFont = NULL; if (m_FileFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { @@ -196,7 +196,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, uint32_t dwFontStyles, uint16_t wCodePage, FX_BOOL bSaveStream) { - FXSYS_assert(pFontStream != NULL && pFontStream->GetLength() > 0); + ASSERT(pFontStream != NULL && pFontStream->GetLength() > 0); IFX_Font* pFont = NULL; if (m_StreamFonts.Lookup((void*)pFontStream, (void*&)pFont)) { if (pFont != NULL) { @@ -224,7 +224,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Font* pSrcFont, uint32_t dwFontStyles, uint16_t wCodePage) { - FXSYS_assert(pSrcFont != NULL); + ASSERT(pSrcFont != NULL); if (pSrcFont->GetFontStyles() == dwFontStyles) { return pSrcFont->Retain(); } @@ -1191,7 +1191,7 @@ int32_t CFX_FontMgrImp::CalcPenalty(CFX_FontDescriptor* pInstalled, ((0 == wCodePage || 0xFFFF == wCodePage) ? (uint16_t)-1 : FX_GetCodePageBit(wCodePage)); if (wBit != (uint16_t)-1) { - FXSYS_assert(wBit < 64); + ASSERT(wBit < 64); if (0 == (pInstalled->m_dwCsb[wBit / 32] & (1 << (wBit % 32)))) { nPenalty += 0xFFFF; } else { @@ -1202,7 +1202,7 @@ int32_t CFX_FontMgrImp::CalcPenalty(CFX_FontDescriptor* pInstalled, ((0 == wcUnicode || 0xFFFE == wcUnicode) ? (uint16_t)999 : FX_GetUnicodeBit(wcUnicode)); if (wBit != (uint16_t)999) { - FXSYS_assert(wBit < 128); + ASSERT(wBit < 128); if (0 == (pInstalled->m_dwUsb[wBit / 32] & (1 << (wBit % 32)))) { nPenalty += 0xFFFF; } else { |