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

Unified Diff: core/src/fxcodec/jbig2/JBig2_TrdProc.cpp

Issue 1359013003: Cleanup JBig2_ArithIntDecoder. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: fix cast Created 5 years, 3 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 | « core/src/fxcodec/jbig2/JBig2_SddProc.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcodec/jbig2/JBig2_TrdProc.cpp
diff --git a/core/src/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/src/fxcodec/jbig2/JBig2_TrdProc.cpp
index afa3dba920fc4d3a07db759dc7ba4f7bc65f0105..a18d3d9ba6157121973ec1a4bac6977240de4f43 100644
--- a/core/src/fxcodec/jbig2/JBig2_TrdProc.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_TrdProc.cpp
@@ -221,7 +221,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
int32_t DT, DFS, CURS;
int32_t CURT;
int32_t SI, TI;
- FX_DWORD IDI;
CJBig2_Image* IBI;
FX_DWORD WI, HI;
int32_t IDS;
@@ -262,7 +261,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
}
nonstd::unique_ptr<CJBig2_Image> SBREG(new CJBig2_Image(SBW, SBH));
SBREG->fill(SBDEFPIXEL);
- if (IADT->decode(pArithDecoder, &STRIPT) == -1) {
+ if (!IADT->decode(pArithDecoder, &STRIPT)) {
goto failed;
}
STRIPT *= SBSTRIPS;
@@ -270,7 +269,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
FIRSTS = 0;
NINSTANCES = 0;
while (NINSTANCES < SBNUMINSTANCES) {
- if (IADT->decode(pArithDecoder, &DT) == -1) {
+ if (!IADT->decode(pArithDecoder, &DT)) {
goto failed;
}
DT *= SBSTRIPS;
@@ -278,7 +277,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
bFirst = TRUE;
for (;;) {
if (bFirst) {
- if (IAFS->decode(pArithDecoder, &DFS) == -1) {
+ if (!IAFS->decode(pArithDecoder, &DFS)) {
goto failed;
}
FIRSTS = FIRSTS + DFS;
@@ -300,23 +299,21 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
if (SBSTRIPS == 1) {
CURT = 0;
} else {
- if (IAIT->decode(pArithDecoder, &nVal) == -1) {
+ if (!IAIT->decode(pArithDecoder, &nVal)) {
Tom Sepez 2015/09/30 20:09:50 Same thing here. Can we get rid of the nVal tempo
Lei Zhang 2015/10/01 06:01:59 Done.
goto failed;
}
CURT = nVal;
}
TI = STRIPT + CURT;
- if (IAID->decode(pArithDecoder, &nVal) == -1) {
- goto failed;
- }
- IDI = nVal;
+ FX_DWORD IDI;
+ IAID->decode(pArithDecoder, &IDI);
if (IDI >= SBNUMSYMS) {
goto failed;
}
if (SBREFINE == 0) {
RI = 0;
} else {
- if (IARI->decode(pArithDecoder, &RI) == -1) {
+ if (!IARI->decode(pArithDecoder, &RI)) {
goto failed;
}
}
@@ -326,10 +323,10 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
if (RI == 0) {
IBI = SBSYMS[IDI];
} else {
- if ((IARDW->decode(pArithDecoder, &RDWI) == -1) ||
- (IARDH->decode(pArithDecoder, &RDHI) == -1) ||
- (IARDX->decode(pArithDecoder, &RDXI) == -1) ||
- (IARDY->decode(pArithDecoder, &RDYI) == -1)) {
+ if (!IARDW->decode(pArithDecoder, &RDWI) ||
+ !IARDH->decode(pArithDecoder, &RDHI) ||
+ !IARDX->decode(pArithDecoder, &RDXI) ||
+ !IARDY->decode(pArithDecoder, &RDYI)) {
goto failed;
}
IBOI = SBSYMS[IDI];
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_SddProc.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698