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

Side by Side Diff: core/src/fxcodec/jbig2/JBig2_SddProc.cpp

Issue 1395613003: Put CJBig2_SymbolDict's images in a CJBig2_List container. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_List.h ('k') | core/src/fxcodec/jbig2/JBig2_SymbolDict.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "JBig2_SddProc.h" 7 #include "JBig2_SddProc.h"
8 8
9 #include "../../../../third_party/base/nonstd_unique_ptr.h" 9 #include "../../../../third_party/base/nonstd_unique_ptr.h"
10 #include "../../../include/fxcrt/fx_basic.h" 10 #include "../../../include/fxcrt/fx_basic.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 251 }
252 if (EXRUNLENGTH != 0) { 252 if (EXRUNLENGTH != 0) {
253 for (I = EXINDEX; I < EXINDEX + EXRUNLENGTH; I++) { 253 for (I = EXINDEX; I < EXINDEX + EXRUNLENGTH; I++) {
254 EXFLAGS[I] = CUREXFLAG; 254 EXFLAGS[I] = CUREXFLAG;
255 } 255 }
256 } 256 }
257 EXINDEX = EXINDEX + EXRUNLENGTH; 257 EXINDEX = EXINDEX + EXRUNLENGTH;
258 CUREXFLAG = !CUREXFLAG; 258 CUREXFLAG = !CUREXFLAG;
259 } 259 }
260 pDict.reset(new CJBig2_SymbolDict); 260 pDict.reset(new CJBig2_SymbolDict);
261 pDict->SDNUMEXSYMS = SDNUMEXSYMS;
262 pDict->SDEXSYMS = FX_Alloc(CJBig2_Image*, SDNUMEXSYMS);
263 I = J = 0; 261 I = J = 0;
264 for (I = 0; I < SDNUMINSYMS + SDNUMNEWSYMS; I++) { 262 for (I = 0; I < SDNUMINSYMS + SDNUMNEWSYMS; I++) {
265 if (EXFLAGS[I] && J < SDNUMEXSYMS) { 263 if (EXFLAGS[I] && J < SDNUMEXSYMS) {
266 if (I < SDNUMINSYMS) { 264 if (I < SDNUMINSYMS) {
267 pDict->SDEXSYMS[J] = new CJBig2_Image(*SDINSYMS[I]); 265 pDict->AddImage(new CJBig2_Image(*SDINSYMS[I]));
268 } else { 266 } else {
269 pDict->SDEXSYMS[J] = SDNEWSYMS[I - SDNUMINSYMS]; 267 pDict->AddImage(SDNEWSYMS[I - SDNUMINSYMS]);
270 } 268 }
271 J = J + 1; 269 ++J;
272 } else if (!EXFLAGS[I] && I >= SDNUMINSYMS) { 270 } else if (!EXFLAGS[I] && I >= SDNUMINSYMS) {
273 delete SDNEWSYMS[I - SDNUMINSYMS]; 271 delete SDNEWSYMS[I - SDNUMINSYMS];
274 } 272 }
275 } 273 }
276 if (J < SDNUMEXSYMS) {
277 pDict->SDNUMEXSYMS = J;
278 }
279 FX_Free(EXFLAGS); 274 FX_Free(EXFLAGS);
280 FX_Free(SDNEWSYMS); 275 FX_Free(SDNEWSYMS);
281 return pDict.release(); 276 return pDict.release();
282 failed: 277 failed:
283 for (I = 0; I < NSYMSDECODED; I++) { 278 for (I = 0; I < NSYMSDECODED; I++) {
284 if (SDNEWSYMS[I]) { 279 if (SDNEWSYMS[I]) {
285 delete SDNEWSYMS[I]; 280 delete SDNEWSYMS[I];
286 SDNEWSYMS[I] = nullptr; 281 SDNEWSYMS[I] = nullptr;
287 } 282 }
288 } 283 }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 goto failed; 588 goto failed;
594 } 589 }
595 if (EXRUNLENGTH != 0) { 590 if (EXRUNLENGTH != 0) {
596 for (I = EXINDEX; I < EXINDEX + EXRUNLENGTH; I++) { 591 for (I = EXINDEX; I < EXINDEX + EXRUNLENGTH; I++) {
597 EXFLAGS[I] = CUREXFLAG; 592 EXFLAGS[I] = CUREXFLAG;
598 } 593 }
599 } 594 }
600 EXINDEX = EXINDEX + EXRUNLENGTH; 595 EXINDEX = EXINDEX + EXRUNLENGTH;
601 CUREXFLAG = !CUREXFLAG; 596 CUREXFLAG = !CUREXFLAG;
602 } 597 }
603 pDict->SDNUMEXSYMS = SDNUMEXSYMS;
604 pDict->SDEXSYMS = FX_Alloc(CJBig2_Image*, SDNUMEXSYMS);
605 I = J = 0; 598 I = J = 0;
606 for (I = 0; I < SDNUMINSYMS + SDNUMNEWSYMS; I++) { 599 for (I = 0; I < SDNUMINSYMS + SDNUMNEWSYMS; I++) {
607 if (EXFLAGS[I] && J < SDNUMEXSYMS) { 600 if (EXFLAGS[I] && J < SDNUMEXSYMS) {
608 if (I < SDNUMINSYMS) { 601 if (I < SDNUMINSYMS) {
609 pDict->SDEXSYMS[J] = new CJBig2_Image(*SDINSYMS[I]); 602 pDict->AddImage(new CJBig2_Image(*SDINSYMS[I]));
610 } else { 603 } else {
611 pDict->SDEXSYMS[J] = SDNEWSYMS[I - SDNUMINSYMS]; 604 pDict->AddImage(SDNEWSYMS[I - SDNUMINSYMS]);
612 } 605 }
613 J = J + 1; 606 ++J;
614 } else if (!EXFLAGS[I] && I >= SDNUMINSYMS) { 607 } else if (!EXFLAGS[I] && I >= SDNUMINSYMS) {
615 delete SDNEWSYMS[I - SDNUMINSYMS]; 608 delete SDNEWSYMS[I - SDNUMINSYMS];
616 } 609 }
617 } 610 }
618 if (J < SDNUMEXSYMS) {
619 pDict->SDNUMEXSYMS = J;
620 }
621 FX_Free(EXFLAGS); 611 FX_Free(EXFLAGS);
622 FX_Free(SDNEWSYMS); 612 FX_Free(SDNEWSYMS);
623 if (SDREFAGG == 0) { 613 if (SDREFAGG == 0) {
624 FX_Free(SDNEWSYMWIDTHS); 614 FX_Free(SDNEWSYMWIDTHS);
625 } 615 }
626 return pDict.release(); 616 return pDict.release();
627 failed: 617 failed:
628 for (I = 0; I < NSYMSDECODED; I++) { 618 for (I = 0; I < NSYMSDECODED; I++) {
629 delete SDNEWSYMS[I]; 619 delete SDNEWSYMS[I];
630 } 620 }
631 FX_Free(SDNEWSYMS); 621 FX_Free(SDNEWSYMS);
632 if (SDREFAGG == 0) { 622 if (SDREFAGG == 0) {
633 FX_Free(SDNEWSYMWIDTHS); 623 FX_Free(SDNEWSYMWIDTHS);
634 } 624 }
635 return nullptr; 625 return nullptr;
636 } 626 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_List.h ('k') | core/src/fxcodec/jbig2/JBig2_SymbolDict.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698