summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_Image.cpp
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-06-07 10:46:22 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-07 10:46:23 -0700
commit4997b22f84307521a62838f874928bf56cd3423c (patch)
treead11d99ac0a491ee222e9d0a42ec3b6ad3354e2a /core/fxcodec/jbig2/JBig2_Image.cpp
parent0687e76dc259c678b3f29a6608331f07ffd8f1e2 (diff)
downloadpdfium-4997b22f84307521a62838f874928bf56cd3423c.tar.xz
Get rid of NULLs in core/
Review-Url: https://codereview.chromium.org/2032613003
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_Image.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_Image.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp
index 6a1c060b75..cf0ee3bbbc 100644
--- a/core/fxcodec/jbig2/JBig2_Image.cpp
+++ b/core/fxcodec/jbig2/JBig2_Image.cpp
@@ -14,7 +14,7 @@ CJBig2_Image::CJBig2_Image(int32_t w, int32_t h) {
m_nWidth = w;
m_nHeight = h;
if (m_nWidth <= 0 || m_nHeight <= 0 || m_nWidth > INT_MAX - 31) {
- m_pData = NULL;
+ m_pData = nullptr;
m_bNeedFree = FALSE;
return;
}
@@ -22,7 +22,7 @@ CJBig2_Image::CJBig2_Image(int32_t w, int32_t h) {
if (m_nStride * m_nHeight > 0 && 104857600 / (int)m_nStride > m_nHeight) {
m_pData = FX_Alloc2D(uint8_t, m_nStride, m_nHeight);
} else {
- m_pData = NULL;
+ m_pData = nullptr;
}
m_bNeedFree = TRUE;
}
@@ -44,7 +44,7 @@ CJBig2_Image::CJBig2_Image(const CJBig2_Image& im) {
m_pData = FX_Alloc2D(uint8_t, m_nStride, m_nHeight);
JBIG2_memcpy(m_pData, im.m_pData, m_nStride * m_nHeight);
} else {
- m_pData = NULL;
+ m_pData = nullptr;
}
m_bNeedFree = TRUE;
}
@@ -120,12 +120,12 @@ FX_BOOL CJBig2_Image::composeTo(CJBig2_Image* pDst,
int32_t y,
JBig2ComposeOp op,
const FX_RECT* pSrcRect) {
- if (!m_pData) {
+ if (!m_pData)
return FALSE;
- }
- if (NULL == pSrcRect || *pSrcRect == FX_RECT(0, 0, m_nWidth, m_nHeight)) {
+
+ if (!pSrcRect || *pSrcRect == FX_RECT(0, 0, m_nWidth, m_nHeight))
return composeTo_opt2(pDst, x, y, op);
- }
+
return composeTo_opt2(pDst, x, y, op, pSrcRect);
}
@@ -159,7 +159,7 @@ CJBig2_Image* CJBig2_Image::subImage(int32_t x,
uint32_t wTmp;
uint8_t *pSrc, *pSrcEnd, *pDst, *pDstEnd;
if (w == 0 || h == 0) {
- return NULL;
+ return nullptr;
}
CJBig2_Image* pImage = new CJBig2_Image(w, h);
if (!m_pData) {
@@ -243,14 +243,12 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst,
uint32_t s1 = 0, d1 = 0, d2 = 0, shift = 0, shift1 = 0, shift2 = 0, tmp = 0,
tmp1 = 0, tmp2 = 0, maskL = 0, maskR = 0, maskM = 0;
- uint8_t *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL;
-
- if (!m_pData) {
+ if (!m_pData)
return FALSE;
- }
- if (x < -1048576 || x > 1048576 || y < -1048576 || y > 1048576) {
+
+ if (x < -1048576 || x > 1048576 || y < -1048576 || y > 1048576)
return FALSE;
- }
+
if (y < 0) {
ys0 = -y;
}
@@ -286,9 +284,9 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst,
maskL = 0xffffffff >> d1;
maskR = 0xffffffff << ((32 - (xd1 & 31)) % 32);
maskM = maskL & maskR;
- lineSrc = m_pData + ys0 * m_nStride + ((xs0 >> 5) << 2);
+ uint8_t* lineSrc = m_pData + ys0 * m_nStride + ((xs0 >> 5) << 2);
lineLeft = m_nStride - ((xs0 >> 5) << 2);
- lineDst = pDst->m_pData + yd0 * pDst->m_nStride + ((xd0 >> 5) << 2);
+ uint8_t* lineDst = pDst->m_pData + yd0 * pDst->m_nStride + ((xd0 >> 5) << 2);
if ((xd0 & ~31) == ((xd1 - 1) & ~31)) {
if ((xs0 & ~31) == ((xs1 - 1) & ~31)) {
if (s1 > d1) {
@@ -383,6 +381,9 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst,
}
}
} else {
+ uint8_t* sp = nullptr;
+ uint8_t* dp = nullptr;
+
if (s1 > d1) {
shift1 = s1 - d1;
shift2 = 32 - shift1;