diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:10:25 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:10:25 -0800 |
commit | e3c7c2b54348da4a6939f6672f6c6bff126815a7 (patch) | |
tree | 68cc9bebdd5f4f055bfa7de116862091709b4054 | |
parent | ba41a35553573ab718026e8508e1e32107db6595 (diff) | |
download | pdfium-e3c7c2b54348da4a6939f6672f6c6bff126815a7.tar.xz |
Get rid of most instance of 'foo != NULL'
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1512763013 .
83 files changed, 308 insertions, 1028 deletions
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 8a39729fd0..b712d7b5ed 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -1071,7 +1071,7 @@ class CFX_ListArrayTemplate { T2& operator[](int32_t nIndex) { uint8_t* data = m_Data.GetAt(nIndex); - FXSYS_assert(data != NULL); + FXSYS_assert(data); return (T2&)(*(volatile T2*)data); } diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h index f13d37caf4..e8d8bc7b5f 100644 --- a/core/include/fxcrt/fx_ext.h +++ b/core/include/fxcrt/fx_ext.h @@ -79,7 +79,7 @@ template <class baseType> class CFX_SSortTemplate { public: void ShellSort(baseType* pArray, int32_t iCount) { - FXSYS_assert(pArray != NULL && iCount > 0); + FXSYS_assert(pArray && iCount > 0); int32_t i, j, gap; baseType v1, v2; gap = iCount >> 1; diff --git a/core/src/fdrm/crypto/fx_crypt_sha.cpp b/core/src/fdrm/crypto/fx_crypt_sha.cpp index 21046f1df2..ecefdde05a 100644 --- a/core/src/fdrm/crypto/fx_crypt_sha.cpp +++ b/core/src/fdrm/crypto/fx_crypt_sha.cpp @@ -369,7 +369,7 @@ typedef struct { uint8_t buffer[128]; } sha384_context; uint64_t FX_ato64i(const FX_CHAR* str) { - FXSYS_assert(str != NULL); + FXSYS_assert(str); uint64_t ret = 0; int len = (int)FXSYS_strlen(str); len = len > 16 ? 16 : len; 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); diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp index 3ad746067d..87cfe7e642 100644 --- a/core/src/fpdfdoc/doc_action.cpp +++ b/core/src/fpdfdoc/doc_action.cpp @@ -34,7 +34,7 @@ const FX_CHAR* g_sATypes[] = { "SetOCGState", "Rendition", "Trans", "GoTo3DView", ""}; CPDF_Action::ActionType CPDF_Action::GetType() const { ActionType eType = Unknown; - if (m_pDict != NULL) { + if (m_pDict) { CFX_ByteString csType = m_pDict->GetString("S"); if (!csType.IsEmpty()) { int i = 0; @@ -80,7 +80,7 @@ CFX_ByteString CPDF_Action::GetURI(CPDF_Document* pDoc) const { csURI = m_pDict->GetString("URI"); CPDF_Dictionary* pRoot = pDoc->GetRoot(); CPDF_Dictionary* pURI = pRoot->GetDict("URI"); - if (pURI != NULL) { + if (pURI) { if (csURI.Find(":", 0) < 1) { csURI = pURI->GetString("Base") + csURI; } @@ -179,10 +179,7 @@ CFX_WideString CPDF_Action::GetJavaScript() const { return csJS; } CPDF_Object* pJS = m_pDict->GetElementValue("JS"); - if (pJS != NULL) { - return pJS->GetUnicodeText(); - } - return csJS; + return pJS ? pJS->GetUnicodeText() : csJS; } CPDF_Dictionary* CPDF_Action::GetAnnot() const { if (!m_pDict) { @@ -298,13 +295,13 @@ CPDF_Action CPDF_AAction::GetNextAction(FX_POSITION& pos, CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {} int CPDF_DocJSActions::CountJSActions() const { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); CPDF_NameTree name_tree(m_pDocument, "JavaScript"); return name_tree.GetCount(); } CPDF_Action CPDF_DocJSActions::GetJSAction(int index, CFX_ByteString& csName) const { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); CPDF_NameTree name_tree(m_pDocument, "JavaScript"); CPDF_Object* pAction = name_tree.LookupValue(index, csName); if (!ToDictionary(pAction)) { @@ -313,7 +310,7 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(int index, return CPDF_Action(pAction->GetDict()); } CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); CPDF_NameTree name_tree(m_pDocument, "JavaScript"); CPDF_Object* pAction = name_tree.LookupValue(csName); if (!ToDictionary(pAction)) { @@ -322,7 +319,7 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const { return CPDF_Action(pAction->GetDict()); } int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); CPDF_NameTree name_tree(m_pDocument, "JavaScript"); return name_tree.GetIndex(csName); } diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index cacd650dde..0871b357cf 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -304,7 +304,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, } CPDF_Array* pColor = m_pAnnotDict->GetArray("C"); FX_DWORD argb = 0xff000000; - if (pColor != NULL) { + if (pColor) { int R = (int32_t)(pColor->GetNumber(0) * 255); int G = (int32_t)(pColor->GetNumber(1) * 255); int B = (int32_t)(pColor->GetNumber(2) * 255); diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp index effe587090..1392ae6e2e 100644 --- a/core/src/fpdfdoc/doc_ap.cpp +++ b/core/src/fpdfdoc/doc_ap.cpp @@ -123,7 +123,7 @@ CFX_ByteString CPVT_FontMap::GetPDFFontAlias(int32_t nFontIndex) { return ""; } CPVT_Provider::CPVT_Provider(IPVT_FontMap* pFontMap) : m_pFontMap(pFontMap) { - ASSERT(m_pFontMap != NULL); + ASSERT(m_pFontMap); } CPVT_Provider::~CPVT_Provider() {} int32_t CPVT_Provider::GetCharWidth(int32_t nFontIndex, diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp index 904ccf7c1f..c58e10b779 100644 --- a/core/src/fpdfdoc/doc_basic.cpp +++ b/core/src/fpdfdoc/doc_basic.cpp @@ -77,7 +77,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, return NULL; } CPDF_Array* pLimits = pNode->GetArray("Limits"); - if (pLimits != NULL) { + if (pLimits) { CFX_ByteString csLeft = pLimits->GetString(0); CFX_ByteString csRight = pLimits->GetString(1); if (csLeft.Compare(csRight) > 0) { @@ -96,7 +96,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, CFX_ByteString csValue = pNames->GetString(i * 2); int32_t iCompare = csValue.Compare(csName); if (iCompare <= 0) { - if (ppFind != NULL) { + if (ppFind) { *ppFind = pNames; } if (iCompare < 0) { @@ -144,7 +144,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, nCurIndex += nCount; return NULL; } - if (ppFind != NULL) { + if (ppFind) { *ppFind = pNames; } csName = pNames->GetString((nIndex - nCurIndex) * 2); @@ -389,7 +389,6 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const { static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj, const CFX_WideStringC& wsFileName, FX_BOOL bURL) { - ASSERT(pObj != NULL); CFX_WideString wsStr; if (bURL) { wsStr = wsFileName; @@ -405,7 +404,6 @@ static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj, } void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName, FX_BOOL bURL) { - ASSERT(m_pObj != NULL); if (bURL) { if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) { pDict->SetAtName("FS", "URL"); @@ -483,12 +481,12 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const { int n = nPage; while (n >= 0) { pValue = numberTree.LookupValue(n); - if (pValue != NULL) { + if (pValue) { break; } n--; } - if (pValue != NULL) { + if (pValue) { pValue = pValue->GetDirect(); if (CPDF_Dictionary* pLabel = pValue->AsDictionary()) { if (pLabel->KeyExist("P")) { diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index 26857dd2af..80938f47c0 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -328,7 +328,7 @@ static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXA* lpelfe, NEWTEXTMETRICEX* lpntme, DWORD FontType, LPARAM lParam) { - if (FontType != 0x004 || strchr(lpelfe->elfLogFont.lfFaceName, '@') != NULL) { + if (FontType != 0x004 || strchr(lpelfe->elfLogFont.lfFaceName, '@')) { return 1; } LPDF_FONTDATA pData = (LPDF_FONTDATA)lParam; @@ -355,7 +355,7 @@ static FX_BOOL RetrieveSpecificFont(uint8_t charSet, memset(&lf, 0, sizeof(LOGFONTA)); lf.lfCharSet = charSet; lf.lfPitchAndFamily = pitchAndFamily; - if (pcsFontName != NULL) { + if (pcsFontName) { strcpy(lf.lfFaceName, pcsFontName); } return RetrieveSpecificFont(lf); @@ -406,7 +406,7 @@ CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) { bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, NULL, lf); } if (bRet) { - if (pLogFont != NULL) { + if (pLogFont) { memcpy(pLogFont, &lf, sizeof(LOGFONTA)); } csFontName = lf.lfFaceName; @@ -540,7 +540,7 @@ FX_BOOL CPDF_InterForm::ValidateFieldName( continue; } if (pField == pExcludedField) { - if (pExcludedControl != NULL) { + if (pExcludedControl) { if (pField->CountControls() < 2) { continue; } @@ -904,10 +904,9 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) { } } FX_BOOL CPDF_InterForm::HasXFAForm() const { - return m_pFormDict && m_pFormDict->GetArray("XFA") != NULL; + return m_pFormDict && m_pFormDict->GetArray("XFA"); } void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) { - ASSERT(pPage != NULL); CPDF_Dictionary* pPageDict = pPage->m_pFormDict; if (pPageDict == NULL) { return; @@ -919,7 +918,7 @@ void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) { int iAnnotCount = pAnnots->GetCount(); for (int i = 0; i < iAnnotCount; i++) { CPDF_Dictionary* pAnnot = pAnnots->GetDict(i); - if (pAnnot != NULL && pAnnot->GetString("Subtype") == "Widget") { + if (pAnnot && pAnnot->GetString("Subtype") == "Widget") { LoadField(pAnnot); } } @@ -1127,7 +1126,6 @@ const struct _SupportFieldEncoding { static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary* pFieldDict, CFX_WideString& csValue, CFX_ByteString& bsEncoding) { - ASSERT(pFieldDict != NULL); CFX_ByteString csBValue = pFieldDict->GetString("V"); int32_t iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]); int32_t i = 0; @@ -1138,7 +1136,7 @@ static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary* pFieldDict, if (i < iCount) { CFX_CharMap* pCharMap = CFX_CharMap::GetDefaultMapper(g_fieldEncoding[i].m_codePage); - FXSYS_assert(pCharMap != NULL); + FXSYS_assert(pCharMap); csValue.ConvertFrom(csBValue, pCharMap); return; } @@ -1181,7 +1179,7 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, CFX_WideString csWValue; FPDFDOC_FDF_GetFieldValue(pFieldDict, csWValue, m_bsEncoding); int iType = pField->GetFieldType(); - if (bNotify && m_pFormNotify != NULL) { + if (bNotify && m_pFormNotify) { int iRet = 0; if (iType == FIELDTYPE_LISTBOX) { iRet = m_pFormNotify->BeforeSelectionChange(pField, csWValue); @@ -1203,7 +1201,7 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, pField->m_pDict->SetAt("Opt", pFieldDict->GetElementValue("Opt")->Clone(TRUE)); } - if (bNotify && m_pFormNotify != NULL) { + if (bNotify && m_pFormNotify) { if (iType == FIELDTYPE_CHECKBOX || iType == FIELDTYPE_RADIOBUTTON) { m_pFormNotify->AfterCheckedStatusChange(pField, statusArray); } else if (iType == FIELDTYPE_LISTBOX) { @@ -1230,7 +1228,7 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF, return FALSE; } m_bsEncoding = pMainDict->GetString("Encoding"); - if (bNotify && m_pFormNotify != NULL) { + if (bNotify && m_pFormNotify) { int iRet = m_pFormNotify->BeforeFormImportData(this); if (iRet < 0) { return FALSE; @@ -1243,7 +1241,7 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF, } FDF_ImportField(pField, L"", bNotify); } - if (bNotify && m_pFormNotify != NULL) { + if (bNotify && m_pFormNotify) { m_pFormNotify->AfterFormImportData(this); } return TRUE; diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp index e840665385..767b31b1d5 100644 --- a/core/src/fpdfdoc/doc_formfield.cpp +++ b/core/src/fpdfdoc/doc_formfield.cpp @@ -103,7 +103,7 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) { case CPDF_FormField::CheckBox: case CPDF_FormField::RadioButton: { CFX_ByteArray statusArray; - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { SaveCheckedFieldStatus(this, statusArray); } int iCount = CountControls(); @@ -120,7 +120,7 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) { } } } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { m_pForm->m_pFormNotify->AfterCheckedStatusChange(this, statusArray); } } break; @@ -131,14 +131,14 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) { if (iIndex >= 0) { csValue = GetOptionLabel(iIndex); } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue); if (iRet < 0) { return FALSE; } } SetItemSelection(iIndex, TRUE); - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { m_pForm->m_pFormNotify->AfterValueChange(this); } } break; @@ -149,14 +149,14 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) { if (iIndex >= 0) { csValue = GetOptionLabel(iIndex); } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { int iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue); if (iRet < 0) { return FALSE; } } SetItemSelection(iIndex, TRUE); - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { m_pForm->m_pFormNotify->AfterSelectionChange(this); } } break; @@ -166,19 +166,19 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) { default: { CPDF_Object* pDV = FPDF_GetFieldAttr(m_pDict, "DV"); CFX_WideString csDValue; - if (pDV != NULL) { + if (pDV) { csDValue = pDV->GetUnicodeText(); } CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict, "V"); CFX_WideString csValue; - if (pV != NULL) { + if (pV) { csValue = pV->GetUnicodeText(); } CPDF_Object* pRV = FPDF_GetFieldAttr(m_pDict, "RV"); if (!pRV && (csDValue == csValue)) { return FALSE; } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csDValue); if (iRet < 0) { return FALSE; @@ -198,7 +198,7 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) { m_pDict->SetAt("RV", pCloneR); } } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { m_pForm->m_pFormNotify->AfterValueChange(this); } m_pForm->m_bUpdated = TRUE; @@ -331,7 +331,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, case Text: case ComboBox: { CFX_WideString csValue = value; - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue); if (iRet < 0) { return FALSE; @@ -353,7 +353,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, SetItemSelection(iIndex, TRUE); } } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { m_pForm->m_pFormNotify->AfterValueChange(this); } m_pForm->m_bUpdated = TRUE; @@ -366,7 +366,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, if (bDefault && iIndex == GetDefaultSelectedItem()) { return FALSE; } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { CFX_WideString csValue = value; int iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue); if (iRet < 0) { @@ -378,7 +378,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, ClearSelection(); SetItemSelection(iIndex, TRUE); } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { m_pForm->m_pFormNotify->AfterSelectionChange(this); } m_pForm->m_bUpdated = TRUE; @@ -464,7 +464,7 @@ int CPDF_FormField::GetSelectedIndex(int index) { return -1; } FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify) { - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { int iRet = 0; CFX_WideString csValue; int iIndex = GetSelectedIndex(0); @@ -483,7 +483,7 @@ FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify) { } m_pDict->RemoveAt("V"); m_pDict->RemoveAt("I"); - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { if (GetType() == ListBox) { m_pForm->m_pFormNotify->AfterSelectionChange(this); } @@ -549,7 +549,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, return FALSE; } CFX_WideString opt_value = GetOptionValue(index); - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { int iRet = 0; if (GetType() == ListBox) { iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, opt_value); @@ -563,7 +563,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, } if (!bSelected) { CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); - if (pValue != NULL) { + if (pValue) { if (m_Type == ListBox) { SelectOption(index, FALSE); if (pValue->IsString()) { @@ -627,7 +627,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, m_pDict->SetAt("I", pI); } } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { if (GetType() == ListBox) { m_pForm->m_pFormNotify->AfterSelectionChange(this); } @@ -745,7 +745,7 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, return FALSE; } CFX_ByteArray statusArray; - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { SaveCheckedFieldStatus(this, statusArray); } CFX_WideString csWExport = pControl->GetExportValue(); @@ -780,7 +780,7 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, } else { CFX_ByteString csV; CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict, "V"); - if (pV != NULL) { + if (pV) { csV = pV->GetString(); } if (csV == csBExport) { @@ -792,7 +792,7 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, csIndex.Format("%d", iControlIndex); m_pDict->SetAtName("V", csIndex); } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { m_pForm->m_pFormNotify->AfterCheckedStatusChange(this, statusArray); } m_pForm->m_bUpdated = TRUE; @@ -822,7 +822,7 @@ FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value, FX_BOOL bNotify) { ASSERT(GetType() == CheckBox || GetType() == RadioButton); CFX_ByteArray statusArray; - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { SaveCheckedFieldStatus(this, statusArray); } int iCount = CountControls(); @@ -842,7 +842,7 @@ FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value, } } } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { m_pForm->m_pFormNotify->AfterCheckedStatusChange(this, statusArray); } m_pForm->m_bUpdated = TRUE; @@ -919,7 +919,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, if (bSelected) { return TRUE; } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { int iRet = 0; CFX_WideString csValue = GetOptionLabel(iOptIndex); if (GetType() == ListBox) { @@ -939,7 +939,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, if (!bSelected) { continue; } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { int iRet = 0; CFX_WideString csValue = GetOptionLabel(iOptIndex); if (GetType() == ListBox) { @@ -969,7 +969,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, m_pDict->RemoveAt("I"); } } - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { if (GetType() == ListBox) { m_pForm->m_pFormNotify->AfterSelectionChange(this); } @@ -981,7 +981,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, return TRUE; } FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify) { - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { int iRet = 0; CFX_WideString csValue; int iIndex = GetSelectedIndex(0); @@ -999,7 +999,7 @@ FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify) { } } m_pDict->RemoveAt("I"); - if (bNotify && m_pForm->m_pFormNotify != NULL) { + if (bNotify && m_pForm->m_pFormNotify) { if (GetType() == ListBox) { m_pForm->m_pFormNotify->AfterSelectionChange(this); } diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp index 4e0e1c5a31..cfca121d36 100644 --- a/core/src/fpdfdoc/doc_ocg.cpp +++ b/core/src/fpdfdoc/doc_ocg.cpp @@ -24,7 +24,6 @@ static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject, static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary* pDict, const CFX_ByteStringC& csElement, const CFX_ByteStringC& csDef = "") { - FXSYS_assert(pDict != NULL); CPDF_Object* pIntent = pDict->GetElementValue("Intent"); if (pIntent == NULL) { return csElement == csDef; @@ -89,7 +88,7 @@ static CFX_ByteString FPDFDOC_OCG_GetUsageTypeString( return csState; } CPDF_OCContext::CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType) { - FXSYS_assert(pDoc != NULL); + FXSYS_assert(pDoc); m_pDocument = pDoc; m_eUsageType = eUsageType; } @@ -235,9 +234,8 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression, } FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict, FX_BOOL bFromConfig) { - FXSYS_assert(pOCMDDict != NULL); CPDF_Array* pVE = pOCMDDict->GetArray("VE"); - if (pVE != NULL) { + if (pVE) { return GetOCGVE(pVE, bFromConfig); } CFX_ByteString csP = pOCMDDict->GetString("P", "AnyOn"); diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp index adf523f74e..f26355fae5 100644 --- a/core/src/fpdfdoc/doc_utils.cpp +++ b/core/src/fpdfdoc/doc_utils.cpp @@ -242,7 +242,7 @@ void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) { CFX_ByteString csBaseName, csDefault; uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); pFont = CPDF_InterForm::AddStandardFont(pDocument, "Helvetica"); - if (pFont != NULL) { + if (pFont) { AddInterFormFont(pFormDict, pDocument, pFont, csBaseName); csDefault = csBaseName; } @@ -250,14 +250,14 @@ void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) { CFX_ByteString csFontName = CPDF_InterForm::GetNativeFont(charSet, NULL); if (pFont == NULL || csFontName != "Helvetica") { pFont = CPDF_InterForm::AddNativeFont(pDocument); - if (pFont != NULL) { + if (pFont) { csBaseName = ""; AddInterFormFont(pFormDict, pDocument, pFont, csBaseName); csDefault = csBaseName; } } } - if (pFont != NULL) { + if (pFont) { csDA = "/" + PDF_NameEncode(csDefault) + " 0 Tf"; } } @@ -452,9 +452,9 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); CFX_SubstFont* pSubst; CPDF_Font* pFont = GetDefaultInterFormFont(pFormDict, pDocument); - if (pFont != NULL) { + if (pFont) { pSubst = (CFX_SubstFont*)pFont->GetSubstFont(); - if (pSubst != NULL && pSubst->m_Charset == (int)charSet) { + if (pSubst && pSubst->m_Charset == (int)charSet) { FindInterFormFont(pFormDict, pFont, csNameTag); return pFont; } @@ -592,7 +592,7 @@ CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CFX_ByteString csTemp; CPDF_Font* pFont = GetNativeInterFormFont(pFormDict, pDocument, charSet, csTemp); - if (pFont != NULL) { + if (pFont) { csNameTag = csTemp; return pFont; } @@ -603,7 +603,7 @@ CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, } } pFont = CPDF_InterForm::AddNativeFont(charSet, pDocument); - if (pFont != NULL) { + if (pFont) { AddInterFormFont(pFormDict, pDocument, pFont, csNameTag); } return pFont; @@ -679,7 +679,7 @@ void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { return; } CPDF_Array* pA = m_pDict->GetArray("A"); - if (pA != NULL) { + if (pA) { FX_DWORD dwCount = pA->GetCount(); if (dwCount > 0) { fLeft = pA->GetNumber(0); diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp index 07824e8f04..8df687ed59 100644 --- a/core/src/fpdfdoc/doc_vt.cpp +++ b/core/src/fpdfdoc/doc_vt.cpp @@ -84,7 +84,6 @@ CPVT_WordPlace CSection::AddLine(const CPVT_LineInfo& lineinfo) { return CPVT_WordPlace(SecPlace.nSecIndex, m_LineArray.Add(lineinfo), -1); } CPVT_FloatRect CSection::Rearrange() { - ASSERT(m_pVT != NULL); if (m_pVT->m_nCharArray > 0) { return CTypeset(this).CharArray(); } @@ -166,7 +165,7 @@ void CSection::UpdateWordPlace(CPVT_WordPlace& place) const { } } CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point& point) const { - ASSERT(m_pVT != NULL); + ASSERT(m_pVT); CPVT_WordPlace place = GetBeginWordPlace(); FX_BOOL bUp = TRUE; FX_BOOL bDown = TRUE; @@ -306,8 +305,7 @@ CTypeset::CTypeset(CSection* pSection) m_pSection(pSection) {} CTypeset::~CTypeset() {} CPVT_FloatRect CTypeset::CharArray() { - ASSERT(m_pSection != NULL); - ASSERT(m_pVT != NULL); + ASSERT(m_pSection); FX_FLOAT fLineAscent = m_pVT->GetFontAscent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize()); FX_FLOAT fLineDescent = @@ -382,14 +380,13 @@ CPVT_FloatRect CTypeset::CharArray() { return m_rcRet = CPVT_FloatRect(0, 0, x, y); } CPVT_Size CTypeset::GetEditSize(FX_FLOAT fFontSize) { - ASSERT(m_pSection != NULL); - ASSERT(m_pVT != NULL); + ASSERT(m_pSection); + ASSERT(m_pVT); SplitLines(FALSE, fFontSize); return CPVT_Size(m_rcRet.Width(), m_rcRet.Height()); } CPVT_FloatRect CTypeset::Typeset() { - ASSERT(m_pSection != NULL); - ASSERT(m_pVT != NULL); + ASSERT(m_pVT); m_pSection->m_LineArray.Empty(); SplitLines(TRUE, 0.0f); m_pSection->m_LineArray.Clear(); @@ -571,8 +568,8 @@ static FX_BOOL NeedDivision(FX_WORD prevWord, FX_WORD curWord) { return FALSE; } void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) { - ASSERT(m_pVT != NULL); - ASSERT(m_pSection != NULL); + ASSERT(m_pVT); + ASSERT(m_pSection); int32_t nLineHead = 0; int32_t nLineTail = 0; FX_FLOAT fMaxX = 0.0f, fMaxY = 0.0f; @@ -619,7 +616,7 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) { if (IsOpenStylePunctuation(pWord->Word)) { bOpened = TRUE; bFullWord = TRUE; - } else if (pOldWord != NULL) { + } else if (pOldWord) { if (NeedDivision(pOldWord->Word, pWord->Word)) { bFullWord = TRUE; } @@ -718,8 +715,8 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) { m_rcRet = CPVT_FloatRect(0, 0, fMaxX, fMaxY); } void CTypeset::OutputLines() { - ASSERT(m_pVT != NULL); - ASSERT(m_pSection != NULL); + ASSERT(m_pVT); + ASSERT(m_pSection); FX_FLOAT fMinX = 0.0f, fMinY = 0.0f, fMaxX = 0.0f, fMaxY = 0.0f; FX_FLOAT fPosX = 0.0f, fPosY = 0.0f; FX_FLOAT fLineIndent = m_pVT->GetLineIndent(m_pSection->m_SecInfo); @@ -1677,11 +1674,10 @@ CPDF_VariableText_Iterator::CPDF_VariableText_Iterator(CPDF_VariableText* pVT) : m_CurPos(-1, -1, -1), m_pVT(pVT) {} CPDF_VariableText_Iterator::~CPDF_VariableText_Iterator() {} void CPDF_VariableText_Iterator::SetAt(int32_t nWordIndex) { - ASSERT(m_pVT != NULL); m_CurPos = m_pVT->WordIndexToWordPlace(nWordIndex); } void CPDF_VariableText_Iterator::SetAt(const CPVT_WordPlace& place) { - ASSERT(m_pVT != NULL); + ASSERT(m_pVT); m_CurPos = place; } FX_BOOL CPDF_VariableText_Iterator::NextWord() { @@ -1738,7 +1734,7 @@ FX_BOOL CPDF_VariableText_Iterator::NextSection() { return FALSE; } FX_BOOL CPDF_VariableText_Iterator::PrevSection() { - ASSERT(m_pVT != NULL); + ASSERT(m_pVT); if (m_CurPos.nSecIndex > 0) { m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, 0, -1); return TRUE; @@ -1746,7 +1742,6 @@ FX_BOOL CPDF_VariableText_Iterator::PrevSection() { return FALSE; } FX_BOOL CPDF_VariableText_Iterator::GetWord(CPVT_Word& word) const { - ASSERT(m_pVT != NULL); word.WordPlace = m_CurPos; if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { if (pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) { @@ -1772,7 +1767,6 @@ FX_BOOL CPDF_VariableText_Iterator::GetWord(CPVT_Word& word) const { return FALSE; } FX_BOOL CPDF_VariableText_Iterator::SetWord(const CPVT_Word& word) { - ASSERT(m_pVT != NULL); if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { if (CPVT_WordInfo* pWord = pSection->m_WordArray.GetAt(m_CurPos.nWordIndex)) { @@ -1785,7 +1779,7 @@ FX_BOOL CPDF_VariableText_Iterator::SetWord(const CPVT_Word& word) { return FALSE; } FX_BOOL CPDF_VariableText_Iterator::GetLine(CPVT_Line& line) const { - ASSERT(m_pVT != NULL); + ASSERT(m_pVT); line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1); if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { if (CLine* pLine = pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) { @@ -1802,7 +1796,6 @@ FX_BOOL CPDF_VariableText_Iterator::GetLine(CPVT_Line& line) const { return FALSE; } FX_BOOL CPDF_VariableText_Iterator::GetSection(CPVT_Section& section) const { - ASSERT(m_pVT != NULL); section.secplace = CPVT_WordPlace(m_CurPos.nSecIndex, 0, -1); if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { section.rcSection = m_pVT->InToOut(pSection->m_SecInfo.rcSection); @@ -1817,7 +1810,6 @@ FX_BOOL CPDF_VariableText_Iterator::GetSection(CPVT_Section& section) const { return FALSE; } FX_BOOL CPDF_VariableText_Iterator::SetSection(const CPVT_Section& section) { - ASSERT(m_pVT != NULL); if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { if (pSection->m_SecInfo.pSecProps) { *pSection->m_SecInfo.pSecProps = section.SecProps; diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp index 1bee5e774a..730872363c 100644 --- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp @@ -282,10 +282,10 @@ static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf, color_transform = cinfo.jpeg_color_space == JCS_YCbCr || cinfo.jpeg_color_space == JCS_YCCK; bits_per_components = cinfo.data_precision; - if (icc_buf_ptr != NULL) { + if (icc_buf_ptr) { *icc_buf_ptr = NULL; } - if (icc_length != NULL) { + if (icc_length) { *icc_length = 0; } jpeg_destroy_decompress(&cinfo); @@ -531,7 +531,7 @@ FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, int quality, const uint8_t* icc_buf, FX_DWORD icc_length) { - if (pSource->GetBPP() < 8 || pSource->GetPalette() != NULL) { + if (pSource->GetBPP() < 8 || pSource->GetPalette()) { ASSERT(pSource->GetBPP() >= 8 && pSource->GetPalette() == NULL); return FALSE; } @@ -655,7 +655,7 @@ FX_BOOL CCodec_JpegModule::ReadScanline(void* pContext, } FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) { - if (avail_buf_ptr != NULL) { + if (avail_buf_ptr) { *avail_buf_ptr = NULL; if (((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { *avail_buf_ptr = diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp index 7576ab86eb..cd4770282a 100644 --- a/core/src/fxcrt/fx_basic_bstring.cpp +++ b/core/src/fxcrt/fx_basic_bstring.cpp @@ -295,7 +295,7 @@ void CFX_ByteString::CopyBeforeWrite() { m_pData->Release(); FX_STRSIZE nDataLength = pData->m_nDataLength; m_pData = StringData::Create(nDataLength); - if (m_pData != NULL) { + if (m_pData) { FXSYS_memcpy(m_pData->m_String, pData->m_String, nDataLength + 1); } } @@ -698,7 +698,7 @@ FX_STRSIZE CFX_ByteString::Insert(FX_STRSIZE nIndex, FX_CHAR ch) { if (!m_pData) { return 0; } - if (pOldData != NULL) { + if (pOldData) { FXSYS_memmove(m_pData->m_String, pstr, (pOldData->m_nDataLength + 1)); pOldData->Release(); } else { diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index 3228ca3e7a..548581c9cb 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -151,7 +151,7 @@ void CFX_WideTextBuf::AppendChar(FX_WCHAR ch) { if (m_AllocSize < m_DataSize + (FX_STRSIZE)sizeof(FX_WCHAR)) { ExpandBuf(sizeof(FX_WCHAR)); } - ASSERT(m_pBuffer != NULL); + ASSERT(m_pBuffer); *(FX_WCHAR*)(m_pBuffer + m_DataSize) = ch; m_DataSize += sizeof(FX_WCHAR); } @@ -170,7 +170,7 @@ CFX_WideTextBuf& CFX_WideTextBuf::operator<<(int i) { if (m_AllocSize < m_DataSize + (FX_STRSIZE)(len * sizeof(FX_WCHAR))) { ExpandBuf(len * sizeof(FX_WCHAR)); } - ASSERT(m_pBuffer != NULL); + ASSERT(m_pBuffer); FX_WCHAR* str = (FX_WCHAR*)(m_pBuffer + m_DataSize); for (FX_STRSIZE j = 0; j < len; j++) { *str++ = buf[j]; @@ -184,7 +184,7 @@ CFX_WideTextBuf& CFX_WideTextBuf::operator<<(double f) { if (m_AllocSize < m_DataSize + (FX_STRSIZE)(len * sizeof(FX_WCHAR))) { ExpandBuf(len * sizeof(FX_WCHAR)); } - ASSERT(m_pBuffer != NULL); + ASSERT(m_pBuffer); FX_WCHAR* str = (FX_WCHAR*)(m_pBuffer + m_DataSize); for (FX_STRSIZE i = 0; i < len; i++) { *str++ = buf[i]; diff --git a/core/src/fxcrt/fx_basic_list.cpp b/core/src/fxcrt/fx_basic_list.cpp index de5d9f3269..292e2a7b53 100644 --- a/core/src/fxcrt/fx_basic_list.cpp +++ b/core/src/fxcrt/fx_basic_list.cpp @@ -17,7 +17,7 @@ CFX_PtrList::CFX_PtrList(int nBlockSize) FX_POSITION CFX_PtrList::AddTail(void* newElement) { CNode* pNewNode = NewNode(m_pNodeTail, NULL); pNewNode->data = newElement; - if (m_pNodeTail != NULL) { + if (m_pNodeTail) { m_pNodeTail->pNext = pNewNode; } else { m_pNodeHead = pNewNode; @@ -28,7 +28,7 @@ FX_POSITION CFX_PtrList::AddTail(void* newElement) { FX_POSITION CFX_PtrList::AddHead(void* newElement) { CNode* pNewNode = NewNode(NULL, m_pNodeHead); pNewNode->data = newElement; - if (m_pNodeHead != NULL) { + if (m_pNodeHead) { m_pNodeHead->pPrev = pNewNode; } else { m_pNodeTail = pNewNode; @@ -43,7 +43,7 @@ FX_POSITION CFX_PtrList::InsertAfter(FX_POSITION position, void* newElement) { CNode* pOldNode = (CNode*)position; CNode* pNewNode = NewNode(pOldNode, pOldNode->pNext); pNewNode->data = newElement; - if (pOldNode->pNext != NULL) { + if (pOldNode->pNext) { pOldNode->pNext->pPrev = pNewNode; } else { m_pNodeTail = pNewNode; @@ -91,7 +91,6 @@ CFX_PtrList::CNode* CFX_PtrList::NewNode(CFX_PtrList::CNode* pPrev, m_pNodeFree = pNode; } } - ASSERT(m_pNodeFree != NULL); CFX_PtrList::CNode* pNode = m_pNodeFree; m_pNodeFree = m_pNodeFree->pNext; pNode->pPrev = pPrev; @@ -122,9 +121,9 @@ FX_POSITION CFX_PtrList::Find(void* searchValue, FX_POSITION startAfter) const { } else { pNode = pNode->pNext; } - for (; pNode != NULL; pNode = pNode->pNext) - if (pNode->data == searchValue) { + for (; pNode; pNode = pNode->pNext) { + if (pNode->data == searchValue) return (FX_POSITION)pNode; - } + } return NULL; } diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp index aadeb15cb4..f8751ae340 100644 --- a/core/src/fxcrt/fx_basic_maps.cpp +++ b/core/src/fxcrt/fx_basic_maps.cpp @@ -34,15 +34,15 @@ FX_DWORD CFX_MapPtrToPtr::HashKey(void* key) const { void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, void*& rKey, void*& rValue) const { - ASSERT(m_pHashTable != NULL); + ASSERT(m_pHashTable); CAssoc* pAssocRet = (CAssoc*)rNextPosition; - ASSERT(pAssocRet != NULL); + ASSERT(pAssocRet); if (pAssocRet == (CAssoc*)-1) { - for (FX_DWORD nBucket = 0; nBucket < m_nHashTableSize; nBucket++) - if ((pAssocRet = m_pHashTable[nBucket]) != NULL) { + for (FX_DWORD nBucket = 0; nBucket < m_nHashTableSize; nBucket++) { + if ((pAssocRet = m_pHashTable[nBucket]) != NULL) break; - } - ASSERT(pAssocRet != NULL); + } + ASSERT(pAssocRet); } CAssoc* pAssocNext; if ((pAssocNext = pAssocRet->pNext) == NULL) { @@ -95,10 +95,9 @@ CFX_MapPtrToPtr::CAssoc* CFX_MapPtrToPtr::GetAssocAt(void* key, return NULL; } CAssoc* pAssoc; - for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext) { - if (pAssoc->key == key) { + for (pAssoc = m_pHashTable[nHash]; pAssoc; pAssoc = pAssoc->pNext) { + if (pAssoc->key == key) return pAssoc; - } } return NULL; } @@ -114,7 +113,6 @@ CFX_MapPtrToPtr::CAssoc* CFX_MapPtrToPtr::NewAssoc() { m_pFreeList = pAssoc; } } - ASSERT(m_pFreeList != NULL); CFX_MapPtrToPtr::CAssoc* pAssoc = m_pFreeList; m_pFreeList = m_pFreeList->pNext; m_nCount++; @@ -140,7 +138,7 @@ FX_BOOL CFX_MapPtrToPtr::RemoveKey(void* key) { CAssoc** ppAssocPrev; ppAssocPrev = &m_pHashTable[HashKey(key) % m_nHashTableSize]; CAssoc* pAssoc; - for (pAssoc = *ppAssocPrev; pAssoc != NULL; pAssoc = pAssoc->pNext) { + for (pAssoc = *ppAssocPrev; pAssoc; pAssoc = pAssoc->pNext) { if (pAssoc->key == key) { *ppAssocPrev = pAssoc->pNext; FreeAssoc(pAssoc); @@ -293,10 +291,10 @@ FX_BOOL CFX_CMapByteStringToPtr::Lookup(const CFX_ByteStringC& key, return TRUE; } void CFX_CMapByteStringToPtr::SetAt(const CFX_ByteStringC& key, void* value) { - ASSERT(value != NULL); - int index, key_len = key.GetLength(); + ASSERT(value); + int key_len = key.GetLength(); int size = m_Buffer.GetSize(); - for (index = 0; index < size; index++) { + for (int index = 0; index < size; index++) { _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); if (!_CompactStringSame(pKey, key.GetPtr(), key_len)) { continue; @@ -304,7 +302,7 @@ void CFX_CMapByteStringToPtr::SetAt(const CFX_ByteStringC& key, void* value) { *(void**)(pKey + 1) = value; return; } - for (index = 0; index < size; index++) { + for (int index = 0; index < size; index++) { _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); if (pKey->m_CompactLen) { continue; @@ -319,7 +317,7 @@ void CFX_CMapByteStringToPtr::SetAt(const CFX_ByteStringC& key, void* value) { } void CFX_CMapByteStringToPtr::AddValue(const CFX_ByteStringC& key, void* value) { - ASSERT(value != NULL); + ASSERT(value); _CompactString* pKey = (_CompactString*)m_Buffer.Add(); _CompactStringStore(pKey, key.GetPtr(), key.GetLength()); *(void**)(pKey + 1) = value; diff --git a/core/src/fxcrt/fx_basic_plex.cpp b/core/src/fxcrt/fx_basic_plex.cpp index b6383ecf20..91cc1313bd 100644 --- a/core/src/fxcrt/fx_basic_plex.cpp +++ b/core/src/fxcrt/fx_basic_plex.cpp @@ -18,10 +18,9 @@ CFX_Plex* CFX_Plex::Create(CFX_Plex*& pHead, } void CFX_Plex::FreeDataChain() { CFX_Plex* p = this; - while (p != NULL) { - uint8_t* bytes = (uint8_t*)p; - CFX_Plex* pNext = p->pNext; - FX_Free(bytes); - p = pNext; + while (p) { + CFX_Plex* old = p; + p = p->pNext; + FX_Free(old); } } diff --git a/core/src/fxcrt/fx_basic_utf.cpp b/core/src/fxcrt/fx_basic_utf.cpp index 749e1226d3..3625feb130 100644 --- a/core/src/fxcrt/fx_basic_utf.cpp +++ b/core/src/fxcrt/fx_basic_utf.cpp @@ -74,7 +74,7 @@ void CFX_UTF8Encoder::Input(FX_WCHAR unicode) { } } CFX_ByteString FX_UTF8Encode(const FX_WCHAR* pwsStr, FX_STRSIZE len) { - FXSYS_assert(pwsStr != NULL); + FXSYS_assert(pwsStr); if (len < 0) { len = FXSYS_wcslen(pwsStr); } diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp index 78746e383c..a3de140e8b 100644 --- a/core/src/fxcrt/fx_basic_wstring.cpp +++ b/core/src/fxcrt/fx_basic_wstring.cpp @@ -258,7 +258,7 @@ void CFX_WideString::CopyBeforeWrite() { m_pData->Release(); FX_STRSIZE nDataLength = pData->m_nDataLength; m_pData = StringData::Create(nDataLength); - if (m_pData != NULL) { + if (m_pData) { FXSYS_memcpy(m_pData->m_String, pData->m_String, (nDataLength + 1) * sizeof(FX_WCHAR)); } @@ -540,7 +540,7 @@ FX_STRSIZE CFX_WideString::Find(FX_WCHAR ch, FX_STRSIZE nStart) const { return (lpsz == NULL) ? -1 : (int)(lpsz - m_pData->m_String); } void CFX_WideString::TrimRight(const FX_WCHAR* lpszTargetList) { - FXSYS_assert(lpszTargetList != NULL); + FXSYS_assert(lpszTargetList); if (m_pData == NULL || *lpszTargetList == 0) { return; } @@ -569,7 +569,7 @@ void CFX_WideString::TrimRight() { TrimRight(L"\x09\x0a\x0b\x0c\x0d\x20"); } void CFX_WideString::TrimLeft(const FX_WCHAR* lpszTargets) { - FXSYS_assert(lpszTargets != NULL); + FXSYS_assert(lpszTargets); if (m_pData == NULL || *lpszTargets == 0) { return; } @@ -617,7 +617,7 @@ FX_STRSIZE CFX_WideString::Replace(const FX_WCHAR* lpszOld, FX_WCHAR* lpszEnd = m_pData->m_String + m_pData->m_nDataLength; FX_WCHAR* lpszTarget; { - while ((lpszTarget = (FX_WCHAR*)FXSYS_wcsstr(lpszStart, lpszOld)) != NULL && + while ((lpszTarget = (FX_WCHAR*)FXSYS_wcsstr(lpszStart, lpszOld)) && lpszStart < lpszEnd) { nCount++; lpszStart = lpszTarget + nSourceLen; @@ -678,7 +678,7 @@ FX_STRSIZE CFX_WideString::Insert(FX_STRSIZE nIndex, FX_WCHAR ch) { if (!m_pData) { return 0; } - if (pOldData != NULL) { + if (pOldData) { FXSYS_memmove(m_pData->m_String, pstr, (pOldData->m_nDataLength + 1) * sizeof(FX_WCHAR)); pOldData->Release(); diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp index 37437ae9ed..da936f37fd 100644 --- a/core/src/fxcrt/fx_extension.cpp +++ b/core/src/fxcrt/fx_extension.cpp @@ -61,7 +61,7 @@ FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x) { FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, int32_t iLength, int32_t* pUsedLen) { - FXSYS_assert(pcsStr != NULL); + FXSYS_assert(pcsStr); if (iLength < 0) { iLength = (int32_t)FXSYS_strlen(pcsStr); } @@ -71,7 +71,7 @@ FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, int32_t iLength, int32_t* pUsedLen) { - FXSYS_assert(pwsStr != NULL); + FXSYS_assert(pwsStr); if (iLength < 0) { iLength = (int32_t)FXSYS_wcslen(pwsStr); } @@ -117,7 +117,7 @@ FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count) { - FXSYS_assert(dstStr != NULL && srcStr != NULL && count > 0); + FXSYS_assert(dstStr && srcStr && count > 0); for (size_t i = 0; i < count; ++i) if ((dstStr[i] = srcStr[i]) == L'\0') { break; @@ -125,7 +125,7 @@ FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, return dstStr; } int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count) { - FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); + FXSYS_assert(s1 && s2 && count > 0); FX_WCHAR wch1 = 0, wch2 = 0; while (count-- > 0) { wch1 = (FX_WCHAR)FXSYS_tolower(*s1++); @@ -137,7 +137,7 @@ int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count) { return wch1 - wch2; } int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count) { - FXSYS_assert(s1 != NULL && s2 != NULL && count > 0); + FXSYS_assert(s1 && s2 && count > 0); FX_CHAR ch1 = 0, ch2 = 0; while (count-- > 0) { ch1 = (FX_CHAR)FXSYS_tolower(*s1++); @@ -151,7 +151,7 @@ int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count) { FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase) { - FXSYS_assert(pStr != NULL); + FXSYS_assert(pStr); if (iLength < 0) { iLength = (int32_t)FXSYS_strlen(pStr); } @@ -171,7 +171,7 @@ FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase) { - FXSYS_assert(pStr != NULL); + FXSYS_assert(pStr); if (iLength < 0) { iLength = (int32_t)FXSYS_wcslen(pStr); } @@ -201,7 +201,7 @@ void* FX_Random_MT_Start(FX_DWORD dwSeed) { return pContext; } FX_DWORD FX_Random_MT_Generate(void* pContext) { - FXSYS_assert(pContext != NULL); + FXSYS_assert(pContext); FX_LPMTRANDOMCONTEXT pMTC = (FX_LPMTRANDOMCONTEXT)pContext; FX_DWORD v; static FX_DWORD mag[2] = {0, MT_Matrix_A}; @@ -232,7 +232,7 @@ FX_DWORD FX_Random_MT_Generate(void* pContext) { return v; } void FX_Random_MT_Close(void* pContext) { - FXSYS_assert(pContext != NULL); + FXSYS_assert(pContext); FX_Free(pContext); } void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount) { diff --git a/core/src/fxcrt/fx_xml_parser.cpp b/core/src/fxcrt/fx_xml_parser.cpp index dcae0c58c0..56fbada3ad 100644 --- a/core/src/fxcrt/fx_xml_parser.cpp +++ b/core/src/fxcrt/fx_xml_parser.cpp @@ -819,7 +819,6 @@ int CXML_AttrMap::GetSize() const { return m_pMap == NULL ? 0 : m_pMap->GetSize(); } CXML_AttrItem& CXML_AttrMap::GetAt(int index) const { - ASSERT(m_pMap != NULL); return (*m_pMap)[index]; } void CXML_AttrMap::RemoveAll() { diff --git a/core/src/fxcrt/xml_int.h b/core/src/fxcrt/xml_int.h index 39c288afa8..b11a64b505 100644 --- a/core/src/fxcrt/xml_int.h +++ b/core/src/fxcrt/xml_int.h @@ -48,7 +48,7 @@ class CXML_DataStmAcc : public IFX_BufferRead { public: CXML_DataStmAcc(IFX_FileRead* pFileRead) : m_pFileRead(pFileRead), m_pBuffer(NULL), m_nStart(0), m_dwSize(0) { - FXSYS_assert(m_pFileRead != NULL); + FXSYS_assert(m_pFileRead); } ~CXML_DataStmAcc() override { FX_Free(m_pBuffer); } diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index 6d37db9680..44d6c5022c 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -844,7 +844,6 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) { if (pSrcBitmap->GetWidth() != m_Width || pSrcBitmap->GetHeight() != m_Height) { pSrcClone = pSrcBitmap->StretchTo(m_Width, m_Height); - ASSERT(pSrcClone != NULL); if (pSrcClone == NULL) { return FALSE; } @@ -1340,7 +1339,7 @@ FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, if (m_pBuffer == NULL) { return FALSE; } - if (m_bpp != 8 && m_pPalette != NULL && m_AlphaFlag != 0) { + if (m_bpp != 8 && m_pPalette && m_AlphaFlag != 0) { return FALSE; } if (m_Width < 4 && m_Height < 4) { diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp index 94efd864c0..37204268f2 100644 --- a/core/src/fxge/ge/fx_ge_device.cpp +++ b/core/src/fxge/ge/fx_ge_device.cpp @@ -19,7 +19,6 @@ void CFX_RenderDevice::SetDeviceDriver(IFX_RenderDeviceDriver* pDriver) { InitDeviceInfo(); } void CFX_RenderDevice::InitDeviceInfo() { - ASSERT(m_pDeviceDriver != NULL); m_Width = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_WIDTH); m_Height = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_HEIGHT); m_bpp = m_pDeviceDriver->GetDeviceCaps(FXDC_BITS_PIXEL); diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp index 6ce8f4635b..ceb2acf2bc 100644 --- a/core/src/fxge/ge/fx_ge_ps.cpp +++ b/core/src/fxge/ge/fx_ge_ps.cpp @@ -417,7 +417,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, pConverted = pSource->CloneConvert(FXDIB_Rgb); break; case FXDIB_8bppRgb: - if (pSource->GetPalette() != NULL) { + if (pSource->GetPalette()) { pConverted = pSource->CloneConvert(FXDIB_Rgb); } break; @@ -425,7 +425,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, pConverted = pSource->CloneConvert(FXDIB_Cmyk); break; case FXDIB_8bppCmyk: - if (pSource->GetPalette() != NULL) { + if (pSource->GetPalette()) { pConverted = pSource->CloneConvert(FXDIB_Cmyk); } break; diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index d330576433..cd6b690a12 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -229,7 +229,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, if (FXSYS_fabs(char2device.a) + FXSYS_fabs(char2device.b) > 50 * 1.0f || ((m_DeviceClass == FXDC_PRINTER && !m_pDeviceDriver->IsPSPrintDriver()) && !(text_flags & FXTEXT_PRINTIMAGETEXT))) { - if (pFont->GetFace() != NULL || + if (pFont->GetFace() || (pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_GLYPHPATH)) { int nPathFlags = (text_flags & FXTEXT_NOSMOOTH) == 0 ? 0 : FXFILL_NOPATHSMOOTH; diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 4ca4316c2e..6d520468a3 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -1186,7 +1186,7 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, int alpha_flag, void* pIccTransform, int blend_type) { - ASSERT(pSource != NULL && pClipRect != NULL); + ASSERT(pSource && pClipRect); if (flags || dest_width > 10000 || dest_width < -10000 || dest_height > 10000 || dest_height < -10000) { return UseFoxitStretchEngine(pSource, color, dest_left, dest_top, diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp index ab50f3cf38..83924f23e7 100644 --- a/core/src/fxge/win32/fx_win32_dwrite.cpp +++ b/core/src/fxge/win32/fx_win32_dwrite.cpp @@ -18,14 +18,14 @@ typedef HRESULT(__stdcall* FuncType_DWriteCreateFactory)( __out IUnknown**); template <typename InterfaceType> inline void SafeRelease(InterfaceType** currentObject) { - if (*currentObject != NULL) { + if (*currentObject) { (*currentObject)->Release(); *currentObject = NULL; } } template <typename InterfaceType> inline InterfaceType* SafeAcquire(InterfaceType* newObject) { - if (newObject != NULL) { + if (newObject) { newObject->AddRef(); } return newObject; diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp index 2886ee81d0..e79a88cb81 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -1295,7 +1295,7 @@ class GpStream final : public IStream { ULONG* pcbRead) { size_t bytes_left; size_t bytes_out; - if (pcbRead != NULL) { + if (pcbRead) { *pcbRead = 0; } if (m_ReadPos == m_InterStream.GetLength()) { @@ -1305,7 +1305,7 @@ class GpStream final : public IStream { bytes_out = FX_MIN(cb, bytes_left); FXSYS_memcpy(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out); m_ReadPos += (int32_t)bytes_out; - if (pcbRead != NULL) { + if (pcbRead) { *pcbRead = (ULONG)bytes_out; } return S_OK; @@ -1314,13 +1314,13 @@ class GpStream final : public IStream { ULONG cb, ULONG* pcbWritten) { if (cb <= 0) { - if (pcbWritten != NULL) { + if (pcbWritten) { *pcbWritten = 0; } return S_OK; } m_InterStream.InsertBlock(m_InterStream.GetLength(), Input, cb); - if (pcbWritten != NULL) { + if (pcbWritten) { *pcbWritten = cb; } return S_OK; @@ -1374,7 +1374,7 @@ class GpStream final : public IStream { return STG_E_SEEKERROR; } m_ReadPos = new_read_position; - if (lpNewFilePointer != NULL) { + if (lpNewFilePointer) { lpNewFilePointer->QuadPart = m_ReadPos; } return S_OK; diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp index c829a438b9..39828b14d8 100644 --- a/core/src/fxge/win32/fx_win32_print.cpp +++ b/core/src/fxge/win32/fx_win32_print.cpp @@ -49,7 +49,7 @@ FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, pSource->GetHeight(), &clip_rect, 0, alpha_flag, pIccTransform, FXDIB_BLEND_NORMAL); } - ASSERT(pSource != NULL && !pSource->IsAlphaMask() && pSrcRect != NULL); + ASSERT(pSource && !pSource->IsAlphaMask() && pSrcRect); ASSERT(blend_type == FXDIB_BLEND_NORMAL); if (pSource->HasAlpha()) { return FALSE; diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp index 97b061f56a..743c90e817 100644 --- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp +++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp @@ -14,8 +14,6 @@ CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot, m_pAnnotDict(NULL), m_pDefaultFont(NULL), m_sAPType("N") { - ASSERT(pAnnot != NULL); - CPDF_Page* pPage = pAnnot->GetPDFPage(); m_pDocument = pPage->m_pDocument; diff --git a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp index b0fc906f98..0129707340 100644 --- a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp @@ -20,10 +20,7 @@ CPWL_Wnd* CFFL_CheckBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) { CPWL_CheckBox* pWnd = new CPWL_CheckBox(); pWnd->Create(cp); - - ASSERT(m_pWidget != NULL); pWnd->SetCheck(m_pWidget->IsChecked()); - return pWnd; } @@ -45,10 +42,10 @@ FX_BOOL CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, case FWL_VKEY_Return: case FWL_VKEY_Space: { CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); - ASSERT(pIFormFiller != NULL); + ASSERT(pIFormFiller); CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); FX_BOOL bReset = FALSE; FX_BOOL bExit = FALSE; @@ -94,18 +91,11 @@ FX_BOOL CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView* pPageView, } FX_BOOL CFFL_CheckBox::IsDataChanged(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - - if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) { - return pWnd->IsChecked() != m_pWidget->IsChecked(); - } - - return FALSE; + CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE); + return pWnd && pWnd->IsChecked() != m_pWidget->IsChecked(); } void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) { FX_BOOL bNewChecked = pWnd->IsChecked(); diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp index 858cc6285a..9458a14764 100644 --- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp @@ -27,10 +27,7 @@ CFFL_ComboBox::~CFFL_ComboBox() { PWL_CREATEPARAM CFFL_ComboBox::GetCreateParam() { PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); - ASSERT(m_pWidget != NULL); - int nFlags = m_pWidget->GetFieldFlags(); - if (nFlags & FIELDFLAG_EDIT) { cp.dwFlags |= PCBS_ALLOWCUSTOMTEXT; } @@ -93,8 +90,6 @@ FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) { } void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - if (CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) { CFX_WideString swText = pWnd->GetText(); int32_t nCurSel = pWnd->GetSelect(); @@ -165,7 +160,6 @@ void CFFL_ComboBox::GetActionData(CPDFSDK_PageView* pPageView, break; case CPDF_AAction::LoseFocus: case CPDF_AAction::GetFocus: - ASSERT(m_pWidget != NULL); fa.sValue = m_pWidget->GetValue(); break; default: @@ -207,7 +201,7 @@ FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, } void CFFL_ComboBox::SaveState(CPDFSDK_PageView* pPageView) { - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_ComboBox* pComboBox = static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, FALSE))) { @@ -221,7 +215,7 @@ void CFFL_ComboBox::SaveState(CPDFSDK_PageView* pPageView) { } void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) { - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_ComboBox* pComboBox = static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, TRUE))) { @@ -257,9 +251,7 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, } void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) { - ASSERT(m_pApp != NULL); - - ASSERT(pWnd != NULL); + ASSERT(m_pApp); if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; @@ -279,11 +271,11 @@ void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) { } void CFFL_ComboBox::OnKillFocus(CPWL_Wnd* pWnd) { - ASSERT(m_pApp != NULL); + ASSERT(m_pApp); } void CFFL_ComboBox::OnAddUndo(CPWL_Edit* pEdit) { - ASSERT(pEdit != NULL); + ASSERT(pEdit); } CFX_WideString CFFL_ComboBox::GetSelectExportText() { diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp index e5b0f2968f..2e0451c0f6 100644 --- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp @@ -49,8 +49,8 @@ CPDF_Rect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView) { FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { - ASSERT(pPageView != NULL); - ASSERT(pAnnot != NULL); + ASSERT(pPageView); + ASSERT(pAnnot); CPDF_Rect rcAnnot = m_pWidget->GetRect(); @@ -109,7 +109,7 @@ void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { EndTimer(); - ASSERT(m_pWidget != NULL); + ASSERT(m_pWidget); } FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, @@ -216,7 +216,7 @@ FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nFlags) { if (IsValid()) { CPDFSDK_PageView* pPageView = GetCurPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { return pWnd->OnKeyDown(nKeyCode, nFlags); @@ -231,7 +231,7 @@ FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nFlags) { if (IsValid()) { CPDFSDK_PageView* pPageView = GetCurPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { return pWnd->OnChar(nChar, nFlags); @@ -284,7 +284,7 @@ FX_BOOL CFFL_FormFiller::IsValid() const { } PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { - ASSERT(m_pApp != NULL); + ASSERT(m_pApp); PWL_CREATEPARAM cp; cp.pParentWnd = NULL; @@ -415,8 +415,6 @@ CFX_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) { CFX_Matrix CFFL_FormFiller::GetCurMatrix() { CFX_Matrix mt; - ASSERT(m_pWidget != NULL); - CPDF_Rect rcDA; m_pWidget->GetPDFAnnot()->GetRect(rcDA); @@ -443,7 +441,7 @@ CFX_Matrix CFFL_FormFiller::GetCurMatrix() { } CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex) { - ASSERT(m_pApp != NULL); + ASSERT(m_pApp); return L""; } @@ -637,7 +635,7 @@ void CFFL_Button::OnMouseExit(CPDFSDK_PageView* pPageView, FX_RECT rect = GetViewBBox(pPageView, pAnnot); InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); EndTimer(); - ASSERT(m_pWidget != NULL); + ASSERT(m_pWidget); } FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView, @@ -675,7 +673,7 @@ FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - ASSERT(m_pApp != NULL); + ASSERT(m_pApp); return TRUE; } @@ -685,7 +683,7 @@ void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView, CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, FX_DWORD dwFlags) { - ASSERT(pPageView != NULL); + ASSERT(pPageView); CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; CPDF_FormControl* pCtrl = pWidget->GetFormControl(); CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode(); diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp index a939942a55..6d8c3a9d4b 100644 --- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp @@ -15,12 +15,6 @@ #define FFL_MAXLISTBOXHEIGHT 140.0f -// HHOOK CFFL_IFormFiller::m_hookSheet = NULL; -// MSG CFFL_IFormFiller::g_Msg; - -/* ----------------------------- CFFL_IFormFiller ----------------------------- - */ - CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) : m_pApp(pApp), m_bNotifying(FALSE) {} @@ -44,7 +38,7 @@ FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) return pFormFiller->GetViewBBox(pPageView, pAnnot); - ASSERT(pPageView != NULL); + ASSERT(pPageView); CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); CPDF_Rect rcAnnot; @@ -55,11 +49,11 @@ FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, } void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, - /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, + CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { - ASSERT(pPageView != NULL); + FX_DWORD dwFlags) { + ASSERT(pPageView); CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; if (IsVisible(pWidget)) { @@ -127,7 +121,6 @@ void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) { void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (!m_bNotifying) { @@ -139,7 +132,7 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, pWidget->ClearAppModified(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -147,8 +140,6 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); m_bNotifying = FALSE; - // if ( !IsValidAnnot(pPageView, pAnnot) ) return; - if (pWidget->IsAppModified()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { pFormFiller->ResetPDFWindow(pPageView, @@ -166,7 +157,6 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (!m_bNotifying) { @@ -177,7 +167,7 @@ void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -186,8 +176,6 @@ void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); m_bNotifying = FALSE; - // if (!IsValidAnnot(pPageView, pAnnot)) return; - if (pWidget->IsAppModified()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { pFormFiller->ResetPDFWindow(pPageView, @@ -206,7 +194,6 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (!m_bNotifying) { @@ -218,7 +205,7 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); @@ -286,7 +273,7 @@ void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag) { - ASSERT(pWidget != NULL); + ASSERT(pWidget); if (!m_bNotifying) { if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) { @@ -294,9 +281,7 @@ void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, int nAge = pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); - ASSERT(pPageView != NULL); - // CReader_DocView* pDocView = pPageView->GetDocView(); - // ASSERT(pDocView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -326,7 +311,6 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { @@ -340,7 +324,6 @@ FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); // change cursor @@ -356,7 +339,6 @@ FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, FX_UINT nFlags, short zDelta, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { @@ -370,7 +352,6 @@ FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { @@ -384,7 +365,6 @@ FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { @@ -397,7 +377,6 @@ FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags) { - ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { @@ -436,7 +415,7 @@ FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { pWidget->ClearAppModified(); CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -479,7 +458,7 @@ FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { pWidget->ClearAppModified(); CPDFSDK_PageView* pPageView = pWidget->GetPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -501,10 +480,7 @@ FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { } FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { - ASSERT(pWidget != NULL); - int nFieldFlags = pWidget->GetFieldFlags(); - return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; } @@ -584,8 +560,6 @@ void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMax, int32_t& nRet, FX_FLOAT& fPopupRet) { - ASSERT(pPrivateData != NULL); - CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; CPDF_Rect rcPageView(0, 0, 0, 0); @@ -593,7 +567,6 @@ void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); rcPageView.Normalize(); - ASSERT(pData->pWidget != NULL); CPDF_Rect rcAnnot = pData->pWidget->GetRect(); FX_FLOAT fTop = 0.0f; @@ -660,12 +633,11 @@ void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, FX_BOOL& bExit, FX_DWORD nFlag) { if (!m_bNotifying) { - ASSERT(pWidget != NULL); if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) { m_bNotifying = TRUE; pWidget->ClearAppModified(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -675,8 +647,6 @@ void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, fa.bRC = TRUE; CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); - ASSERT(pFormFiller != NULL); - pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); pFormFiller->SaveState(pPageView); @@ -684,9 +654,6 @@ void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); bRC = fa.bRC; - // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, - // pWidget); - m_bNotifying = FALSE; } } @@ -698,14 +665,11 @@ void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, FX_BOOL& bExit, FX_DWORD nFlag) { if (!m_bNotifying) { - ASSERT(pWidget != NULL); if (pWidget->GetAAction(CPDF_AAction::Validate)) { m_bNotifying = TRUE; pWidget->ClearAppModified(); - ASSERT(pPageView != NULL); - // CReader_DocView* pDocView = pPageView->GetDocView(); - // ASSERT(pDocView != NULL); + ASSERT(pPageView); PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -714,8 +678,6 @@ void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, fa.bRC = TRUE; CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); - ASSERT(pFormFiller != NULL); - pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); pFormFiller->SaveState(pPageView); @@ -723,9 +685,6 @@ void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); bRC = fa.bRC; - // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, - // pWidget); - m_bNotifying = FALSE; } } @@ -736,22 +695,12 @@ void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, FX_BOOL& bExit, FX_DWORD nFlag) { if (!m_bNotifying) { - ASSERT(pWidget != NULL); - ASSERT(pPageView != NULL); - // CReader_DocView* pDocView = pPageView->GetDocView(); - // ASSERT(pDocView != NULL); + ASSERT(pWidget); CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - pInterForm->OnCalculate(pWidget->GetFormField()); - // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, - // pWidget); - m_bNotifying = FALSE; } } @@ -761,24 +710,15 @@ void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, FX_BOOL& bExit, FX_DWORD nFlag) { if (!m_bNotifying) { - ASSERT(pWidget != NULL); - ASSERT(pPageView != NULL); - // CReader_DocView* pDocView = pPageView->GetDocView(); - // ASSERT(pDocView != NULL); + ASSERT(pWidget); CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); FX_BOOL bFormated = FALSE; CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bFormated); - // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, - // pWidget); - if (bExit) return; @@ -809,20 +749,16 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) { - ASSERT(pPrivateData != NULL); CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; - ASSERT(pData->pWidget != NULL); + ASSERT(pData->pWidget); CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); - ASSERT(pFormFiller != NULL); - if (!m_bNotifying) { if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) { m_bNotifying = TRUE; int nAge = pData->pWidget->GetAppearanceAge(); int nValueAge = pData->pWidget->GetValueAge(); - ASSERT(pData->pPageView != NULL); CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); PDFSDK_FieldAction fa; diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp index 53a7570716..d00bfb12ff 100644 --- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp @@ -25,7 +25,6 @@ CFFL_ListBox::~CFFL_ListBox() { PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() { PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); - ASSERT(m_pWidget != NULL); FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags(); if (dwFieldFlag & FIELDFLAG_MULTISELECT) { @@ -52,7 +51,6 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, pWnd->AttachFFLData(this); pWnd->Create(cp); - ASSERT(m_pApp != NULL); CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); pWnd->SetFillerNotify(pIFormFiller); @@ -115,7 +113,7 @@ FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) { } void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); + ASSERT(m_pWidget); if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { CFX_IntArray aOldSelect, aNewSelect; @@ -161,7 +159,6 @@ void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, } else { if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { - ASSERT(m_pWidget != NULL); int32_t nCurSel = pListBox->GetCurSel(); if (nCurSel >= 0) fa.sValue = m_pWidget->GetOptionLabel(nCurSel); @@ -173,7 +170,6 @@ void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { fa.sValue = L""; } else { - ASSERT(m_pWidget != NULL); int32_t nCurSel = m_pWidget->GetSelectedIndex(0); if (nCurSel >= 0) fa.sValue = m_pWidget->GetOptionLabel(nCurSel); @@ -189,7 +185,7 @@ void CFFL_ListBox::SetActionData(CPDFSDK_PageView* pPageView, const PDFSDK_FieldAction& fa) {} void CFFL_ListBox::SaveState(CPDFSDK_PageView* pPageView) { - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) { diff --git a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp index 572cfeb29a..609e043024 100644 --- a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp +++ b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp @@ -22,7 +22,6 @@ CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const PWL_CREATEPARAM& cp, CPWL_RadioButton* pWnd = new CPWL_RadioButton(); pWnd->Create(cp); - ASSERT(m_pWidget != NULL); pWnd->SetCheck(m_pWidget->IsChecked()); return pWnd; @@ -47,10 +46,8 @@ FX_BOOL CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, case FWL_VKEY_Return: case FWL_VKEY_Space: { CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); - ASSERT(pIFormFiller != NULL); - CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); FX_BOOL bReset = FALSE; FX_BOOL bExit = FALSE; @@ -94,8 +91,6 @@ FX_BOOL CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView* pPageView, } FX_BOOL CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) { return pWnd->IsChecked() != m_pWidget->IsChecked(); @@ -105,16 +100,12 @@ FX_BOOL CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) { } void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) { FX_BOOL bNewChecked = pWnd->IsChecked(); if (bNewChecked) { CPDF_FormField* pField = m_pWidget->GetFormField(); - ASSERT(pField != NULL); - for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) { if (CPDF_FormControl* pCtrl = pField->GetControl(i)) { if (pCtrl->IsChecked()) { diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp index 2dc82a892e..2e67ebf0f3 100644 --- a/fpdfsdk/src/formfiller/FFL_TextField.cpp +++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp @@ -11,10 +11,7 @@ * ------------------------------- */ CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) - : CFFL_FormFiller(pApp, pAnnot), - m_pFontMap(NULL) //, -// m_pSpellCheck(NULL) -{ + : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(NULL) { m_State.nStart = m_State.nEnd = 0; } @@ -25,7 +22,6 @@ CFFL_TextField::~CFFL_TextField() { PWL_CREATEPARAM CFFL_TextField::GetCreateParam() { PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); - ASSERT(m_pWidget != NULL); int nFlags = m_pWidget->GetFieldFlags(); if (nFlags & FIELDFLAG_PASSWORD) { @@ -88,11 +84,9 @@ CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, pWnd->AttachFFLData(this); pWnd->Create(cp); - ASSERT(m_pApp != NULL); CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); pWnd->SetFillerNotify(pIFormFiller); - ASSERT(m_pWidget != NULL); int32_t nMaxLen = m_pWidget->GetMaxLen(); CFX_WideString swValue = m_pWidget->GetValue(); @@ -116,7 +110,7 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, case FWL_VKEY_Return: if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) { CPDFSDK_PageView* pPageView = GetCurPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); m_bValid = !m_bValid; CPDF_Rect rcAnnot = pAnnot->GetRect(); m_pApp->FFI_Invalidate(pAnnot->GetUnderlyingPage(), rcAnnot.left, @@ -136,7 +130,7 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, break; case FWL_VKEY_Escape: { CPDFSDK_PageView* pPageView = GetCurPageView(); - ASSERT(pPageView != NULL); + ASSERT(pPageView); EscapeFiller(pPageView, TRUE); return TRUE; } @@ -146,8 +140,6 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, } FX_BOOL CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - if (CPWL_Edit* pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) return pEdit->GetText() != m_pWidget->GetValue(); @@ -155,8 +147,6 @@ FX_BOOL CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView) { } void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) { - ASSERT(m_pWidget != NULL); - if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { CFX_WideString sOldValue = m_pWidget->GetValue(); CFX_WideString sNewValue = pWnd->GetText(); @@ -191,7 +181,6 @@ void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, break; case CPDF_AAction::LoseFocus: case CPDF_AAction::GetFocus: - ASSERT(m_pWidget != NULL); fa.sValue = m_pWidget->GetValue(); break; default: @@ -231,7 +220,7 @@ FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, } void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) { - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { pWnd->GetSel(m_State.nStart, m_State.nEnd); @@ -240,7 +229,7 @@ void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) { } void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) { - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE)) { pWnd->SetText(m_State.sValue.c_str()); @@ -269,10 +258,7 @@ CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, } void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { - ASSERT(m_pApp != NULL); - - ASSERT(pWnd != NULL); - + ASSERT(m_pApp); if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; pEdit->SetCharSet(134); diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp index c8b90303a6..93cfab8bdf 100644 --- a/fpdfsdk/src/fpdfformfill.cpp +++ b/fpdfsdk/src/fpdfformfill.cpp @@ -316,7 +316,6 @@ DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); CPDFSDK_ActionHandler* pActionHandler = ((CPDFDoc_Environment*)hHandle)->GetActionHander(); - ASSERT(pActionHandler != NULL); pActionHandler->DoAction_Document(action, (CPDF_AAction::AActionType)aaType, pSDKDoc); } diff --git a/fpdfsdk/src/fsdk_actionhandler.cpp b/fpdfsdk/src/fsdk_actionhandler.cpp index 0043bc7787..9524b2a1a5 100644 --- a/fpdfsdk/src/fsdk_actionhandler.cpp +++ b/fpdfsdk/src/fsdk_actionhandler.cpp @@ -134,8 +134,6 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentOpenAction( FX_BOOL CPDFSDK_ActionHandler::ExecuteLinkAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, CFX_PtrList& list) { - ASSERT(pDocument != NULL); - CPDF_Dictionary* pDict = action.GetDict(); if (list.Find(pDict)) return FALSE; @@ -181,8 +179,6 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentPageAction( CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CFX_PtrList& list) { - ASSERT(pDocument != NULL); - CPDF_Dictionary* pDict = action.GetDict(); if (list.Find(pDict)) return FALSE; @@ -216,15 +212,10 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentPageAction( FX_BOOL CPDFSDK_ActionHandler::IsValidField(CPDFSDK_Document* pDocument, CPDF_Dictionary* pFieldDict) { - ASSERT(pDocument != NULL); - ASSERT(pFieldDict != NULL); + ASSERT(pFieldDict); CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); - ASSERT(pPDFInterForm != NULL); - return pPDFInterForm->GetFieldByDict(pFieldDict) != NULL; } @@ -235,8 +226,6 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteFieldAction( CPDF_FormField* pFormField, PDFSDK_FieldAction& data, CFX_PtrList& list) { - ASSERT(pDocument != NULL); - CPDF_Dictionary* pDict = action.GetDict(); if (list.Find(pDict)) return FALSE; @@ -273,8 +262,6 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteScreenAction( CPDFSDK_Document* pDocument, CPDFSDK_Annot* pScreen, CFX_PtrList& list) { - ASSERT(pDocument != NULL); - CPDF_Dictionary* pDict = action.GetDict(); if (list.Find(pDict)) return FALSE; @@ -317,8 +304,6 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteBookMark(const CPDF_Action& action, CPDFSDK_Document* pDocument, CPDF_Bookmark* pBookmark, CFX_PtrList& list) { - ASSERT(pDocument != NULL); - CPDF_Dictionary* pDict = action.GetDict(); if (list.Find(pDict)) return FALSE; @@ -361,7 +346,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteBookMark(const CPDF_Action& action, void CPDFSDK_ActionHandler::DoAction_NoJs(const CPDF_Action& action, CPDFSDK_Document* pDocument) { - ASSERT(pDocument != NULL); + ASSERT(pDocument); switch (action.GetType()) { case CPDF_Action::GoTo: @@ -467,8 +452,6 @@ void CPDFSDK_ActionHandler::DoAction_URI(CPDFSDK_Document* pDocument, ASSERT(action); CPDFDoc_Environment* pApp = pDocument->GetEnv(); - ASSERT(pApp != NULL); - CFX_ByteString sURI = action.GetURI(pDocument->GetPDFDocument()); pApp->FFI_DoURIAction(sURI.c_str()); } @@ -492,16 +475,10 @@ void CPDFSDK_ActionHandler::RunFieldJavaScript(CPDFSDK_Document* pDocument, ASSERT(type != CPDF_AAction::Calculate); ASSERT(type != CPDF_AAction::Format); - ASSERT(pDocument != NULL); - IJS_Runtime* pRuntime = pDocument->GetJsRuntime(); - ASSERT(pRuntime != NULL); - pRuntime->SetReaderDocument(pDocument); IJS_Context* pContext = pRuntime->NewContext(); - ASSERT(pContext != NULL); - switch (type) { case CPDF_AAction::CursorEnter: pContext->OnField_MouseEnter(data.bModifier, data.bShift, pFormField); @@ -552,16 +529,9 @@ void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript( CPDFSDK_Document* pDocument, const CFX_WideString& sScriptName, const CFX_WideString& script) { - ASSERT(pDocument != NULL); - IJS_Runtime* pRuntime = pDocument->GetJsRuntime(); - ASSERT(pRuntime != NULL); - pRuntime->SetReaderDocument(pDocument); - IJS_Context* pContext = pRuntime->NewContext(); - ASSERT(pContext != NULL); - pContext->OnDoc_Open(pDocument, sScriptName); CFX_WideString csInfo; @@ -577,16 +547,10 @@ void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( CPDFSDK_Document* pDocument, CPDF_AAction::AActionType type, const CFX_WideString& script) { - ASSERT(pDocument != NULL); - IJS_Runtime* pRuntime = pDocument->GetJsRuntime(); - ASSERT(pRuntime != NULL); - pRuntime->SetReaderDocument(pDocument); IJS_Context* pContext = pRuntime->NewContext(); - ASSERT(pContext != NULL); - switch (type) { case CPDF_AAction::OpenPage: pContext->OnPage_Open(pDocument); @@ -631,11 +595,7 @@ void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( FX_BOOL CPDFSDK_FormActionHandler::DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocument) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - if (pInterForm->DoAction_Hide(action)) { pDocument->SetChangeMark(); return TRUE; @@ -647,37 +607,21 @@ FX_BOOL CPDFSDK_FormActionHandler::DoAction_Hide(const CPDF_Action& action, FX_BOOL CPDFSDK_FormActionHandler::DoAction_SubmitForm( const CPDF_Action& action, CPDFSDK_Document* pDocument) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - return pInterForm->DoAction_SubmitForm(action); } FX_BOOL CPDFSDK_FormActionHandler::DoAction_ResetForm( const CPDF_Action& action, CPDFSDK_Document* pDocument) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - - if (pInterForm->DoAction_ResetForm(action)) { - return TRUE; - } - - return FALSE; + return pInterForm->DoAction_ResetForm(action); } FX_BOOL CPDFSDK_FormActionHandler::DoAction_ImportData( const CPDF_Action& action, CPDFSDK_Document* pDocument) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - if (pInterForm->DoAction_ImportData(action)) { pDocument->SetChangeMark(); return TRUE; diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp index 39dabe72bd..feaee74428 100644 --- a/fpdfsdk/src/fsdk_annothandler.cpp +++ b/fpdfsdk/src/fsdk_annothandler.cpp @@ -49,8 +49,7 @@ void CPDFSDK_AnnotHandlerMgr::UnRegisterAnnotHandler( CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView) { - ASSERT(pAnnot != NULL); - ASSERT(pPageView != NULL); + ASSERT(pPageView); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot->GetSubType())) { @@ -61,8 +60,6 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, } void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { - ASSERT(pAnnot != NULL); - pAnnot->GetPDFPage(); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { @@ -74,8 +71,6 @@ void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { } void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { - ASSERT(pAnnot != NULL); - CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); CPDFSDK_DateTime curTime; @@ -88,7 +83,7 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { } void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) { - ASSERT(pAnnot != NULL); + ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnLoad(pAnnot); @@ -97,12 +92,8 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) { IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( CPDFSDK_Annot* pAnnot) const { - ASSERT(pAnnot != NULL); - CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); - if (pPDFAnnot) - return GetAnnotHandler(pPDFAnnot->GetSubType()); - return nullptr; + return pPDFAnnot ? GetAnnotHandler(pPDFAnnot->GetSubType()) : nullptr; } IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( @@ -131,7 +122,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); + ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point); @@ -142,7 +133,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); + ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, point); @@ -154,7 +145,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk( CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); + ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); @@ -165,7 +156,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); + ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point); @@ -177,7 +168,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView* pPageView, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); + ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, @@ -190,7 +181,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown( CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); + ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point); @@ -201,7 +192,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); + ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point); @@ -212,7 +203,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView* pPageView, void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { - ASSERT(pAnnot != NULL); + ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag); @@ -223,7 +214,7 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView* pPageView, void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { - ASSERT(pAnnot != NULL); + ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag); @@ -271,7 +262,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { - ASSERT(pAnnot != NULL); + ASSERT(pAnnot); if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) { @@ -361,15 +352,13 @@ CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, } void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { - ASSERT(pAnnot != NULL); + ASSERT(pAnnot); if (m_pFormFiller) m_pFormFiller->OnDelete(pAnnot); CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); - ASSERT(pInterForm != NULL); - CPDF_FormControl* pCtrol = pWidget->GetFormControl(); pInterForm->RemoveMap(pCtrol); @@ -396,7 +385,6 @@ void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -408,7 +396,6 @@ void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -421,7 +408,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -437,7 +423,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -453,7 +438,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -469,7 +453,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -486,7 +469,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -503,7 +485,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -518,7 +499,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -533,7 +513,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -548,7 +527,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -566,7 +544,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, return FALSE; } void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -599,7 +576,6 @@ void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) { FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -612,7 +588,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, } FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { @@ -626,7 +601,6 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { - ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); if (sSubType == BFFT_SIGNATURE) { diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp index 11718cd56c..734b9828ec 100644 --- a/fpdfsdk/src/fsdk_baseannot.cpp +++ b/fpdfsdk/src/fsdk_baseannot.cpp @@ -528,8 +528,6 @@ void CPDFSDK_Annot::SetTabOrder(int iTabOrder) { } CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const { - ASSERT(m_pAnnot != NULL); - return m_pAnnot->GetAnnotDict(); } @@ -541,17 +539,12 @@ void CPDFSDK_BAAnnot::SetRect(const CPDF_Rect& rect) { } CPDF_Rect CPDFSDK_BAAnnot::GetRect() const { - ASSERT(m_pAnnot != NULL); - CPDF_Rect rect; m_pAnnot->GetRect(rect); - return rect; } CFX_ByteString CPDFSDK_BAAnnot::GetType() const { - ASSERT(m_pAnnot != NULL); - return m_pAnnot->GetSubType(); } @@ -563,9 +556,6 @@ void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix* pUser2Device, CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) { - ASSERT(m_pPageView != NULL); - ASSERT(m_pAnnot != NULL); - m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, mode, pOptions); } @@ -599,12 +589,10 @@ FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_Matrix* pUser2Device, const CPDF_RenderOptions* pOptions) { - ASSERT(m_pAnnot != NULL); m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); } void CPDFSDK_BAAnnot::ClearCachedAP() { - ASSERT(m_pAnnot != NULL); m_pAnnot->ClearCachedAP(); } @@ -944,8 +932,6 @@ CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const { } void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) { - ASSERT(aa != NULL); - if ((CPDF_AAction&)aa != m_pAnnot->GetAnnotDict()->GetDict("AA")) m_pAnnot->GetAnnotDict()->SetAt("AA", (CPDF_AAction&)aa); } diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index 80f8c8fcad..3b35d99026 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -25,7 +25,7 @@ CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, m_pInterForm(pInterForm), m_nAppAge(0), m_nValueAge(0) { - ASSERT(m_pInterForm != NULL); + ASSERT(m_pInterForm); } CPDFSDK_Widget::~CPDFSDK_Widget() {} @@ -69,10 +69,7 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid( } int CPDFSDK_Widget::GetFieldType() const { - CPDF_FormField* pField = GetFormField(); - ASSERT(pField != NULL); - - return pField->GetFieldType(); + return GetFormField()->GetFieldType(); } FX_BOOL CPDFSDK_Widget::IsAppearanceValid() { @@ -81,8 +78,6 @@ FX_BOOL CPDFSDK_Widget::IsAppearanceValid() { int CPDFSDK_Widget::GetFieldFlags() const { CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); - ASSERT(pPDFInterForm != NULL); - CPDF_FormControl* pFormControl = pPDFInterForm->GetControlByDict(m_pAnnot->GetAnnotDict()); CPDF_FormField* pFormField = pFormControl->GetField(); @@ -109,7 +104,7 @@ CPDF_FormControl* CPDFSDK_Widget::GetFormControl() const { CPDF_FormControl* CPDFSDK_Widget::GetFormControl( CPDF_InterForm* pInterForm, const CPDF_Dictionary* pAnnotDict) { - ASSERT(pAnnotDict != NULL); + ASSERT(pAnnotDict); return pInterForm->GetControlByDict(pAnnotDict); } @@ -120,8 +115,6 @@ int CPDFSDK_Widget::GetRotate() const { FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - int iColorType = 0; color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType)); @@ -130,8 +123,6 @@ FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { FX_BOOL CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - int iColorType = 0; color = FX_ARGBTOCOLORREF(pFormCtrl->GetBorderColor(iColorType)); @@ -140,8 +131,6 @@ FX_BOOL CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const { FX_BOOL CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); if (da.HasColor()) { FX_ARGB argb; @@ -157,8 +146,6 @@ FX_BOOL CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const { FX_FLOAT CPDFSDK_Widget::GetFontSize() const { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); CFX_ByteString csFont = ""; FX_FLOAT fFontSize = 0.0f; @@ -179,22 +166,16 @@ CFX_WideString CPDFSDK_Widget::GetValue() const { CFX_WideString CPDFSDK_Widget::GetDefaultValue() const { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - return pFormField->GetDefaultValue(); } CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - return pFormField->GetOptionLabel(nIndex); } int CPDFSDK_Widget::CountOptions() const { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - return pFormField->CountOptions(); } @@ -215,33 +196,23 @@ FX_BOOL CPDFSDK_Widget::IsChecked() const { int CPDFSDK_Widget::GetAlignment() const { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - return pFormCtrl->GetControlAlignment(); } int CPDFSDK_Widget::GetMaxLen() const { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - return pFormField->GetMaxLen(); } void CPDFSDK_Widget::SetCheck(FX_BOOL bChecked, FX_BOOL bNotify) { CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - CPDF_FormField* pFormField = pFormCtrl->GetField(); - ASSERT(pFormField != NULL); - pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecked, bNotify); } void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, FX_BOOL bNotify) { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - pFormField->SetValue(sValue, bNotify); } @@ -250,15 +221,11 @@ void CPDFSDK_Widget::SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify) { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - pFormField->SetItemSelection(index, bSelected, bNotify); } void CPDFSDK_Widget::ClearSelection(FX_BOOL bNotify) { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - pFormField->ClearSelection(bNotify); } @@ -309,22 +276,18 @@ void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue, break; } - ASSERT(m_pAnnot != NULL); m_pAnnot->ClearCachedAP(); } CFX_WideString CPDFSDK_Widget::OnFormat(FX_BOOL& bFormated) { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); + ASSERT(pFormField); return m_pInterForm->OnFormat(pFormField, bFormated); } void CPDFSDK_Widget::ResetFieldAppearance(FX_BOOL bValueChanged) { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - - ASSERT(m_pInterForm != NULL); - + ASSERT(pFormField); m_pInterForm->ResetFieldAppearance(pFormField, NULL, bValueChanged); } @@ -357,16 +320,12 @@ void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, void CPDFSDK_Widget::UpdateField() { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - - ASSERT(m_pInterForm != NULL); + ASSERT(pFormField); m_pInterForm->UpdateField(pFormField); } void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView) { - ASSERT(m_pInterForm != NULL); - int nFieldType = GetFieldType(); if (m_pInterForm->IsNeedHighLight(nFieldType)) { CPDF_Rect rc = GetRect(); @@ -396,12 +355,8 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, void CPDFSDK_Widget::ResetAppearance_PushButton() { CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); - CPDF_Rect rcWindow = GetRotatedRect(); - int32_t nLayout = 0; - switch (pControl->GetTextPosition()) { case TEXTPOS_ICON: nLayout = PPBL_ICON; @@ -536,7 +491,6 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() { CPDF_IconFit iconFit = pControl->GetIconFit(); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); - ASSERT(pDoc != NULL); CPDFDoc_Environment* pEnv = pDoc->GetEnv(); CBA_FontMap FontMap(this, pEnv->GetSysHandler()); @@ -618,10 +572,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() { void CPDFSDK_Widget::ResetAppearance_CheckBox() { CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); - CPWL_Color crBackground, crBorder, crText; - int iColorType; FX_FLOAT fc[4]; @@ -747,10 +698,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() { void CPDFSDK_Widget::ResetAppearance_RadioButton() { CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); - CPWL_Color crBackground, crBorder, crText; - int iColorType; FX_FLOAT fc[4]; @@ -913,10 +861,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() { void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) { CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); CPDF_FormField* pField = pControl->GetField(); - ASSERT(pField != NULL); - CFX_ByteTextBuf sBody, sLines; CPDF_Rect rcClient = GetClientRect(); @@ -928,7 +873,6 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) { pEdit->EnableRefresh(FALSE); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); - ASSERT(pDoc != NULL); CPDFDoc_Environment* pEnv = pDoc->GetEnv(); CBA_FontMap FontMap(this, pEnv->GetSysHandler()); FontMap.Initial(); @@ -992,19 +936,14 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) { void CPDFSDK_Widget::ResetAppearance_ListBox() { CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); CPDF_FormField* pField = pControl->GetField(); - ASSERT(pField != NULL); - CPDF_Rect rcClient = GetClientRect(); - CFX_ByteTextBuf sBody, sLines; if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { pEdit->EnableRefresh(FALSE); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); - ASSERT(pDoc != NULL); CPDFDoc_Environment* pEnv = pDoc->GetEnv(); CBA_FontMap FontMap(this, pEnv->GetSysHandler()); @@ -1086,17 +1025,13 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() { void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) { CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); CPDF_FormField* pField = pControl->GetField(); - ASSERT(pField != NULL); - CFX_ByteTextBuf sBody, sLines; if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { pEdit->EnableRefresh(FALSE); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); - ASSERT(pDoc != NULL); CPDFDoc_Environment* pEnv = pDoc->GetEnv(); CBA_FontMap FontMap(this, pEnv->GetSysHandler()); @@ -1315,8 +1250,6 @@ CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const { CFX_Matrix CPDFSDK_Widget::GetMatrix() const { CFX_Matrix mt; CPDF_FormControl* pControl = GetFormControl(); - ASSERT(pControl != NULL); - CPDF_Rect rcAnnot = GetRect(); FX_FLOAT fWidth = rcAnnot.right - rcAnnot.left; FX_FLOAT fHeight = rcAnnot.top - rcAnnot.bottom; @@ -1344,8 +1277,6 @@ CPWL_Color CPDFSDK_Widget::GetTextPWLColor() const { CPWL_Color crText = CPWL_Color(COLORTYPE_GRAY, 0); CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); if (da.HasColor()) { int32_t iColorType; @@ -1361,8 +1292,6 @@ CPWL_Color CPDFSDK_Widget::GetBorderPWLColor() const { CPWL_Color crBorder; CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - int32_t iColorType; FX_FLOAT fc[4]; pFormCtrl->GetOriginalBorderColor(iColorType, fc); @@ -1376,8 +1305,6 @@ CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const { CPWL_Color crFill; CPDF_FormControl* pFormCtrl = GetFormControl(); - ASSERT(pFormCtrl != NULL); - int32_t iColorType; FX_FLOAT fc[4]; pFormCtrl->GetOriginalBackgroundColor(iColorType, fc); @@ -1389,20 +1316,12 @@ CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const { void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage) { - ASSERT(pImage != NULL); - CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); - ASSERT(pDoc != NULL); + ASSERT(pDoc); CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); - ASSERT(pAPDict != NULL); - CPDF_Stream* pStream = pAPDict->GetStream(sAPType); - ASSERT(pStream != NULL); - CPDF_Dictionary* pStreamDict = pStream->GetDict(); - ASSERT(pStreamDict != NULL); - CFX_ByteString sImageAlias = "IMG"; if (CPDF_Dictionary* pImageDict = pImage->GetDict()) { @@ -1477,8 +1396,6 @@ CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) { CFX_WideString CPDFSDK_Widget::GetAlternateName() const { CPDF_FormField* pFormField = GetFormField(); - ASSERT(pFormField != NULL); - return pFormField->GetAlternateName(); } @@ -1601,8 +1518,7 @@ void CPDFSDK_InterForm::GetWidgets( int CPDFSDK_InterForm::GetPageIndexByAnnotDict( CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict) const { - ASSERT(pDocument != NULL); - ASSERT(pAnnotDict != NULL); + ASSERT(pAnnotDict); for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) { if (CPDF_Dictionary* pPageDict = pDocument->GetPage(i)) { @@ -1698,7 +1614,6 @@ CPDF_Stream* CPDFSDK_InterForm::LoadImageFromFile(const CFX_WideString& sFile) { #endif void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { - ASSERT(m_pDocument != NULL); CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); ASSERT(pEnv); if (!pEnv->IsJSInitiated()) @@ -1711,8 +1626,6 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { if (IsCalculateEnabled()) { IJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); - ASSERT(pRuntime != NULL); - pRuntime->SetReaderDocument(m_pDocument); int nSize = m_pInterForm->CountFieldsInCalculationOrder(); @@ -1728,8 +1641,6 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { CFX_WideString csJS = action.GetJavaScript(); if (!csJS.IsEmpty()) { IJS_Context* pContext = pRuntime->NewContext(); - ASSERT(pContext != NULL); - CFX_WideString sOldValue = pField->GetValue(); CFX_WideString sValue = sOldValue; FX_BOOL bRC = TRUE; @@ -1758,9 +1669,6 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, FX_BOOL& bFormated) { - ASSERT(m_pDocument != NULL); - ASSERT(pFormField != NULL); - CFX_WideString sValue = pFormField->GetValue(); CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); ASSERT(pEnv); @@ -1770,8 +1678,6 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, } IJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); - ASSERT(pRuntime != NULL); - pRuntime->SetReaderDocument(m_pDocument); if (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX) { @@ -1793,8 +1699,6 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, CFX_WideString Value = sValue; IJS_Context* pContext = pRuntime->NewContext(); - ASSERT(pContext != NULL); - pContext->OnField_Format(pFormField, Value, TRUE); CFX_WideString sInfo; @@ -1815,13 +1719,9 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, const FX_WCHAR* sValue, FX_BOOL bValueChanged) { - ASSERT(pFormField != NULL); - for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); - ASSERT(pFormCtrl != NULL); - - ASSERT(m_pInterForm != NULL); + ASSERT(pFormCtrl); if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) pWidget->ResetAppearance(sValue, bValueChanged); } @@ -1830,7 +1730,7 @@ void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) { for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); - ASSERT(pFormCtrl != NULL); + ASSERT(pFormCtrl); if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) { CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); @@ -1848,19 +1748,12 @@ void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) { void CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC) { - ASSERT(pFormField != NULL); - CPDF_AAction aAction = pFormField->GetAdditionalAction(); if (aAction && aAction.ActionExist(CPDF_AAction::KeyStroke)) { CPDF_Action action = aAction.GetAction(CPDF_AAction::KeyStroke); if (action) { - ASSERT(m_pDocument != NULL); CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); - ASSERT(pEnv != NULL); - CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); - ASSERT(pActionHandler != NULL); - PDFSDK_FieldAction fa; fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0); fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); @@ -1876,19 +1769,12 @@ void CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC) { - ASSERT(pFormField != NULL); - CPDF_AAction aAction = pFormField->GetAdditionalAction(); if (aAction && aAction.ActionExist(CPDF_AAction::Validate)) { CPDF_Action action = aAction.GetAction(CPDF_AAction::Validate); if (action) { - ASSERT(m_pDocument != NULL); CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); - ASSERT(pEnv != NULL); - CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); - ASSERT(pActionHandler != NULL); - PDFSDK_FieldAction fa; fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0); fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); @@ -1901,8 +1787,6 @@ void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, } } -/* ----------------------------- action ----------------------------- */ - FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { ASSERT(action); @@ -1937,7 +1821,6 @@ FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { } FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { - ASSERT(m_pInterForm != NULL); CFX_WideString sDestination = action.GetFilePath(); if (sDestination.IsEmpty()) return FALSE; @@ -2050,15 +1933,11 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, if (sDestination.IsEmpty()) return FALSE; - CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); - ASSERT(pEnv != NULL); - - if (!m_pDocument) + if (!m_pDocument || !m_pInterForm) return FALSE; - CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); - if (!m_pInterForm) - return FALSE; + CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); + CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath); if (!pFDFDoc) return FALSE; @@ -2088,9 +1967,6 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, } FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) { - ASSERT(m_pInterForm != NULL); - ASSERT(m_pDocument != NULL); - CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath()); if (!pFDF) return FALSE; @@ -2134,9 +2010,6 @@ std::vector<CPDF_FormField*> CPDFSDK_InterForm::GetFieldFromObjects( return fields; } -/* ----------------------------- CPDF_FormNotify ----------------------------- - */ - int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, CFX_WideString& csValue) { CPDF_FormField* pFormField = (CPDF_FormField*)pField; @@ -2274,12 +2147,7 @@ CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView, m_sType(sType), m_sSubType(sSubType), m_nTabs(BAI_STRUCTURE) { - ASSERT(m_pPageView != NULL); - CPDF_Page* pPDFPage = m_pPageView->GetPDFPage(); - ASSERT(pPDFPage != NULL); - ASSERT(pPDFPage->m_pFormDict != NULL); - CFX_ByteString sTabs = pPDFPage->m_pFormDict->GetString("Tabs"); if (sTabs == "R") { @@ -2342,8 +2210,8 @@ int CBA_AnnotIterator::CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) { } int CBA_AnnotIterator::CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) { - ASSERT(p1 != NULL); - ASSERT(p2 != NULL); + ASSERT(p1); + ASSERT(p2); CPDF_Rect rcAnnot1 = GetAnnotRect(p1); CPDF_Rect rcAnnot2 = GetAnnotRect(p2); diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index 8a73970e49..e01fe89610 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -578,12 +578,10 @@ FX_BOOL CPDFSDK_Document::GetPermissions(int nFlag) { } IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { - ASSERT(m_pEnv != NULL); return m_pEnv->GetJSRuntime(); } CFX_WideString CPDFSDK_Document::GetPath() { - ASSERT(m_pEnv != NULL); return m_pEnv->JS_docGetFilePath(); } diff --git a/fpdfsdk/src/fxedit/fxet_ap.cpp b/fpdfsdk/src/fxedit/fxet_ap.cpp index bdce7c05db..4f879c0022 100644 --- a/fpdfsdk/src/fxedit/fxet_ap.cpp +++ b/fpdfsdk/src/fxedit/fxet_ap.cpp @@ -12,10 +12,7 @@ CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap, int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord) { - ASSERT(pFontMap != NULL); - CFX_ByteString sWord; - if (CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex)) { if (SubWord > 0) { Word = SubWord; diff --git a/fpdfsdk/src/fxedit/fxet_edit.cpp b/fpdfsdk/src/fxedit/fxet_edit.cpp index cca0319eb5..573a5723bd 100644 --- a/fpdfsdk/src/fxedit/fxet_edit.cpp +++ b/fpdfsdk/src/fxedit/fxet_edit.cpp @@ -93,7 +93,7 @@ IFX_Edit* CFX_Edit_Iterator::GetEdit() const { CFX_Edit_Provider::CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap) : m_pFontMap(pFontMap) { - ASSERT(m_pFontMap != NULL); + ASSERT(m_pFontMap); } CFX_Edit_Provider::~CFX_Edit_Provider() {} @@ -286,8 +286,6 @@ void CFX_Edit_Undo::Undo() { if (m_nCurUndoPos > 0) { IFX_Edit_UndoItem* pItem = m_UndoItemStack.GetAt(m_nCurUndoPos - 1); - ASSERT(pItem != NULL); - pItem->Undo(); m_nCurUndoPos--; @@ -308,8 +306,6 @@ void CFX_Edit_Undo::Redo() { if (m_nCurUndoPos < nStackSize) { IFX_Edit_UndoItem* pItem = m_UndoItemStack.GetAt(m_nCurUndoPos); - ASSERT(pItem != NULL); - pItem->Redo(); m_nCurUndoPos++; @@ -325,7 +321,7 @@ FX_BOOL CFX_Edit_Undo::IsWorking() const { void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) { ASSERT(!m_bWorking); - ASSERT(pItem != NULL); + ASSERT(pItem); ASSERT(m_nBufSize > 1); if (m_nCurUndoPos < m_UndoItemStack.GetSize()) @@ -390,8 +386,6 @@ CFX_Edit_GroupUndoItem::~CFX_Edit_GroupUndoItem() { } void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) { - ASSERT(pUndoItem != NULL); - pUndoItem->SetFirst(FALSE); pUndoItem->SetLast(FALSE); @@ -404,11 +398,9 @@ void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) { void CFX_Edit_GroupUndoItem::UpdateItems() { if (m_Items.GetSize() > 0) { CFX_Edit_UndoItem* pFirstItem = m_Items[0]; - ASSERT(pFirstItem != NULL); pFirstItem->SetFirst(TRUE); CFX_Edit_UndoItem* pLastItem = m_Items[m_Items.GetSize() - 1]; - ASSERT(pLastItem != NULL); pLastItem->SetLast(TRUE); } } @@ -416,8 +408,6 @@ void CFX_Edit_GroupUndoItem::UpdateItems() { void CFX_Edit_GroupUndoItem::Undo() { for (int i = m_Items.GetSize() - 1; i >= 0; i--) { CFX_Edit_UndoItem* pUndoItem = m_Items[i]; - ASSERT(pUndoItem != NULL); - pUndoItem->Undo(); } } @@ -425,8 +415,6 @@ void CFX_Edit_GroupUndoItem::Undo() { void CFX_Edit_GroupUndoItem::Redo() { for (int i = 0, sz = m_Items.GetSize(); i < sz; i++) { CFX_Edit_UndoItem* pUndoItem = m_Items[i]; - ASSERT(pUndoItem != NULL); - pUndoItem->Redo(); } } @@ -818,7 +806,7 @@ CFX_Edit::CFX_Edit(IPDF_VariableText* pVT) m_bNotify(TRUE), m_bOprNotify(FALSE), m_pGroupUndoItem(NULL) { - ASSERT(pVT != NULL); + ASSERT(pVT); } CFX_Edit::~CFX_Edit() { @@ -3107,8 +3095,6 @@ void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) { } void CFX_Edit::EndGroupUndo() { - ASSERT(m_pGroupUndoItem != NULL); - m_pGroupUndoItem->UpdateItems(); m_Undo.AddItem(m_pGroupUndoItem); if (m_bOprNotify && m_pOprNotify) diff --git a/fpdfsdk/src/fxedit/fxet_list.cpp b/fpdfsdk/src/fxedit/fxet_list.cpp index 19d41ccf41..1ece0ef11a 100644 --- a/fpdfsdk/src/fxedit/fxet_list.cpp +++ b/fpdfsdk/src/fxedit/fxet_list.cpp @@ -17,8 +17,6 @@ CFX_ListItem::CFX_ListItem() m_bCaret(FALSE), m_rcListItem(0.0f, 0.0f, 0.0f, 0.0f) { m_pEdit = IFX_Edit::NewEdit(); - ASSERT(m_pEdit != NULL); - m_pEdit->SetAlignmentV(1); m_pEdit->Initialize(); } diff --git a/fpdfsdk/src/fxedit/fxet_module.cpp b/fpdfsdk/src/fxedit/fxet_module.cpp index 12f2c86e03..553cf3a62f 100644 --- a/fpdfsdk/src/fxedit/fxet_module.cpp +++ b/fpdfsdk/src/fxedit/fxet_module.cpp @@ -19,8 +19,6 @@ IFX_Edit* IFX_Edit::NewEdit() { } void IFX_Edit::DelEdit(IFX_Edit* pEdit) { - ASSERT(pEdit != NULL); - IPDF_VariableText::DelVariableText(pEdit->GetVariableText()); delete (CFX_Edit*)pEdit; @@ -33,7 +31,6 @@ IFX_List* IFX_List::NewList() { } void IFX_List::DelList(IFX_List* pList) { - ASSERT(pList != NULL); - + ASSERT(pList); delete (CFX_ListCtrl*)pList; } diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index 1fa88f9b12..b0ca69b5ba 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -22,11 +22,7 @@ static v8::Isolate* GetIsolate(IJS_Context* cc) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); - CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - ASSERT(pRuntime != NULL); - return pRuntime->GetIsolate(); } @@ -194,8 +190,6 @@ FX_BOOL Document::numFields(IJS_Context* cc, FX_BOOL Document::dirty(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (vp.IsGetting()) { if (m_pDocument->GetChangeMark()) vp << true; @@ -218,8 +212,6 @@ FX_BOOL Document::dirty(IJS_Context* cc, FX_BOOL Document::ADBE(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (vp.IsGetting()) { vp.SetNull(); } else { @@ -231,8 +223,6 @@ FX_BOOL Document::ADBE(IJS_Context* cc, FX_BOOL Document::pageNum(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (vp.IsGetting()) { if (CPDFSDK_PageView* pPageView = m_pDocument->GetCurrentView()) { vp << pPageView->GetPageIndex(); @@ -394,8 +384,6 @@ FX_BOOL Document::mailForm(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; @@ -410,18 +398,13 @@ FX_BOOL Document::mailForm(IJS_Context* cc, CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - CFX_ByteTextBuf textBuf; if (!pInterForm->ExportFormToFDFTextBuf(textBuf)) return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CPDFDoc_Environment* pEnv = pContext->GetReaderApp(); - ASSERT(pEnv != NULL); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - ASSERT(pRuntime != NULL); pRuntime->BeginBlock(); pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, @@ -485,8 +468,6 @@ FX_BOOL Document::print(IJS_Context* cc, bAnnotations = params[7].ToBool(); } - ASSERT(m_pDocument != NULL); - if (CPDFDoc_Environment* pEnv = m_pDocument->GetEnv()) { pEnv->JS_docprint(bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, bReverse, bAnnotations); @@ -503,8 +484,6 @@ FX_BOOL Document::removeField(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM))) return FALSE; @@ -518,7 +497,6 @@ FX_BOOL Document::removeField(IJS_Context* cc, CFX_WideString sFieldName = params[0].ToCFXWideString(); CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); std::vector<CPDFSDK_Widget*> widgets; pInterForm->GetWidgets(sFieldName, &widgets); @@ -1100,11 +1078,8 @@ FX_BOOL Document::baseURL(IJS_Context* cc, FX_BOOL Document::calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); if (vp.IsGetting()) { if (pInterForm->IsCalculateEnabled()) @@ -1220,7 +1195,6 @@ FX_BOOL Document::closeDoc(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); return TRUE; } @@ -1479,8 +1453,6 @@ FX_BOOL Document::calculateNow(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) @@ -1488,7 +1460,6 @@ FX_BOOL Document::calculateNow(IJS_Context* cc, CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); pInterForm->OnCalculate(); return TRUE; } @@ -1503,8 +1474,6 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; @@ -1565,8 +1534,6 @@ FX_BOOL Document::getPageNthWordQuads(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; @@ -1577,16 +1544,12 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; int nPageNo = params.size() > 0 ? params[0].ToInt() : 0; CPDF_Document* pDocument = m_pDocument->GetPDFDocument(); - ASSERT(pDocument != NULL); - CJS_Context* pContext = static_cast<CJS_Context*>(cc); if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount()) { sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR); @@ -1673,8 +1636,6 @@ int Document::CountWords(CPDF_TextObject* pTextObj) { CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex) { - ASSERT(pTextObj != NULL); - CFX_WideString swRet; CPDF_Font* pFont = pTextObj->GetFont(); diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp index 39e15e9868..288ab5e747 100644 --- a/fpdfsdk/src/javascript/Field.cpp +++ b/fpdfsdk/src/javascript/Field.cpp @@ -19,8 +19,6 @@ #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. #include "fpdfsdk/include/javascript/IJavaScript.h" -/* ---------------------- Field ---------------------- */ - BEGIN_JS_STATIC_CONST(CJS_Field) END_JS_STATIC_CONST() @@ -156,22 +154,14 @@ void Field::ParseFieldName(const std::wstring& strFieldNameParsed, FX_BOOL Field::AttachField(Document* pDocument, const CFX_WideString& csFieldName) { - ASSERT(pDocument != NULL); m_pJSDoc = pDocument; - m_pDocument = pDocument->GetReaderDoc(); - ASSERT(m_pDocument != NULL); - m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) || m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || m_pDocument->GetPermissions(FPDFPERM_MODIFY); CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); - ASSERT(pRDInterForm != NULL); - CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); - ASSERT(pInterForm != NULL); - CFX_WideString swFieldNameTemp = csFieldName; swFieldNameTemp.Replace(L"..", L"."); @@ -251,12 +241,9 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument, FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh) { - ASSERT(pDocument != NULL); - ASSERT(pFormControl != NULL); + ASSERT(pFormControl); CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl); if (pWidget) { @@ -278,7 +265,6 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument, if (bRefresh) { CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); CPDFSDK_Document* pDoc = pInterForm->GetDocument(); - ASSERT(pDoc != NULL); pDoc->UpdateAllViews(NULL, pWidget); } } @@ -289,19 +275,14 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument, CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl) { - ASSERT(pDocument != NULL); - ASSERT(pFormControl != NULL); + ASSERT(pFormControl); CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - return pInterForm->GetWidget(pFormControl); } FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel) { - ASSERT(pFormField != NULL); - for (int i = 0, sz = pFormField->CountOptions(); i < sz; i++) { if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0) return TRUE; @@ -321,13 +302,10 @@ CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) { return pFormField->GetControl(m_nFormControlIndex); } -/* ---------------------------------------- property - * ---------------------------------------- */ - FX_BOOL Field::alignment(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -383,7 +361,7 @@ void Field::SetAlignment(CPDFSDK_Document* pDocument, FX_BOOL Field::borderStyle(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -443,7 +421,7 @@ void Field::SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string) { - ASSERT(pDocument != NULL); + ASSERT(pDocument); int nBorderStyle = 0; @@ -495,7 +473,7 @@ void Field::SetBorderStyle(CPDFSDK_Document* pDocument, FX_BOOL Field::buttonAlignX(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -544,7 +522,7 @@ void Field::SetButtonAlignX(CPDFSDK_Document* pDocument, FX_BOOL Field::buttonAlignY(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -593,7 +571,7 @@ void Field::SetButtonAlignY(CPDFSDK_Document* pDocument, FX_BOOL Field::buttonFitBounds(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -638,7 +616,7 @@ void Field::SetButtonFitBounds(CPDFSDK_Document* pDocument, FX_BOOL Field::buttonPosition(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -681,7 +659,7 @@ void Field::SetButtonPosition(CPDFSDK_Document* pDocument, FX_BOOL Field::buttonScaleHow(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -729,7 +707,7 @@ void Field::SetButtonScaleHow(CPDFSDK_Document* pDocument, FX_BOOL Field::buttonScaleWhen(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -788,7 +766,7 @@ void Field::SetButtonScaleWhen(CPDFSDK_Document* pDocument, FX_BOOL Field::calcOrderIndex(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -815,11 +793,7 @@ FX_BOOL Field::calcOrderIndex(IJS_Context* cc, } CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); - ASSERT(pRDInterForm != NULL); - CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); - ASSERT(pInterForm != NULL); - vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormField); } @@ -836,7 +810,7 @@ void Field::SetCalcOrderIndex(CPDFSDK_Document* pDocument, FX_BOOL Field::charLimit(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -874,7 +848,7 @@ void Field::SetCharLimit(CPDFSDK_Document* pDocument, FX_BOOL Field::comb(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -916,7 +890,7 @@ void Field::SetComb(CPDFSDK_Document* pDocument, FX_BOOL Field::commitOnSelChange(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1023,7 +997,7 @@ void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_DWordArray& array) { - ASSERT(pDocument != NULL); + ASSERT(pDocument); std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); @@ -1063,7 +1037,7 @@ void Field::SetDefaultStyle(CPDFSDK_Document* pDocument, FX_BOOL Field::defaultValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1104,7 +1078,7 @@ void Field::SetDefaultValue(CPDFSDK_Document* pDocument, FX_BOOL Field::doNotScroll(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1146,7 +1120,7 @@ void Field::SetDoNotScroll(CPDFSDK_Document* pDocument, FX_BOOL Field::doNotSpellCheck(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1203,8 +1177,6 @@ FX_BOOL Field::delay(IJS_Context* cc, FX_BOOL Field::display(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (vp.IsSetting()) { if (!m_bCanSet) return FALSE; @@ -1255,11 +1227,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { @@ -1267,7 +1235,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument, FX_BOOL bSet = FALSE; for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { CPDF_FormControl* pFormControl = pFormField->GetControl(i); - ASSERT(pFormControl != NULL); + ASSERT(pFormControl); if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { FX_DWORD dwFlag = pWidget->GetFlags(); @@ -1357,7 +1325,6 @@ FX_BOOL Field::doc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { FX_BOOL Field::editable(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); if (vp.IsSetting()) { if (!m_bCanSet) return FALSE; @@ -1430,8 +1397,6 @@ FX_BOOL Field::exportValues(IJS_Context* cc, FX_BOOL Field::fileSelect(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -1528,8 +1493,6 @@ void Field::SetFillColor(CPDFSDK_Document* pDocument, FX_BOOL Field::hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (vp.IsSetting()) { if (!m_bCanSet) return FALSE; @@ -1571,11 +1534,7 @@ void Field::SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { @@ -1638,7 +1597,7 @@ void Field::SetHidden(CPDFSDK_Document* pDocument, FX_BOOL Field::highlight(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1699,8 +1658,6 @@ void Field::SetHighlight(CPDFSDK_Document* pDocument, FX_BOOL Field::lineWidth(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (vp.IsSetting()) { if (!m_bCanSet) return FALSE; @@ -1727,8 +1684,6 @@ FX_BOOL Field::lineWidth(IJS_Context* cc, CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - if (!pFormField->CountControls()) return FALSE; @@ -1746,10 +1701,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); @@ -1758,7 +1710,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument, FX_BOOL bSet = FALSE; for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { CPDF_FormControl* pFormControl = pFormField->GetControl(i); - ASSERT(pFormControl != NULL); + ASSERT(pFormControl); if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { if (number != pWidget->GetBorderWidth()) { @@ -1788,7 +1740,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument, FX_BOOL Field::multiline(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1830,7 +1782,7 @@ void Field::SetMultiline(CPDFSDK_Document* pDocument, FX_BOOL Field::multipleSelection(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1945,7 +1897,7 @@ FX_BOOL Field::page(IJS_Context* cc, FX_BOOL Field::password(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1987,12 +1939,8 @@ void Field::SetPassword(CPDFSDK_Document* pDocument, FX_BOOL Field::print(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2066,8 +2014,6 @@ FX_BOOL Field::print(IJS_Context* cc, FX_BOOL Field::radiosInUnison(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2096,8 +2042,6 @@ FX_BOOL Field::radiosInUnison(IJS_Context* cc, FX_BOOL Field::readonly(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2187,10 +2131,7 @@ void Field::SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPDF_Rect& rect) { - ASSERT(pDocument != NULL); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); std::vector<CPDF_FormField*> FieldArray = GetFormFields(pDocument, swFieldName); @@ -2199,7 +2140,7 @@ void Field::SetRect(CPDFSDK_Document* pDocument, FX_BOOL bSet = FALSE; for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { CPDF_FormControl* pFormControl = pFormField->GetControl(i); - ASSERT(pFormControl != NULL); + ASSERT(pFormControl); if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { CPDF_Rect crRect = rect; @@ -2229,11 +2170,6 @@ void Field::SetRect(CPDFSDK_Document* pDocument, CPDF_Rect crRect = rect; CPDF_Page* pPDFPage = pWidget->GetPDFPage(); - ASSERT(pPDFPage != NULL); - - // CPDF_Page* pPDFPage = pPage->GetPage(); - // ASSERT(pPDFPage != NULL); - crRect.Intersect(pPDFPage->GetPageBBox()); if (!crRect.IsEmpty()) { @@ -2253,8 +2189,6 @@ void Field::SetRect(CPDFSDK_Document* pDocument, FX_BOOL Field::required(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -2283,7 +2217,7 @@ FX_BOOL Field::required(IJS_Context* cc, FX_BOOL Field::richText(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -2337,7 +2271,7 @@ void Field::SetRichValue(CPDFSDK_Document* pDocument, FX_BOOL Field::rotation(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -2447,7 +2381,7 @@ void Field::SetStrokeColor(CPDFSDK_Document* pDocument, FX_BOOL Field::style(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -2582,7 +2516,7 @@ void Field::SetTextColor(CPDFSDK_Document* pDocument, FX_BOOL Field::textFont(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -2638,7 +2572,7 @@ void Field::SetTextFont(CPDFSDK_Document* pDocument, FX_BOOL Field::textSize(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -2686,8 +2620,6 @@ void Field::SetTextSize(CPDFSDK_Document* pDocument, FX_BOOL Field::type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!vp.IsGetting()) return FALSE; @@ -2732,7 +2664,7 @@ FX_BOOL Field::type(IJS_Context* cc, FX_BOOL Field::userName(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (vp.IsSetting()) { if (!m_bCanSet) @@ -2885,7 +2817,7 @@ void Field::SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CJS_WideStringArray& strArray) { - ASSERT(pDocument != NULL); + ASSERT(pDocument); if (strArray.GetSize() < 1) return; @@ -2944,8 +2876,6 @@ void Field::SetValue(CPDFSDK_Document* pDocument, FX_BOOL Field::valueAsString(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!vp.IsGetting()) return FALSE; @@ -2985,15 +2915,10 @@ FX_BOOL Field::valueAsString(IJS_Context* cc, return TRUE; } -/* --------------------------------- methods --------------------------------- - */ - FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -3016,8 +2941,6 @@ FX_BOOL Field::buttonGetCaption(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - int nface = 0; int iSize = params.size(); if (iSize >= 1) @@ -3051,8 +2974,6 @@ FX_BOOL Field::buttonGetIcon(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - int nface = 0; int iSize = params.size(); if (iSize >= 1) @@ -3120,7 +3041,7 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + ASSERT(m_pDocument); if (!m_bCanSet) return FALSE; @@ -3165,8 +3086,6 @@ FX_BOOL Field::defaultIsChecked(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - if (!m_bCanSet) return FALSE; @@ -3199,9 +3118,6 @@ FX_BOOL Field::deleteItemAt(IJS_Context* cc, } int JS_COMPARESTRING(CFX_WideString* ps1, CFX_WideString* ps2) { - ASSERT(ps1 != NULL); - ASSERT(ps2 != NULL); - return ps1->Compare(*ps2); } @@ -3209,8 +3125,6 @@ FX_BOOL Field::getArray(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -3251,7 +3165,6 @@ FX_BOOL Field::getItemAt(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); int iSize = params.size(); int nIdx = -1; @@ -3305,8 +3218,6 @@ FX_BOOL Field::isBoxChecked(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - int nIndex = -1; if (params.size() >= 1) nIndex = params[0].ToInt(); @@ -3338,8 +3249,6 @@ FX_BOOL Field::isDefaultChecked(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - int nIndex = -1; if (params.size() >= 1) nIndex = params[0].ToInt(); @@ -3377,8 +3286,6 @@ FX_BOOL Field::setFocus(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); - std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return FALSE; @@ -3390,8 +3297,6 @@ FX_BOOL Field::setFocus(IJS_Context* cc, CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - CPDFSDK_Widget* pWidget = NULL; if (nCount == 1) { pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); @@ -3487,12 +3392,7 @@ FX_BOOL Field::source(IJS_Context* cc, return TRUE; } -/////////////////////////////////////////// delay -//////////////////////////////////////////////// - void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3503,8 +3403,6 @@ void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) { } void Field::AddDelay_Bool(enum FIELD_PROP prop, bool b) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3516,8 +3414,6 @@ void Field::AddDelay_Bool(enum FIELD_PROP prop, bool b) { void Field::AddDelay_String(enum FIELD_PROP prop, const CFX_ByteString& string) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3529,8 +3425,6 @@ void Field::AddDelay_String(enum FIELD_PROP prop, void Field::AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3541,8 +3435,6 @@ void Field::AddDelay_WideString(enum FIELD_PROP prop, } void Field::AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3553,8 +3445,6 @@ void Field::AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect) { } void Field::AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3566,8 +3456,6 @@ void Field::AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color) { void Field::AddDelay_WordArray(enum FIELD_PROP prop, const CFX_DWordArray& array) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3581,8 +3469,6 @@ void Field::AddDelay_WordArray(enum FIELD_PROP prop, void Field::AddDelay_WideStringArray(enum FIELD_PROP prop, const CJS_WideStringArray& array) { - ASSERT(m_pJSDoc != NULL); - CJS_DelayData* pNewData = new CJS_DelayData; pNewData->sFieldName = m_FieldName; pNewData->nControlIndex = m_nFormControlIndex; @@ -3594,8 +3480,7 @@ void Field::AddDelay_WideStringArray(enum FIELD_PROP prop, } void Field::DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData) { - ASSERT(pDocument != NULL); - ASSERT(pData != NULL); + ASSERT(pDocument); switch (pData->eProp) { case FP_ALIGNMENT: @@ -3735,9 +3620,6 @@ void Field::DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData) { } } -#define JS_FIELD_MINWIDTH 1 -#define JS_FIELD_MINHEIGHT 1 - void Field::AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType, diff --git a/fpdfsdk/src/javascript/JS_Context.cpp b/fpdfsdk/src/javascript/JS_Context.cpp index 8d54cddc41..b9a10e1bc2 100644 --- a/fpdfsdk/src/javascript/JS_Context.cpp +++ b/fpdfsdk/src/javascript/JS_Context.cpp @@ -27,8 +27,6 @@ CPDFSDK_Document* CJS_Context::GetReaderDocument() { } CPDFDoc_Environment* CJS_Context::GetReaderApp() { - ASSERT(m_pRuntime != NULL); - return m_pRuntime->GetReaderApp(); } diff --git a/fpdfsdk/src/javascript/JS_EventHandler.cpp b/fpdfsdk/src/javascript/JS_EventHandler.cpp index df7f9791c2..e413166328 100644 --- a/fpdfsdk/src/javascript/JS_EventHandler.cpp +++ b/fpdfsdk/src/javascript/JS_EventHandler.cpp @@ -115,7 +115,6 @@ void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier, m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); } @@ -126,7 +125,6 @@ void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier, m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); } @@ -138,7 +136,6 @@ void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier, m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); } @@ -149,7 +146,6 @@ void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier, m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); } @@ -161,7 +157,6 @@ void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier, m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = (CFX_WideString*)&Value; } @@ -174,7 +169,6 @@ void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier, m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = (CFX_WideString*)&Value; } @@ -201,7 +195,6 @@ void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange, m_pISelEnd = &nSelEnd; m_pISelStart = &nSelStart; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = &Value; m_bWillCommit = bWillCommit; @@ -224,7 +217,6 @@ void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, m_bKeyDown = bKeyDown; m_bModifier = bModifier; m_bShift = bShift; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = &Value; m_pbRc = &bRc; @@ -238,7 +230,6 @@ void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, if (pSource) m_strSourceName = pSource->GetFullName(); - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = &Value; m_pbRc = &bRc; @@ -250,7 +241,6 @@ void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget, Initial(JET_FIELD_FORMAT); m_nCommitKey = 0; - ASSERT(pTarget != NULL); m_strTargetName = pTarget->GetFullName(); m_pValue = &Value; m_bWillCommit = bWillCommit; diff --git a/fpdfsdk/src/javascript/JS_GlobalData.cpp b/fpdfsdk/src/javascript/JS_GlobalData.cpp index d9a07a8507..474886c484 100644 --- a/fpdfsdk/src/javascript/JS_GlobalData.cpp +++ b/fpdfsdk/src/javascript/JS_GlobalData.cpp @@ -23,8 +23,6 @@ void CJS_GlobalVariableArray::Copy(const CJS_GlobalVariableArray& array) { Empty(); for (int i = 0, sz = array.Count(); i < sz; i++) { CJS_KeyValue* pOldObjData = array.GetAt(i); - ASSERT(pOldObjData != NULL); - switch (pOldObjData->nType) { case JS_GLOBALDATA_TYPE_NUMBER: { CJS_KeyValue* pNewObjData = new CJS_KeyValue; @@ -141,19 +139,15 @@ int CJS_GlobalData::FindGlobalVariable(const FX_CHAR* propname) { CJS_GlobalData_Element* CJS_GlobalData::GetGlobalVariable( const FX_CHAR* propname) { - ASSERT(propname != NULL); + ASSERT(propname); int nFind = FindGlobalVariable(propname); - if (nFind >= 0) - return m_arrayGlobalData.GetAt(nFind); - - return NULL; + return nFind >= 0 ? m_arrayGlobalData.GetAt(nFind) : nullptr; } void CJS_GlobalData::SetGlobalVariableNumber(const FX_CHAR* propname, double dData) { - ASSERT(propname != NULL); - + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); sPropName.TrimRight(); @@ -174,7 +168,7 @@ void CJS_GlobalData::SetGlobalVariableNumber(const FX_CHAR* propname, void CJS_GlobalData::SetGlobalVariableBoolean(const FX_CHAR* propname, bool bData) { - ASSERT(propname != NULL); + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); @@ -198,7 +192,7 @@ void CJS_GlobalData::SetGlobalVariableBoolean(const FX_CHAR* propname, void CJS_GlobalData::SetGlobalVariableString(const FX_CHAR* propname, const CFX_ByteString& sData) { - ASSERT(propname != NULL); + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); @@ -223,7 +217,7 @@ void CJS_GlobalData::SetGlobalVariableString(const FX_CHAR* propname, void CJS_GlobalData::SetGlobalVariableObject( const FX_CHAR* propname, const CJS_GlobalVariableArray& array) { - ASSERT(propname != NULL); + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); @@ -246,7 +240,7 @@ void CJS_GlobalData::SetGlobalVariableObject( } void CJS_GlobalData::SetGlobalVariableNull(const FX_CHAR* propname) { - ASSERT(propname != NULL); + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); @@ -268,7 +262,7 @@ void CJS_GlobalData::SetGlobalVariableNull(const FX_CHAR* propname) { FX_BOOL CJS_GlobalData::SetGlobalVariablePersistent(const FX_CHAR* propname, FX_BOOL bPersistent) { - ASSERT(propname != NULL); + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); @@ -286,7 +280,7 @@ FX_BOOL CJS_GlobalData::SetGlobalVariablePersistent(const FX_CHAR* propname, } FX_BOOL CJS_GlobalData::DeleteGlobalVariable(const FX_CHAR* propname) { - ASSERT(propname != NULL); + ASSERT(propname); CFX_ByteString sPropName = propname; sPropName.TrimLeft(); @@ -409,8 +403,6 @@ void CJS_GlobalData::SaveGlobalPersisitentVariables() { for (int i = 0, sz = m_arrayGlobalData.GetSize(); i < sz; i++) { CJS_GlobalData_Element* pElement = m_arrayGlobalData.GetAt(i); - ASSERT(pElement != NULL); - if (pElement->bPersistent) { CFX_BinaryBuf sElement; MakeByteString(pElement->data.sKey, &pElement->data, sElement); diff --git a/fpdfsdk/src/javascript/JS_Object.cpp b/fpdfsdk/src/javascript/JS_Object.cpp index 529b540237..058ec02925 100644 --- a/fpdfsdk/src/javascript/JS_Object.cpp +++ b/fpdfsdk/src/javascript/JS_Object.cpp @@ -86,8 +86,6 @@ int CJS_Object::MsgBox(CPDFDoc_Environment* pApp, } void CJS_Object::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) { - ASSERT(pContext != NULL); - if (pContext->IsMsgBoxEnabled()) { CPDFDoc_Environment* pApp = pContext->GetReaderApp(); if (pApp) diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp index 094f3e7dd7..c2e15fb116 100644 --- a/fpdfsdk/src/javascript/PublicMethods.cpp +++ b/fpdfsdk/src/javascript/PublicMethods.cpp @@ -1096,9 +1096,7 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke( CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (params.size() < 2) return FALSE; @@ -1217,9 +1215,7 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format( CFX_WideString& sError) { #if _FX_OS_ != _FX_ANDROID_ CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (params.size() != 2) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); @@ -1319,9 +1315,7 @@ FX_BOOL CJS_PublicMethods::AFDate_FormatEx(IJS_Context* cc, CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (params.size() != 1) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); @@ -1436,9 +1430,7 @@ FX_BOOL CJS_PublicMethods::AFDate_KeystrokeEx( CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (params.size() != 1) { sError = L"AFDate_KeystrokeEx's parameters' size r not correct"; @@ -1609,7 +1601,6 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Format( CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); if (params.size() != 1) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); @@ -1620,8 +1611,6 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Format( int iIndex = params[0].ToInt(); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); - if (!pEvent->m_pValue) return FALSE; CFX_WideString& Value = pEvent->Value(); @@ -1661,11 +1650,8 @@ FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx( CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); - if (params.size() < 1) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); return FALSE; @@ -1805,9 +1791,7 @@ FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc, CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEventHandler = pContext->GetEventHandler(); - ASSERT(pEventHandler != NULL); if (params.size() != 1) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); @@ -1847,7 +1831,7 @@ FX_BOOL CJS_PublicMethods::AFParseDateEx(IJS_Context* cc, CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); + ASSERT(pContext); if (params.size() != 2) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); @@ -1878,7 +1862,7 @@ FX_BOOL CJS_PublicMethods::AFSimple(IJS_Context* cc, CFX_WideString& sError) { if (params.size() != 3) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); + ASSERT(pContext); sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); return FALSE; @@ -1895,7 +1879,7 @@ FX_BOOL CJS_PublicMethods::AFMakeNumber(IJS_Context* cc, CFX_WideString& sError) { if (params.size() != 1) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); + ASSERT(pContext); sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); return FALSE; @@ -2011,9 +1995,7 @@ FX_BOOL CJS_PublicMethods::AFRange_Validate( CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (params.size() != 4) { sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp index 70ce771090..0ed280740d 100644 --- a/fpdfsdk/src/javascript/app.cpp +++ b/fpdfsdk/src/javascript/app.cpp @@ -126,7 +126,7 @@ FX_BOOL app::activeDocs(IJS_Context* cc, pRuntime->GetIsolate(), pRuntime, CJS_Document::g_nObjDefnID); pJSDocument = (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); - ASSERT(pJSDocument != NULL); + ASSERT(pJSDocument); } aDocs.SetElement(0, CJS_Value(pRuntime, pJSDocument)); } @@ -416,9 +416,7 @@ FX_BOOL app::setTimeOut(IJS_Context* cc, } CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - ASSERT(pRuntime != NULL); CFX_WideString script = params.size() > 0 ? params[0].ToCFXWideString() : L""; if (script.IsEmpty()) { @@ -527,8 +525,6 @@ FX_BOOL app::execMenuItem(IJS_Context* cc, } void app::TimerProc(CJS_Timer* pTimer) { - ASSERT(pTimer != NULL); - CJS_Runtime* pRuntime = pTimer->GetRuntime(); switch (pTimer->GetType()) { @@ -770,10 +766,7 @@ FX_BOOL app::response(IJS_Context* cc, } CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); - CPDFDoc_Environment* pApp = pContext->GetReaderApp(); - ASSERT(pApp != NULL); const int MAX_INPUT_BYTES = 2048; nonstd::unique_ptr<char[]> pBuff(new char[MAX_INPUT_BYTES + 2]); diff --git a/fpdfsdk/src/javascript/event.cpp b/fpdfsdk/src/javascript/event.cpp index 5ad1ca513f..2362c01287 100644 --- a/fpdfsdk/src/javascript/event.cpp +++ b/fpdfsdk/src/javascript/event.cpp @@ -56,10 +56,7 @@ FX_BOOL event::change(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); - CFX_WideString& wChange = pEvent->Change(); if (vp.IsSetting()) { if (vp.GetType() == CJS_Value::VT_string) @@ -77,9 +74,7 @@ FX_BOOL event::changeEx(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->ChangeEx(); return TRUE; @@ -92,9 +87,7 @@ FX_BOOL event::commitKey(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->CommitKey(); return TRUE; @@ -104,9 +97,7 @@ FX_BOOL event::fieldFull(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (!vp.IsGetting() && wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) @@ -126,9 +117,7 @@ FX_BOOL event::keyDown(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (pEvent->KeyDown()) vp << TRUE; @@ -144,9 +133,7 @@ FX_BOOL event::modifier(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (pEvent->Modifier()) vp << TRUE; @@ -162,9 +149,7 @@ FX_BOOL event::name(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->Name(); return TRUE; @@ -172,9 +157,7 @@ FX_BOOL event::name(IJS_Context* cc, FX_BOOL event::rc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); FX_BOOL& bRc = pEvent->Rc(); if (vp.IsSetting()) { @@ -222,9 +205,7 @@ FX_BOOL event::selEnd(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) { return TRUE; @@ -243,9 +224,7 @@ FX_BOOL event::selStart(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) { return TRUE; @@ -266,9 +245,7 @@ FX_BOOL event::shift(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (pEvent->Shift()) vp << TRUE; @@ -284,9 +261,7 @@ FX_BOOL event::source(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->Source()->GetJSObject(); return TRUE; @@ -299,9 +274,7 @@ FX_BOOL event::target(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->Target_Field()->GetJSObject(); return TRUE; @@ -314,9 +287,7 @@ FX_BOOL event::targetName(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->TargetName(); return TRUE; @@ -329,9 +300,7 @@ FX_BOOL event::type(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); vp << pEvent->Type(); return TRUE; @@ -341,9 +310,7 @@ FX_BOOL event::value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (wcscmp((const wchar_t*)pEvent->Type(), L"Field") != 0) return FALSE; @@ -365,9 +332,7 @@ FX_BOOL event::willCommit(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_EventHandler* pEvent = pContext->GetEventHandler(); - ASSERT(pEvent != NULL); if (pEvent->WillCommit()) vp << TRUE; diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp index 2d9799dd4e..7a43b677e9 100644 --- a/fpdfsdk/src/javascript/global.cpp +++ b/fpdfsdk/src/javascript/global.cpp @@ -227,12 +227,8 @@ FX_BOOL JSGlobalAlternate::setPersistent(IJS_Context* cc, } void JSGlobalAlternate::UpdateGlobalPersistentVariables() { - ASSERT(m_pGlobalData != NULL); - for (int i = 0, sz = m_pGlobalData->GetSize(); i < sz; i++) { CJS_GlobalData_Element* pData = m_pGlobalData->GetAt(i); - ASSERT(pData != NULL); - switch (pData->data.nType) { case JS_GLOBALDATA_TYPE_NUMBER: SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER, @@ -380,12 +376,8 @@ void JSGlobalAlternate::ObjectToArray(IJS_Context* cc, void JSGlobalAlternate::PutObjectProperty(v8::Local<v8::Object> pObj, CJS_KeyValue* pData) { - ASSERT(pData != NULL); - for (int i = 0, sz = pData->objData.Count(); i < sz; i++) { CJS_KeyValue* pObjData = pData->objData.GetAt(i); - ASSERT(pObjData != NULL); - switch (pObjData->nType) { case JS_GLOBALDATA_TYPE_NUMBER: FXJS_PutObjectNumber(NULL, pObj, pObjData->sKey.UTF8Decode().c_str(), diff --git a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp index 1c69f18b9f..8d54ae0a13 100644 --- a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp @@ -27,7 +27,7 @@ CPWL_EditCtrl::CPWL_EditCtrl() m_nCharSet(DEFAULT_CHARSET), m_nCodePage(0) { m_pEdit = IFX_Edit::NewEdit(); - ASSERT(m_pEdit != NULL); + ASSERT(m_pEdit); } CPWL_EditCtrl::~CPWL_EditCtrl() { diff --git a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp index cd65c383ff..d5ca376882 100644 --- a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp @@ -14,7 +14,7 @@ CPWL_FontMap::CPWL_FontMap(IFX_SystemHandler* pSystemHandler) : m_pPDFDoc(NULL), m_pSystemHandler(pSystemHandler) { - ASSERT(m_pSystemHandler != NULL); + ASSERT(m_pSystemHandler); } CPWL_FontMap::~CPWL_FontMap() { diff --git a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp index 61ad1f6913..db5355c59e 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp @@ -137,7 +137,7 @@ void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { fBottom = 0.0f; CPDF_Array* pA = m_pIconFit->m_pDict ? m_pIconFit->m_pDict->GetArray("A") : NULL; - if (pA != NULL) { + if (pA) { FX_DWORD dwCount = pA->GetCount(); if (dwCount > 0) fLeft = pA->GetNumber(0); diff --git a/fpdfsdk/src/pdfwindow/PWL_Label.cpp b/fpdfsdk/src/pdfwindow/PWL_Label.cpp index 23be536766..8ff7235701 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Label.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Label.cpp @@ -13,8 +13,7 @@ CPWL_Label::CPWL_Label() : m_pEdit(NULL) { m_pEdit = IFX_Edit::NewEdit(); - - ASSERT(m_pEdit != NULL); + ASSERT(m_pEdit); } CPWL_Label::~CPWL_Label() { diff --git a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp index 9b62c471d7..685da4fd34 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp @@ -20,7 +20,7 @@ /* ------------------------ CPWL_List_Notify ----------------------- */ CPWL_List_Notify::CPWL_List_Notify(CPWL_ListBox* pList) : m_pList(pList) { - ASSERT(m_pList != NULL); + ASSERT(m_pList); } CPWL_List_Notify::~CPWL_List_Notify() {} @@ -74,8 +74,6 @@ CPWL_ListBox::CPWL_ListBox() m_bHoverSel(FALSE), m_pFillerNotify(NULL) { m_pList = IFX_List::NewList(); - - ASSERT(m_pList != NULL); } CPWL_ListBox::~CPWL_ListBox() { diff --git a/fpdfsdk/src/pdfwindow/PWL_Note.cpp b/fpdfsdk/src/pdfwindow/PWL_Note.cpp index f15004dcd6..d87c3df916 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Note.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Note.cpp @@ -47,8 +47,6 @@ void CPWL_Note_Options::SetTextColor(const CPWL_Color& color) { void CPWL_Note_Options::RePosChildWnd() { if (IsValid()) { - ASSERT(m_pText != NULL); - CPDF_Rect rcClient = GetClientRect(); if (rcClient.Width() > 15.0f) { @@ -103,8 +101,6 @@ void CPWL_Note_Options::DrawThisAppearance(CFX_RenderDevice* pDevice, } CPDF_Rect CPWL_Note_Options::GetContentRect() const { - ASSERT(m_pText != NULL); - CPDF_Rect rcText = m_pText->GetContentRect(); rcText.right += 15.0f; return rcText; @@ -661,10 +657,6 @@ void CPWL_NoteItem::CreateChildWnd(const PWL_CREATEPARAM& cp) { void CPWL_NoteItem::RePosChildWnd() { if (IsValid()) { - ASSERT(m_pSubject != NULL); - ASSERT(m_pDateTime != NULL); - ASSERT(m_pContents != NULL); - CPDF_Rect rcClient = GetClientRect(); CPDF_Rect rcSubject = rcClient; @@ -759,8 +751,6 @@ void CPWL_NoteItem::ResetSubjectName(int32_t nItemIndex) { } const CPWL_Note* pNote = GetNote(); - ASSERT(pNote != NULL); - CFX_WideString sSubject; sSubject.Format(pNote->GetReplyString().c_str(), nItemIndex); @@ -925,10 +915,6 @@ FX_FLOAT CPWL_NoteItem::GetItemHeight(FX_FLOAT fLimitWidth) { m_bSizeChanged = FALSE; - ASSERT(m_pSubject != NULL); - ASSERT(m_pDateTime != NULL); - ASSERT(m_pContents != NULL); - FX_FLOAT fRet = m_pDateTime->GetContentRect().Height(); FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); if (fLimitWidth > fBorderWidth * 2) @@ -1156,17 +1142,6 @@ void CPWL_Note::RePosNoteChildren() { m_bResizing = TRUE; if (IsValid()) { - ASSERT(m_pSubject != NULL); - ASSERT(m_pDateTime != NULL); - ASSERT(m_pContents != NULL); - ASSERT(m_pAuthor != NULL); - ASSERT(m_pCloseBox != NULL); - ASSERT(m_pIcon != NULL); - ASSERT(m_pLBBox != NULL); - ASSERT(m_pRBBox != NULL); - ASSERT(m_pContentsBar != NULL); - ASSERT(m_pOptions != NULL); - CPDF_Rect rcClient = GetClientRect(); CPDF_Rect rcIcon = rcClient; @@ -1267,21 +1242,10 @@ void CPWL_Note::RePosNoteChildren() { m_bResizing = FALSE; } +// TODO(thestig): Make this return an enum. // 0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / // 5-options int32_t CPWL_Note::NoteHitTest(const CPDF_Point& point) const { - ASSERT(m_pSubject != NULL); - ASSERT(m_pDateTime != NULL); - ASSERT(m_pContents != NULL); - ASSERT(m_pAuthor != NULL); - ASSERT(m_pIcon != NULL); - ASSERT(m_pContentsBar != NULL); - - ASSERT(m_pCloseBox != NULL); - ASSERT(m_pLBBox != NULL); - ASSERT(m_pRBBox != NULL); - ASSERT(m_pOptions != NULL); - GetClientRect(); if (m_pSubject->WndHitTest(m_pSubject->ParentToChild(point))) diff --git a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp index f4d4baf6e9..b6a1bb3e6e 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp @@ -14,9 +14,6 @@ #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) -/* ------------------------------- PWL_FLOATRANGE - * ------------------------------- */ - PWL_FLOATRANGE::PWL_FLOATRANGE() { Default(); } @@ -49,9 +46,6 @@ FX_FLOAT PWL_FLOATRANGE::GetWidth() const { return fMax - fMin; } -/* ------------------------------- PWL_SCROLL_PRIVATEDATA - * ------------------------------- */ - PWL_SCROLL_PRIVATEDATA::PWL_SCROLL_PRIVATEDATA() { Default(); } @@ -113,9 +107,6 @@ void PWL_SCROLL_PRIVATEDATA::SubBig() { SetPos(ScrollRange.fMin); } -/* ------------------------------- CPWL_SBButton ------------------------------- - */ - CPWL_SBButton::CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType, PWL_SBBUTTON_TYPE eButtonType) { m_eScrollBarType = eScrollBarType; @@ -405,8 +396,6 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } break; case PSBT_POS: { - // CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device); - // draw border CPDF_Rect rcDraw = rectWnd; CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, @@ -532,14 +521,6 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, crStroke, 1.0f); - - /* - ptLeft.y += 1.5f; - ptRight.y += 1.5f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, - ArgbEncode(nTransparancy,150,150,150),1.0f); - */ } } break; default: @@ -580,24 +561,11 @@ FX_BOOL CPWL_SBButton::OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag) { if (CPWL_Wnd* pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_MOUSEMOVE, 0, (intptr_t)&point); - - /* - if (m_bMouseDown && (m_eSBButtonType == PSBT_MIN || m_eSBButtonType == - PSBT_MAX)) - { - if - (!pParent->OnNotify(this,PNM_LBUTTONDOWN,nFlags,(intptr_t)&point)) - return FALSE; - } - */ } return TRUE; } -/* ------------------------------- CPWL_ScrollBar - * ---------------------------------- */ - CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType) : m_sbType(sbType), m_pMinButton(NULL), @@ -923,9 +891,8 @@ void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep) { } void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) { - ASSERT(m_pPosButton != NULL); - ASSERT(m_pMinButton != NULL); - ASSERT(m_pMaxButton != NULL); + ASSERT(m_pMinButton); + ASSERT(m_pMaxButton); if (m_pPosButton->IsVisible()) { CPDF_Rect rcClient; diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp index 85593e11d4..71a9d474b7 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp @@ -528,9 +528,6 @@ CFX_ByteString CPWL_Utils::GetSpellCheckAppStream( IPWL_SpellCheck* pSpellCheck, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange) { - ASSERT(pEdit != NULL); - ASSERT(pSpellCheck != NULL); - CFX_ByteTextBuf sRet; if (pRange && pRange->IsExist()) { diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp index 002fc051af..baa24cb8bf 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp @@ -22,8 +22,8 @@ static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() { CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler) : m_nTimerID(0), m_pAttached(pAttached), m_pSystemHandler(pSystemHandler) { - ASSERT(m_pAttached != NULL); - ASSERT(m_pSystemHandler != NULL); + ASSERT(m_pAttached); + ASSERT(m_pSystemHandler); } CPWL_Timer::~CPWL_Timer() { |