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

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

Issue 1253603002: Fix FX_BOOL type mismatches. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Public API 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 <map> 7 #include <map>
8 #include <list> 8 #include <list>
9 #include "JBig2_Context.h" 9 #include "JBig2_Context.h"
10 10
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 delete Table_B5; 866 delete Table_B5;
867 if(gbContext) { 867 if(gbContext) {
868 m_pModule->JBig2_Free(gbContext); 868 m_pModule->JBig2_Free(gbContext);
869 } 869 }
870 if(grContext) { 870 if(grContext) {
871 m_pModule->JBig2_Free(grContext); 871 m_pModule->JBig2_Free(grContext);
872 } 872 }
873 return nRet; 873 return nRet;
874 } 874 }
875 875
876 FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment) 876 int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
877 { 877 {
878 FX_DWORD dwTemp; 878 FX_DWORD dwTemp;
879 FX_WORD wFlags; 879 FX_WORD wFlags;
880 int32_t i, nIndex, nRet; 880 int32_t i, nIndex, nRet;
881 JBig2RegionInfo ri; 881 JBig2RegionInfo ri;
882 CJBig2_Segment *pSeg; 882 CJBig2_Segment *pSeg;
883 CJBig2_Image **SBSYMS = NULL; 883 CJBig2_Image **SBSYMS = NULL;
884 JBig2HuffmanCode *SBSYMCODES = NULL; 884 JBig2HuffmanCode *SBSYMCODES = NULL;
885 uint8_t cSBHUFFFS, cSBHUFFDS, cSBHUFFDT, cSBHUFFRDW, cSBHUFFRDH, cSBHUFFRDX, cSBHUFFRDY, cSBHUFFRSIZE; 885 uint8_t cSBHUFFFS, cSBHUFFDS, cSBHUFFDT, cSBHUFFRDW, cSBHUFFRDH, cSBHUFFRDX, cSBHUFFRDY, cSBHUFFRSIZE;
886 CJBig2_HuffmanTable *Table_B1 = NULL, 886 CJBig2_HuffmanTable *Table_B1 = NULL,
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 delete Table_B9; 1232 delete Table_B9;
1233 delete Table_B10; 1233 delete Table_B10;
1234 delete Table_B11; 1234 delete Table_B11;
1235 delete Table_B12; 1235 delete Table_B12;
1236 delete Table_B13; 1236 delete Table_B13;
1237 delete Table_B14; 1237 delete Table_B14;
1238 delete Table_B15; 1238 delete Table_B15;
1239 return nRet; 1239 return nRet;
1240 } 1240 }
1241 1241
1242 FX_BOOL CJBig2_Context::parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pP ause) 1242 int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pP ause)
1243 { 1243 {
1244 FX_DWORD dwTemp; 1244 FX_DWORD dwTemp;
1245 uint8_t cFlags; 1245 uint8_t cFlags;
1246 JBig2ArithCtx *gbContext; 1246 JBig2ArithCtx *gbContext;
1247 CJBig2_ArithDecoder *pArithDecoder; 1247 CJBig2_ArithDecoder *pArithDecoder;
1248 CJBig2_PDDProc *pPDD; 1248 CJBig2_PDDProc *pPDD;
1249 int32_t nRet; 1249 int32_t nRet;
1250 JBIG2_ALLOC(pPDD, CJBig2_PDDProc()); 1250 JBIG2_ALLOC(pPDD, CJBig2_PDDProc());
1251 if((m_pStream->read1Byte(&cFlags) != 0) 1251 if((m_pStream->read1Byte(&cFlags) != 0)
1252 || (m_pStream->read1Byte(&pPDD->HDPW) != 0) 1252 || (m_pStream->read1Byte(&pPDD->HDPW) != 0)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 goto failed; 1286 goto failed;
1287 } 1287 }
1288 m_pStream->alignByte(); 1288 m_pStream->alignByte();
1289 } 1289 }
1290 delete pPDD; 1290 delete pPDD;
1291 return JBIG2_SUCCESS; 1291 return JBIG2_SUCCESS;
1292 failed: 1292 failed:
1293 delete pPDD; 1293 delete pPDD;
1294 return nRet; 1294 return nRet;
1295 } 1295 }
1296 FX_BOOL CJBig2_Context::parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause) 1296 int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause)
1297 { 1297 {
1298 FX_DWORD dwTemp; 1298 FX_DWORD dwTemp;
1299 uint8_t cFlags; 1299 uint8_t cFlags;
1300 JBig2RegionInfo ri; 1300 JBig2RegionInfo ri;
1301 CJBig2_Segment *pSeg; 1301 CJBig2_Segment *pSeg;
1302 CJBig2_PatternDict *pPatternDict; 1302 CJBig2_PatternDict *pPatternDict;
1303 JBig2ArithCtx *gbContext; 1303 JBig2ArithCtx *gbContext;
1304 CJBig2_ArithDecoder *pArithDecoder; 1304 CJBig2_ArithDecoder *pArithDecoder;
1305 CJBig2_HTRDProc *pHRD; 1305 CJBig2_HTRDProc *pHRD;
1306 int32_t nRet; 1306 int32_t nRet;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 delete pSegment->m_Result.im; 1380 delete pSegment->m_Result.im;
1381 pSegment->m_Result.im = NULL; 1381 pSegment->m_Result.im = NULL;
1382 } 1382 }
1383 delete pHRD; 1383 delete pHRD;
1384 return JBIG2_SUCCESS; 1384 return JBIG2_SUCCESS;
1385 failed: 1385 failed:
1386 delete pHRD; 1386 delete pHRD;
1387 return nRet; 1387 return nRet;
1388 } 1388 }
1389 1389
1390 FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause) 1390 int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause)
1391 { 1391 {
1392 FX_DWORD dwTemp; 1392 FX_DWORD dwTemp;
1393 uint8_t cFlags; 1393 uint8_t cFlags;
1394 int32_t i, nRet; 1394 int32_t i, nRet;
1395 if(m_pGRD == NULL) { 1395 if(m_pGRD == NULL) {
1396 JBIG2_ALLOC(m_pGRD, CJBig2_GRDProc()); 1396 JBIG2_ALLOC(m_pGRD, CJBig2_GRDProc());
1397 if((parseRegionInfo(&m_ri) != JBIG2_SUCCESS) 1397 if((parseRegionInfo(&m_ri) != JBIG2_SUCCESS)
1398 || (m_pStream->read1Byte(&cFlags) != 0)) { 1398 || (m_pStream->read1Byte(&cFlags) != 0)) {
1399 m_pModule->JBig2_Error("generic region segment : data header too sho rt."); 1399 m_pModule->JBig2_Error("generic region segment : data header too sho rt.");
1400 nRet = JBIG2_ERROR_TOO_SHORT; 1400 nRet = JBIG2_ERROR_TOO_SHORT;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 } 1497 }
1498 delete m_pGRD; 1498 delete m_pGRD;
1499 m_pGRD = NULL; 1499 m_pGRD = NULL;
1500 return JBIG2_SUCCESS; 1500 return JBIG2_SUCCESS;
1501 failed: 1501 failed:
1502 delete m_pGRD; 1502 delete m_pGRD;
1503 m_pGRD = NULL; 1503 m_pGRD = NULL;
1504 return nRet; 1504 return nRet;
1505 } 1505 }
1506 1506
1507 FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment) 1507 int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment)
1508 { 1508 {
1509 FX_DWORD dwTemp; 1509 FX_DWORD dwTemp;
1510 JBig2RegionInfo ri; 1510 JBig2RegionInfo ri;
1511 CJBig2_Segment *pSeg; 1511 CJBig2_Segment *pSeg;
1512 int32_t i, nRet; 1512 int32_t i, nRet;
1513 uint8_t cFlags; 1513 uint8_t cFlags;
1514 JBig2ArithCtx *grContext; 1514 JBig2ArithCtx *grContext;
1515 CJBig2_GRRDProc *pGRRD; 1515 CJBig2_GRRDProc *pGRRD;
1516 CJBig2_ArithDecoder *pArithDecoder; 1516 CJBig2_ArithDecoder *pArithDecoder;
1517 JBIG2_ALLOC(pGRRD, CJBig2_GRRDProc()); 1517 JBIG2_ALLOC(pGRRD, CJBig2_GRRDProc());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 m_pPage->composeFrom(ri.x, ri.y, pSegment->m_Result.im, (JBig2ComposeOp) (ri.flags & 0x03)); 1584 m_pPage->composeFrom(ri.x, ri.y, pSegment->m_Result.im, (JBig2ComposeOp) (ri.flags & 0x03));
1585 delete pSegment->m_Result.im; 1585 delete pSegment->m_Result.im;
1586 pSegment->m_Result.im = NULL; 1586 pSegment->m_Result.im = NULL;
1587 } 1587 }
1588 delete pGRRD; 1588 delete pGRRD;
1589 return JBIG2_SUCCESS; 1589 return JBIG2_SUCCESS;
1590 failed: 1590 failed:
1591 delete pGRRD; 1591 delete pGRRD;
1592 return nRet; 1592 return nRet;
1593 } 1593 }
1594 FX_BOOL CJBig2_Context::parseTable(CJBig2_Segment *pSegment) 1594 int32_t CJBig2_Context::parseTable(CJBig2_Segment *pSegment)
1595 { 1595 {
1596 pSegment->m_nResultType = JBIG2_HUFFMAN_TABLE_POINTER; 1596 pSegment->m_nResultType = JBIG2_HUFFMAN_TABLE_POINTER;
1597 JBIG2_ALLOC(pSegment->m_Result.ht, CJBig2_HuffmanTable(m_pStream)); 1597 JBIG2_ALLOC(pSegment->m_Result.ht, CJBig2_HuffmanTable(m_pStream));
1598 if(!pSegment->m_Result.ht->isOK()) { 1598 if(!pSegment->m_Result.ht->isOK()) {
1599 delete pSegment->m_Result.ht; 1599 delete pSegment->m_Result.ht;
1600 pSegment->m_Result.ht = NULL; 1600 pSegment->m_Result.ht = NULL;
1601 return JBIG2_ERROR_FATAL; 1601 return JBIG2_ERROR_FATAL;
1602 } 1602 }
1603 m_pStream->alignByte(); 1603 m_pStream->alignByte();
1604 return JBIG2_SUCCESS; 1604 return JBIG2_SUCCESS;
1605 } 1605 }
1606 int32_t CJBig2_Context::parseRegionInfo(JBig2RegionInfo *pRI) 1606 int32_t CJBig2_Context::parseRegionInfo(JBig2RegionInfo *pRI)
1607 { 1607 {
1608 if((m_pStream->readInteger((FX_DWORD*)&pRI->width) != 0) 1608 if((m_pStream->readInteger((FX_DWORD*)&pRI->width) != 0)
1609 || (m_pStream->readInteger((FX_DWORD*)&pRI->height) != 0) 1609 || (m_pStream->readInteger((FX_DWORD*)&pRI->height) != 0)
1610 || (m_pStream->readInteger((FX_DWORD*)&pRI->x) != 0) 1610 || (m_pStream->readInteger((FX_DWORD*)&pRI->x) != 0)
1611 || (m_pStream->readInteger((FX_DWORD*)&pRI->y) != 0) 1611 || (m_pStream->readInteger((FX_DWORD*)&pRI->y) != 0)
1612 || (m_pStream->read1Byte(&pRI->flags) != 0)) { 1612 || (m_pStream->read1Byte(&pRI->flags) != 0)) {
1613 return JBIG2_ERROR_TOO_SHORT; 1613 return JBIG2_ERROR_TOO_SHORT;
1614 } 1614 }
1615 return JBIG2_SUCCESS; 1615 return JBIG2_SUCCESS;
1616 } 1616 }
1617 JBig2HuffmanCode *CJBig2_Context::decodeSymbolIDHuffmanTable(CJBig2_BitStream *p Stream, 1617 JBig2HuffmanCode *CJBig2_Context::decodeSymbolIDHuffmanTable(CJBig2_BitStream *p Stream,
1618 FX_DWORD SBNUMSYMS) 1618 FX_DWORD SBNUMSYMS)
1619 { 1619 {
1620 JBig2HuffmanCode *SBSYMCODES; 1620 JBig2HuffmanCode *SBSYMCODES;
1621 int32_t runcodes[35], runcodes_len[35], runcode; 1621 int32_t runcodes[35];
1622 int32_t i, j, nTemp, nVal, nBits; 1622 int32_t runcodes_len[35];
1623 int32_t runcode;
1624 int32_t i;
1625 int32_t j;
1626 int32_t nVal;
1627 int32_t nBits;
1623 int32_t run; 1628 int32_t run;
1629 FX_DWORD nTemp;
1624 SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2(sizeof(JBig2Huffman Code), SBNUMSYMS); 1630 SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2(sizeof(JBig2Huffman Code), SBNUMSYMS);
1625 for (i = 0; i < 35; i ++) { 1631 for (i = 0; i < 35; i ++) {
1626 if(pStream->readNBits(4, &runcodes_len[i]) != 0) { 1632 if(pStream->readNBits(4, &runcodes_len[i]) != 0) {
1627 goto failed; 1633 goto failed;
1628 } 1634 }
1629 } 1635 }
1630 huffman_assign_code(runcodes, runcodes_len, 35); 1636 huffman_assign_code(runcodes, runcodes_len, 35);
1631 i = 0; 1637 i = 0;
1632 while(i < (int)SBNUMSYMS) { 1638 while(i < (int)SBNUMSYMS) {
1633 nVal = 0; 1639 nVal = 0;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 SBSYMCODES[CURTEMP].code = CURCODE; 1760 SBSYMCODES[CURTEMP].code = CURCODE;
1755 CURCODE = CURCODE + 1; 1761 CURCODE = CURCODE + 1;
1756 } 1762 }
1757 CURTEMP = CURTEMP + 1; 1763 CURTEMP = CURTEMP + 1;
1758 } 1764 }
1759 CURLEN = CURLEN + 1; 1765 CURLEN = CURLEN + 1;
1760 } 1766 }
1761 m_pModule->JBig2_Free(LENCOUNT); 1767 m_pModule->JBig2_Free(LENCOUNT);
1762 m_pModule->JBig2_Free(FIRSTCODE); 1768 m_pModule->JBig2_Free(FIRSTCODE);
1763 } 1769 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_jpeg.cpp ('k') | core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698