Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(635)

Unified Diff: xfa/fxfa/app/xfa_ffwidget.cpp

Issue 2031873003: Get rid of NULLs in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_fpdfsdk
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/app/xfa_fftextedit.cpp ('k') | xfa/fxfa/app/xfa_ffwidgetacc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/app/xfa_ffwidget.cpp
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index 8e10189f8c1bbeb94c026a055ccaaef1cb24b91b..2353f1ba1aab900f10a901206b57636be47c82db 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -121,7 +121,7 @@ void CXFA_FFWidget::RenderWidget(CFX_Graphics* pGS,
}
}
FX_BOOL CXFA_FFWidget::IsLoaded() {
- return m_pPageView != NULL;
+ return !!m_pPageView;
}
FX_BOOL CXFA_FFWidget::LoadWidget() {
PerformLayout();
@@ -347,10 +347,10 @@ CXFA_FFWidget* CXFA_FFWidget::GetParent() {
CXFA_WidgetAcc* pParentWidgetAcc =
(CXFA_WidgetAcc*)pParentNode->GetWidgetData();
if (pParentWidgetAcc) {
- return pParentWidgetAcc->GetNextWidget(NULL);
+ return pParentWidgetAcc->GetNextWidget(nullptr);
}
}
- return NULL;
+ return nullptr;
}
FX_BOOL CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) {
if (!pWidget) {
@@ -523,14 +523,14 @@ class CXFA_ImageRenderer {
int Transparency);
};
CXFA_ImageRenderer::CXFA_ImageRenderer() {
- m_pDevice = NULL;
+ m_pDevice = nullptr;
m_Status = 0;
- m_pDIBSource = NULL;
- m_pCloneConvert = NULL;
+ m_pDIBSource = nullptr;
+ m_pCloneConvert = nullptr;
m_BitmapAlpha = 255;
m_FillArgb = 0;
m_Flags = 0;
- m_DeviceHandle = NULL;
+ m_DeviceHandle = nullptr;
m_BlendType = FXDIB_BLEND_NORMAL;
m_Result = TRUE;
m_bPrint = FALSE;
@@ -680,9 +680,9 @@ void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
int bitmap_alpha,
int blend_mode,
int Transparency) {
- if (pDIBitmap == NULL) {
+ if (!pDIBitmap)
return;
- }
+
bool bIsolated = !!(Transparency & PDFTRANS_ISOLATED);
bool bGroup = !!(Transparency & PDFTRANS_GROUP);
if (blend_mode == FXDIB_BLEND_NORMAL) {
@@ -719,7 +719,7 @@ void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
top + pDIBitmap->GetHeight());
rect.Intersect(m_pDevice->GetClipBox());
- CFX_DIBitmap* pClone = NULL;
+ CFX_DIBitmap* pClone = nullptr;
FX_BOOL bClone = FALSE;
if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
bClone = TRUE;
@@ -762,7 +762,7 @@ void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
FX_BOOL bRet = imageRender.Start(m_pDevice, pCloneConvert, m_FillArgb,
m_BitmapAlpha, &m_ImageMatrix, m_Flags);
while (bRet) {
- bRet = imageRender.Continue(NULL);
+ bRet = imageRender.Continue(nullptr);
}
delete pCloneConvert;
return;
@@ -836,7 +836,7 @@ void XFA_DrawImage(CFX_Graphics* pGS,
FX_BOOL bRet = imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage,
FXDIB_INTERPOL);
while (bRet) {
- bRet = imageRender.Continue(NULL);
+ bRet = imageRender.Continue(nullptr);
}
pRenderDevice->RestoreState(false);
}
@@ -871,14 +871,14 @@ static uint8_t* XFA_RemoveBase64Whitespace(const uint8_t* pStr, int32_t iLen) {
return pCP;
}
static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) {
- if (pStr == NULL) {
+ if (!pStr)
return 0;
- }
+
uint8_t* pBuffer =
XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((FX_CHAR*)pStr));
- if (pBuffer == NULL) {
+ if (!pBuffer)
return 0;
- }
+
int32_t iLen = FXSYS_strlen((FX_CHAR*)pBuffer);
int32_t i = 0, j = 0;
uint32_t dwLimb = 0;
@@ -920,7 +920,7 @@ static const FX_CHAR g_base64_chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) {
- FX_CHAR* out = NULL;
+ FX_CHAR* out = nullptr;
int i, j;
uint32_t limb;
out = FX_Alloc(FX_CHAR, ((buf_len * 8 + 5) / 6) + 5);
@@ -985,14 +985,14 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
CFX_WideString wsImage;
pImage->GetContent(wsImage);
if (wsHref.IsEmpty() && wsImage.IsEmpty()) {
- return NULL;
+ return nullptr;
}
CFX_WideString wsContentType;
pImage->GetContentType(wsContentType);
FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType);
CFX_ByteString bsContent;
- uint8_t* pImageBuffer = NULL;
- IFX_FileRead* pImageFileRead = NULL;
+ uint8_t* pImageBuffer = nullptr;
+ IFX_FileRead* pImageFileRead = nullptr;
if (wsImage.GetLength() > 0) {
XFA_ATTRIBUTEENUM iEncoding =
(XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding();
@@ -1024,7 +1024,7 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
}
if (!pImageFileRead) {
FX_Free(pImageBuffer);
- return NULL;
+ return nullptr;
}
bNameImage = FALSE;
CFX_DIBitmap* pBitmap =
@@ -1059,14 +1059,14 @@ CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_FileRead* pImageFileRead,
int32_t& iImageYDpi) {
CFX_GEModule* pGeModule = CFX_GEModule::Get();
if (!pGeModule) {
- return NULL;
+ return nullptr;
}
CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule();
if (!pCodecMgr) {
- return NULL;
+ return nullptr;
}
CFX_DIBAttribute dibAttr;
- CFX_DIBitmap* pBitmap = NULL;
+ CFX_DIBitmap* pBitmap = nullptr;
CCodec_ProgressiveDecoder* pProgressiveDecoder =
pCodecMgr->CreateProgressiveDecoder();
pProgressiveDecoder->LoadImageInfo(pImageFileRead, type, &dibAttr);
« no previous file with comments | « xfa/fxfa/app/xfa_fftextedit.cpp ('k') | xfa/fxfa/app/xfa_ffwidgetacc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698