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 /core/fpdfapi | |
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 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 14 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_colorspace.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_countedobject.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_document.cpp | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 3b5012fdec..2c4dc32fde 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -193,7 +193,7 @@ int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument, FX_BOOL bCompress) { FX_FILESIZE offset = 0; int32_t len = 0; - FXSYS_assert(pDocument && pFile); + ASSERT(pDocument && pFile); CPDF_Parser* pParser = (CPDF_Parser*)pDocument->GetParser(); if (pParser) { CPDF_Dictionary* p = pParser->GetTrailer(); @@ -283,7 +283,7 @@ int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, if (!pEncryptDict) { return 0; } - FXSYS_assert(pFile); + ASSERT(pFile); FX_FILESIZE offset = 0; int32_t len = 0; if (pFile->AppendString("/Encrypt") < 0) { @@ -538,7 +538,7 @@ void CPDF_ObjectStream::CompressIndirectObject(uint32_t dwObjNum, } FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) { - FXSYS_assert(pCreator); + ASSERT(pCreator); if (m_Items.empty()) return 0; @@ -1467,7 +1467,7 @@ void CPDF_Creator::AppendNewObjNum(uint32_t objbum) { m_NewObjNumArray.InsertAt(iFind, objbum); } int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) { - FXSYS_assert(m_iStage > -1 || m_iStage < 20); + ASSERT(m_iStage > -1 || m_iStage < 20); if (m_iStage == 0) { if (!m_pParser) { m_dwFlags &= ~FPDFCREATE_INCREMENTAL; @@ -1562,7 +1562,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) { return m_iStage; } int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause* pPause) { - FXSYS_assert(m_iStage >= 20 || m_iStage < 30); + ASSERT(m_iStage >= 20 || m_iStage < 30); if (m_iStage == 20) { if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 && m_pParser) { m_Pos = (void*)(uintptr_t)0; @@ -1609,7 +1609,7 @@ int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause* pPause) { return m_iStage; } int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) { - FXSYS_assert(m_iStage >= 80 || m_iStage < 90); + ASSERT(m_iStage >= 80 || m_iStage < 90); uint32_t dwLastObjNum = m_dwLastObjNum; if (m_iStage == 80) { m_XrefStart = m_Offset; @@ -1723,7 +1723,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) { } int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { - FXSYS_assert(m_iStage >= 90); + ASSERT(m_iStage >= 90); if ((m_dwFlags & FPDFCREATE_OBJECTSTREAM) == 0) { FX_BOOL bXRefStream = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser->IsXRefStream(); diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp index 32e2945818..48fdc1c914 100644 --- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp @@ -676,7 +676,7 @@ void CPDF_LabCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const { - assert(iComponent < 3); + ASSERT(iComponent < 3); value = 0; if (iComponent == 0) { min = 0; diff --git a/core/fpdfapi/fpdf_page/cpdf_countedobject.h b/core/fpdfapi/fpdf_page/cpdf_countedobject.h index da840bec60..e7f4ab6af0 100644 --- a/core/fpdfapi/fpdf_page/cpdf_countedobject.h +++ b/core/fpdfapi/fpdf_page/cpdf_countedobject.h @@ -25,7 +25,7 @@ class CPDF_CountedObject { } T* get() const { return m_pObj; } T* AddRef() { - FXSYS_assert(m_pObj); + ASSERT(m_pObj); ++m_nCount; return m_pObj; } diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp index ead1ac0455..39694c1c1a 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp @@ -238,7 +238,7 @@ const FX_LANG2CS gs_FXLang2CharsetTable[] = { }; uint32_t FX_GetLangHashCode(const FX_CHAR* pStr) { - FXSYS_assert(pStr); + ASSERT(pStr); int32_t iLength = FXSYS_strlen(pStr); const FX_CHAR* pStrEnd = pStr + iLength; uint32_t uHashCode = 0; @@ -265,7 +265,7 @@ uint8_t FX_GetCsFromLangCode(uint32_t uCode) { } uint8_t FX_GetCharsetFromLang(const FX_CHAR* pLang, int32_t iLength) { - FXSYS_assert(pLang); + ASSERT(pLang); if (iLength < 0) iLength = FXSYS_strlen(pLang); @@ -765,7 +765,7 @@ CPDF_Image* CPDF_Document::LoadImageF(CPDF_Object* pObj) { if (!pObj) return nullptr; - FXSYS_assert(pObj->GetObjNum()); + ASSERT(pObj->GetObjNum()); return m_pDocPage->GetImage(pObj); } |