OLD | NEW |
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_Context.h" | 7 #include "JBig2_Context.h" |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 | 10 |
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 m_pStream->readInteger((FX_DWORD*)&pRI->y) != 0 || | 1286 m_pStream->readInteger((FX_DWORD*)&pRI->y) != 0 || |
1287 m_pStream->read1Byte(&pRI->flags) != 0) { | 1287 m_pStream->read1Byte(&pRI->flags) != 0) { |
1288 return JBIG2_ERROR_TOO_SHORT; | 1288 return JBIG2_ERROR_TOO_SHORT; |
1289 } | 1289 } |
1290 return JBIG2_SUCCESS; | 1290 return JBIG2_SUCCESS; |
1291 } | 1291 } |
1292 | 1292 |
1293 JBig2HuffmanCode* CJBig2_Context::decodeSymbolIDHuffmanTable( | 1293 JBig2HuffmanCode* CJBig2_Context::decodeSymbolIDHuffmanTable( |
1294 CJBig2_BitStream* pStream, | 1294 CJBig2_BitStream* pStream, |
1295 FX_DWORD SBNUMSYMS) { | 1295 FX_DWORD SBNUMSYMS) { |
1296 size_t kRunCodesSize = 35; | 1296 const size_t kRunCodesSize = 35; |
1297 int32_t runcodes[kRunCodesSize]; | 1297 int32_t runcodes[kRunCodesSize]; |
1298 int32_t runcodes_len[kRunCodesSize]; | 1298 int32_t runcodes_len[kRunCodesSize]; |
1299 for (int32_t i = 0; i < kRunCodesSize; ++i) { | 1299 for (int32_t i = 0; i < kRunCodesSize; ++i) { |
1300 if (pStream->readNBits(4, &runcodes_len[i]) != 0) | 1300 if (pStream->readNBits(4, &runcodes_len[i]) != 0) |
1301 return nullptr; | 1301 return nullptr; |
1302 } | 1302 } |
1303 huffman_assign_code(runcodes, runcodes_len, kRunCodesSize); | 1303 huffman_assign_code(runcodes, runcodes_len, kRunCodesSize); |
1304 | 1304 |
1305 nonstd::unique_ptr<JBig2HuffmanCode, FxFreeDeleter> SBSYMCODES( | 1305 nonstd::unique_ptr<JBig2HuffmanCode, FxFreeDeleter> SBSYMCODES( |
1306 FX_Alloc(JBig2HuffmanCode, SBNUMSYMS)); | 1306 FX_Alloc(JBig2HuffmanCode, SBNUMSYMS)); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 SBSYMCODES[CURTEMP].code = CURCODE; | 1427 SBSYMCODES[CURTEMP].code = CURCODE; |
1428 CURCODE = CURCODE + 1; | 1428 CURCODE = CURCODE + 1; |
1429 } | 1429 } |
1430 CURTEMP = CURTEMP + 1; | 1430 CURTEMP = CURTEMP + 1; |
1431 } | 1431 } |
1432 CURLEN = CURLEN + 1; | 1432 CURLEN = CURLEN + 1; |
1433 } | 1433 } |
1434 FX_Free(LENCOUNT); | 1434 FX_Free(LENCOUNT); |
1435 FX_Free(FIRSTCODE); | 1435 FX_Free(FIRSTCODE); |
1436 } | 1436 } |
OLD | NEW |