diff options
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 4 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp | 4 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/ttgsubtable.h | 5 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 4 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp | 7 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render.cpp | 18 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp | 6 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/render_int.h | 2 |
15 files changed, 28 insertions, 36 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index 4df841fb75..eda51deb3b 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -45,7 +45,7 @@ void CPDF_PageContentGenerate::GenerateContent() { } CPDF_Object* pContent = pPageDict ? pPageDict->GetElementValue("Contents") : NULL; - if (pContent != NULL) { + if (pContent) { pPageDict->RemoveAt("Contents"); } CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 52129d9e54..a797332727 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -1433,8 +1433,8 @@ void CPDF_Creator::InitNewObjNumOffsets() { FX_BOOL bNewStart = FALSE; for (; i < iCount; i++) { FX_DWORD dwCurObjNum = m_NewObjNumArray.ElementAt(i); - FX_BOOL bExist = (dwCurObjNum < nOldSize && - m_ObjectOffset.GetPtrAt(dwCurObjNum) != NULL); + FX_BOOL bExist = + (dwCurObjNum < nOldSize && m_ObjectOffset.GetPtrAt(dwCurObjNum)); if (bExist || dwCurObjNum - dwLastObjNum > 1) { if (!bNewStart) { m_ObjectOffset.Add(dwStartObjNum, dwLastObjNum - dwStartObjNum + 1); diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 5467cfdaec..7febc7932f 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -429,7 +429,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, #if (_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_) uint32_t FX_GetLangHashCode(const FX_CHAR* pStr) { - FXSYS_assert(pStr != NULL); + FXSYS_assert(pStr); int32_t iLength = FXSYS_strlen(pStr); const FX_CHAR* pStrEnd = pStr + iLength; uint32_t uHashCode = 0; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp index ccb184c6cf..640e8671f8 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp @@ -259,7 +259,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, delete pMaskBitmap; } } - FX_BOOL bStream = pFileWrite != NULL && pFileRead != NULL; + FX_BOOL bStream = pFileWrite && pFileRead; if (opType == 0) { if (iCompress & PDF_IMAGE_LOSSLESS_COMPRESS) { if (pBitmap->GetBPP() == 1) { @@ -270,7 +270,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, if (pBitmap->GetBPP() == 1) { _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, FALSE); - } else if (pBitmap->GetBPP() >= 8 && pBitmap->GetPalette() != NULL) { + } else if (pBitmap->GetBPP() >= 8 && pBitmap->GetPalette()) { CFX_DIBitmap* pNewBitmap = new CFX_DIBitmap(); pNewBitmap->Copy(pBitmap); pNewBitmap->ConvertFormat(FXDIB_Rgb); diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index b515d90a7f..4a71382da4 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -1519,7 +1519,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() { } } if ((m_GlyphIndex[charcode] == 0 || m_GlyphIndex[charcode] == 0xffff) && - name != NULL) { + name) { if (name[0] == '.' && FXSYS_strcmp(name, ".notdef") == 0) { m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), 32); } else { diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h index e3c9965654..605d25fd57 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h @@ -277,10 +277,9 @@ class CFX_CTTGSUBTable { TLookup() : LookupType(0), LookupFlag(0), SubTableCount(0), SubTable(NULL) {} ~TLookup() { - if (SubTableCount > 0 && SubTable != NULL) { - for (int i = 0; i < SubTableCount; i++) { + if (SubTable) { + for (int i = 0; i < SubTableCount; ++i) delete SubTable[i]; - } delete[] SubTable; } } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index 0bf044101c..fbe6faa471 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -349,7 +349,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, FX_DWORD width = pDict->GetInteger("Width"); FX_DWORD height = pDict->GetInteger("Height"); FX_DWORD OrigSize = 0; - if (pCSObj != NULL) { + if (pCSObj) { FX_DWORD bpc = pDict->GetInteger("BitsPerComponent"); FX_DWORD nComponents = 1; CPDF_ColorSpace* pCS = pDoc->LoadColorSpace(pCSObj); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp index e1a7493a2f..5ead9a5bea 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp @@ -44,7 +44,7 @@ CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, m_pPatternObj = pPatternObj; m_pDocument = pDoc; CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); - ASSERT(pDict != NULL); + ASSERT(pDict); m_Pattern2Form = pDict->GetMatrix("Matrix"); m_bColored = pDict->GetInteger("PaintType") == 1; if (parentMatrix) { @@ -88,7 +88,7 @@ CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, m_bShadingObj = bShading; if (!bShading) { CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); - ASSERT(pDict != NULL); + ASSERT(pDict); m_Pattern2Form = pDict->GetMatrix("Matrix"); m_pShadingObj = pDict->GetElementValue("Shading"); if (parentMatrix) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp index 2d7c4b0eec..6625cce2e6 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp @@ -9,7 +9,7 @@ CPDF_Document::CPDF_Document(CPDF_Parser* pParser) : CPDF_IndirectObjects(pParser) { - ASSERT(pParser != NULL); + ASSERT(pParser); m_pRootDict = NULL; m_pInfoDict = NULL; m_bLinearized = FALSE; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index 857e19c28f..58b03c1887 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -161,7 +161,6 @@ CPDF_Array* CPDF_Object::GetArray() const { return const_cast<CPDF_Array*>(AsArray()); } void CPDF_Object::SetString(const CFX_ByteString& str) { - ASSERT(this != NULL); switch (m_Type) { case PDFOBJ_BOOLEAN: AsBoolean()->m_bValue = (str == "true"); @@ -526,17 +525,15 @@ void CPDF_Array::SetAt(FX_DWORD i, void CPDF_Array::InsertAt(FX_DWORD index, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs) { - ASSERT(pObj != NULL); if (pObj->GetObjNum()) { - ASSERT(pObjs != NULL); + ASSERT(pObjs); pObj = new CPDF_Reference(pObjs, pObj->GetObjNum()); } m_Objects.InsertAt(index, pObj); } void CPDF_Array::Add(CPDF_Object* pObj, CPDF_IndirectObjects* pObjs) { - ASSERT(pObj != NULL); if (pObj->GetObjNum()) { - ASSERT(pObjs != NULL); + ASSERT(pObjs); pObj = new CPDF_Reference(pObjs, pObj->GetObjNum()); } m_Objects.Add(pObj); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index d7c3b6e6e8..801f9e737c 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -434,7 +434,7 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, res = 0; } CPDF_ScaledRenderBuffer buffer; - if (!buffer.Initialize(m_pContext, m_pDevice, &rect, pObj, &m_Options, res)) { + if (!buffer.Initialize(m_pContext, m_pDevice, rect, pObj, &m_Options, res)) { return; } CFX_Matrix matrix = *pObj2Device; @@ -537,12 +537,9 @@ FX_BOOL CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, m_curBlend); } CPDF_TransferFunc* CPDF_RenderStatus::GetTransferFunc(CPDF_Object* pObj) const { - ASSERT(pObj != NULL); + ASSERT(pObj); CPDF_DocRenderData* pDocCache = m_pContext->m_pDocument->GetRenderData(); - if (!pDocCache) { - return NULL; - } - return pDocCache->GetTransferFunc(pObj); + return pDocCache ? pDocCache->GetTransferFunc(pObj) : nullptr; } FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, FX_BOOL bType3) const { @@ -1343,19 +1340,18 @@ CPDF_ScaledRenderBuffer::~CPDF_ScaledRenderBuffer() {} #define _FPDFAPI_IMAGESIZE_LIMIT_ (30 * 1024 * 1024) FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, - FX_RECT* pRect, + const FX_RECT& pRect, const CPDF_PageObject* pObj, const CPDF_RenderOptions* pOptions, int max_dpi) { - FXSYS_assert(pRect != NULL); m_pDevice = pDevice; if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_GET_BITS) { return TRUE; } m_pContext = pContext; - m_Rect = *pRect; + m_Rect = pRect; m_pObject = pObj; - m_Matrix.TranslateI(-pRect->left, -pRect->top); + m_Matrix.TranslateI(-pRect.left, -pRect.top); int horz_size = pDevice->GetDeviceCaps(FXDC_HORZ_SIZE); int vert_size = pDevice->GetDeviceCaps(FXDC_VERT_SIZE); if (horz_size && vert_size && max_dpi) { @@ -1380,7 +1376,7 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_FloatRect rect; int32_t iWidth, iHeight, iPitch; while (1) { - rect = *pRect; + rect = pRect; m_Matrix.TransformRect(rect); FX_RECT bitmap_rect = rect.GetOutterRect(); iWidth = bitmap_rect.Width(); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index 1d1c392af5..938a495eb1 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -344,7 +344,7 @@ FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource() { m_LoadHandle, m_bStdCS, m_pRenderStatus->m_GroupFamily, m_pRenderStatus->m_bLoadMask, m_pRenderStatus, dest_width, dest_height)) { - if (m_LoadHandle != NULL) { + if (m_LoadHandle) { m_Status = 4; return TRUE; } @@ -389,7 +389,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { CPDF_Color* pColor = m_pImageObject->m_ColorState.GetFillColor(); if (pColor && pColor->IsPattern()) { m_pPattern = pColor->GetPattern(); - if (m_pPattern != NULL) { + if (m_pPattern) { m_bPatternColor = TRUE; } } @@ -711,7 +711,7 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() { if (m_pRenderStatus->m_pDevice->StartDIBits( m_pDIBSource, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags, m_DeviceHandle, 0, NULL, m_BlendType)) { - if (m_DeviceHandle != NULL) { + if (m_DeviceHandle) { m_Status = 3; return TRUE; } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index 70d2340c22..521ec16be1 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -788,7 +788,7 @@ int CPDF_DIBSource::StratLoadMask() { m_pMaskStream = m_pDict->GetStream("SMask"); if (m_pMaskStream) { CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArray("Matte"); - if (pMatte != NULL && m_pColorSpace && + if (pMatte && m_pColorSpace && (FX_DWORD)m_pColorSpace->CountComponents() <= m_nComponents) { FX_FLOAT R, G, B; FX_FLOAT* pColor = FX_Alloc(FX_FLOAT, m_nComponents); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index 3a56058295..774e749322 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -313,7 +313,7 @@ static void ReleaseCachedType3(CPDF_Type3Font* pFont) { pFont->m_pDocument->GetPageData()->ReleaseFont(pFont->GetFontDict()); } FX_BOOL CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) { - if (m_pBitmap != NULL || m_pForm == NULL) { + if (m_pBitmap || m_pForm == NULL) { return TRUE; } if (m_pForm->CountObjects() == 1 && !m_bColored) { diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index d348b48dfd..26bef8ba42 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -384,7 +384,7 @@ class CPDF_ScaledRenderBuffer { FX_BOOL Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, - FX_RECT* pRect, + const FX_RECT& pRect, const CPDF_PageObject* pObj, const CPDF_RenderOptions* pOptions = NULL, int max_dpi = 0); |