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

Unified Diff: core/fxcodec/jbig2/JBig2_GrrdProc.cpp

Issue 2034253003: Fix more code which has shadow variables (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
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
Index: core/fxcodec/jbig2/JBig2_GrrdProc.cpp
diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
index 17d17d558e0ab89065ed500391fe2448702fb1b4..b7eb62aae5ea3dba5f0b14da9d8fbc99b742d4cb 100644
--- a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
@@ -159,11 +159,11 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt(
intptr_t nStride, nStrideR, nOffset;
int32_t k, nBits;
int32_t GRWR, GRHR;
- int32_t GRW, GRH;
- GRW = (int32_t)CJBig2_GRRDProc::GRW;
- GRH = (int32_t)CJBig2_GRRDProc::GRH;
+ int32_t iGRW, iGRH;
dsinclair 2016/06/06 12:50:11 nit: one per line
Wei Li 2016/06/07 17:33:53 Done.
+ iGRW = static_cast<int32_t>(GRW);
+ iGRH = static_cast<int32_t>(GRH);
LTP = 0;
- std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH));
+ std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(iGRW, iGRH));
if (!GRREG->m_pData)
return nullptr;
@@ -177,7 +177,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt(
GRREFERENCEDY = 0;
}
nOffset = -GRREFERENCEDY * nStrideR;
- for (int32_t h = 0; h < GRH; h++) {
+ for (int32_t h = 0; h < iGRH; h++) {
if (TPGRON) {
SLTP = pArithDecoder->DECODE(&grContext[0x0010]);
LTP = LTP ^ SLTP;
@@ -193,11 +193,11 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt(
if (LTP == 0) {
CONTEXT = (line1 & 0x1c00) | (line1_r & 0x01c0) |
((line2_r >> 3) & 0x0038) | ((line3_r >> 6) & 0x0007);
- for (int32_t w = 0; w < GRW; w += 8) {
- nBits = GRW - w > 8 ? 8 : GRW - w;
+ for (int32_t w = 0; w < iGRW; w += 8) {
+ nBits = iGRW - w > 8 ? 8 : iGRW - w;
if (h > 0)
line1 = (line1 << 8) |
- (w + 8 < GRW ? pLine[-nStride + (w >> 3) + 1] << 4 : 0);
+ (w + 8 < iGRW ? pLine[-nStride + (w >> 3) + 1] << 4 : 0);
if (h > GRHR + GRREFERENCEDY + 1) {
line1_r = 0;
line2_r = 0;
@@ -233,11 +233,11 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt(
} else {
CONTEXT = (line1 & 0x1c00) | (line1_r & 0x01c0) |
((line2_r >> 3) & 0x0038) | ((line3_r >> 6) & 0x0007);
- for (int32_t w = 0; w < GRW; w += 8) {
- nBits = GRW - w > 8 ? 8 : GRW - w;
+ for (int32_t w = 0; w < iGRW; w += 8) {
+ nBits = iGRW - w > 8 ? 8 : iGRW - w;
if (h > 0)
line1 = (line1 << 8) |
- (w + 8 < GRW ? pLine[-nStride + (w >> 3) + 1] << 4 : 0);
+ (w + 8 < iGRW ? pLine[-nStride + (w >> 3) + 1] << 4 : 0);
if (line1_r_ok)
line1_r =
(line1_r << 8) |
@@ -397,11 +397,11 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt(
intptr_t nStride, nStrideR, nOffset;
int32_t k, nBits;
int32_t GRWR, GRHR;
Tom Sepez 2016/06/06 16:43:33 nit: move to line 412 while at it.
Wei Li 2016/06/07 17:33:53 Done.
- int32_t GRW, GRH;
- GRW = (int32_t)CJBig2_GRRDProc::GRW;
- GRH = (int32_t)CJBig2_GRRDProc::GRH;
+ int32_t iGRW, iGRH;
dsinclair 2016/06/06 12:50:11 ditto
Tom Sepez 2016/06/06 16:43:33 Also combine definition and initialization onto on
Wei Li 2016/06/07 17:33:53 Done.
Wei Li 2016/06/07 17:33:53 Done.
+ iGRW = static_cast<int32_t>(GRW);
+ iGRH = static_cast<int32_t>(GRH);
LTP = 0;
- std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH));
+ std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(iGRW, iGRH));
if (!GRREG->m_pData)
return nullptr;
@@ -415,7 +415,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt(
GRREFERENCEDY = 0;
}
nOffset = -GRREFERENCEDY * nStrideR;
- for (int32_t h = 0; h < GRH; h++) {
+ for (int32_t h = 0; h < iGRH; h++) {
if (TPGRON) {
SLTP = pArithDecoder->DECODE(&grContext[0x0008]);
LTP = LTP ^ SLTP;
@@ -431,11 +431,11 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt(
if (LTP == 0) {
CONTEXT = (line1 & 0x0380) | ((line1_r >> 2) & 0x0020) |
((line2_r >> 4) & 0x001c) | ((line3_r >> 6) & 0x0003);
- for (int32_t w = 0; w < GRW; w += 8) {
- nBits = GRW - w > 8 ? 8 : GRW - w;
+ for (int32_t w = 0; w < iGRW; w += 8) {
+ nBits = iGRW - w > 8 ? 8 : iGRW - w;
if (h > 0)
line1 = (line1 << 8) |
- (w + 8 < GRW ? pLine[-nStride + (w >> 3) + 1] << 1 : 0);
+ (w + 8 < iGRW ? pLine[-nStride + (w >> 3) + 1] << 1 : 0);
if (line1_r_ok)
line1_r =
(line1_r << 8) |
@@ -465,11 +465,11 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt(
} else {
CONTEXT = (line1 & 0x0380) | ((line1_r >> 2) & 0x0020) |
((line2_r >> 4) & 0x001c) | ((line3_r >> 6) & 0x0003);
- for (int32_t w = 0; w < GRW; w += 8) {
- nBits = GRW - w > 8 ? 8 : GRW - w;
+ for (int32_t w = 0; w < iGRW; w += 8) {
+ nBits = iGRW - w > 8 ? 8 : iGRW - w;
if (h > 0)
line1 = (line1 << 8) |
- (w + 8 < GRW ? pLine[-nStride + (w >> 3) + 1] << 1 : 0);
+ (w + 8 < iGRW ? pLine[-nStride + (w >> 3) + 1] << 1 : 0);
if (line1_r_ok)
line1_r =
(line1_r << 8) |

Powered by Google App Engine
This is Rietveld 408576698