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

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

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 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
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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_HuffmanTable.h" 7 #include "JBig2_HuffmanTable.h"
8 #include "JBig2_BitStream.h" 8 #include "JBig2_BitStream.h"
9 #include <string.h> 9 #include <string.h>
10 10
11 CJBig2_HuffmanTable::CJBig2_HuffmanTable(const JBig2TableLine *pTable, int nLine s, 11 CJBig2_HuffmanTable::CJBig2_HuffmanTable(const JBig2TableLine *pTable, int nLine s,
12 FX_BOOL bHTOOB) 12 bool bHTOOB)
13 { 13 {
14 init(); 14 init();
15 m_bOK = parseFromStandardTable(pTable, nLines, bHTOOB); 15 m_bOK = parseFromStandardTable(pTable, nLines, bHTOOB);
16 } 16 }
17 17
18 CJBig2_HuffmanTable::CJBig2_HuffmanTable(CJBig2_BitStream *pStream) 18 CJBig2_HuffmanTable::CJBig2_HuffmanTable(CJBig2_BitStream *pStream)
19 { 19 {
20 init(); 20 init();
21 m_bOK = parseFromCodedBuffer(pStream); 21 m_bOK = parseFromCodedBuffer(pStream);
22 } 22 }
23 23
24 CJBig2_HuffmanTable::~CJBig2_HuffmanTable() 24 CJBig2_HuffmanTable::~CJBig2_HuffmanTable()
25 { 25 {
26 if(CODES) { 26 if(CODES) {
27 m_pModule->JBig2_Free(CODES); 27 m_pModule->JBig2_Free(CODES);
28 } 28 }
29 if(PREFLEN) { 29 if(PREFLEN) {
30 m_pModule->JBig2_Free(PREFLEN); 30 m_pModule->JBig2_Free(PREFLEN);
31 } 31 }
32 if(RANGELEN) { 32 if(RANGELEN) {
33 m_pModule->JBig2_Free(RANGELEN); 33 m_pModule->JBig2_Free(RANGELEN);
34 } 34 }
35 if(RANGELOW) { 35 if(RANGELOW) {
36 m_pModule->JBig2_Free(RANGELOW); 36 m_pModule->JBig2_Free(RANGELOW);
37 } 37 }
38 } 38 }
39 void CJBig2_HuffmanTable::init() 39 void CJBig2_HuffmanTable::init()
40 { 40 {
41 HTOOB = FALSE; 41 HTOOB = false;
42 NTEMP = 0; 42 NTEMP = 0;
43 CODES = NULL; 43 CODES = NULL;
44 PREFLEN = NULL; 44 PREFLEN = NULL;
45 RANGELEN = NULL; 45 RANGELEN = NULL;
46 RANGELOW = NULL; 46 RANGELOW = NULL;
47 } 47 }
48 int CJBig2_HuffmanTable::parseFromStandardTable(const JBig2TableLine *pTable, in t nLines, FX_BOOL bHTOOB) 48 int CJBig2_HuffmanTable::parseFromStandardTable(const JBig2TableLine *pTable, in t nLines, bool bHTOOB)
49 { 49 {
50 int CURLEN, LENMAX, CURCODE, CURTEMP, i; 50 int CURLEN, LENMAX, CURCODE, CURTEMP, i;
51 int *LENCOUNT; 51 int *LENCOUNT;
52 int *FIRSTCODE; 52 int *FIRSTCODE;
53 HTOOB = bHTOOB; 53 HTOOB = bHTOOB;
54 NTEMP = nLines; 54 NTEMP = nLines;
55 CODES = (int*)m_pModule->JBig2_Malloc2(sizeof(int), NTEMP); 55 CODES = (int*)m_pModule->JBig2_Malloc2(sizeof(int), NTEMP);
56 PREFLEN = (int*)m_pModule->JBig2_Malloc2(sizeof(int), NTEMP); 56 PREFLEN = (int*)m_pModule->JBig2_Malloc2(sizeof(int), NTEMP);
57 RANGELEN = (int*)m_pModule->JBig2_Malloc2(sizeof(int), NTEMP); 57 RANGELEN = (int*)m_pModule->JBig2_Malloc2(sizeof(int), NTEMP);
58 RANGELOW = (int*)m_pModule->JBig2_Malloc2(sizeof(int), NTEMP); 58 RANGELOW = (int*)m_pModule->JBig2_Malloc2(sizeof(int), NTEMP);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if(PREFLEN[CURTEMP] == CURLEN) { 181 if(PREFLEN[CURTEMP] == CURLEN) {
182 CODES[CURTEMP] = CURCODE; 182 CODES[CURTEMP] = CURCODE;
183 CURCODE = CURCODE + 1; 183 CURCODE = CURCODE + 1;
184 } 184 }
185 CURTEMP = CURTEMP + 1; 185 CURTEMP = CURTEMP + 1;
186 } 186 }
187 CURLEN = CURLEN + 1; 187 CURLEN = CURLEN + 1;
188 } 188 }
189 m_pModule->JBig2_Free(LENCOUNT); 189 m_pModule->JBig2_Free(LENCOUNT);
190 m_pModule->JBig2_Free(FIRSTCODE); 190 m_pModule->JBig2_Free(FIRSTCODE);
191 return TRUE; 191 return true;
192 failed: 192 failed:
193 return FALSE; 193 return false;
194 } 194 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_HuffmanTable.h ('k') | core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698