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 "core/fxcodec/jbig2/JBig2_Context.h" | 7 #include "core/fxcodec/jbig2/JBig2_Context.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 int32_t runcodes[kRunCodesSize]; | 1278 int32_t runcodes[kRunCodesSize]; |
1279 int32_t runcodes_len[kRunCodesSize]; | 1279 int32_t runcodes_len[kRunCodesSize]; |
1280 for (size_t i = 0; i < kRunCodesSize; ++i) { | 1280 for (size_t i = 0; i < kRunCodesSize; ++i) { |
1281 if (pStream->readNBits(4, &runcodes_len[i]) != 0) | 1281 if (pStream->readNBits(4, &runcodes_len[i]) != 0) |
1282 return nullptr; | 1282 return nullptr; |
1283 } | 1283 } |
1284 huffman_assign_code(runcodes, runcodes_len, kRunCodesSize); | 1284 huffman_assign_code(runcodes, runcodes_len, kRunCodesSize); |
1285 | 1285 |
1286 std::unique_ptr<JBig2HuffmanCode, FxFreeDeleter> SBSYMCODES( | 1286 std::unique_ptr<JBig2HuffmanCode, FxFreeDeleter> SBSYMCODES( |
1287 FX_Alloc(JBig2HuffmanCode, SBNUMSYMS)); | 1287 FX_Alloc(JBig2HuffmanCode, SBNUMSYMS)); |
1288 int32_t run; | 1288 int32_t run = 0; |
1289 int32_t i = 0; | 1289 int32_t i = 0; |
1290 while (i < (int)SBNUMSYMS) { | 1290 while (i < (int)SBNUMSYMS) { |
1291 size_t j; | 1291 size_t j; |
1292 int32_t nVal = 0; | 1292 int32_t nVal = 0; |
1293 int32_t nBits = 0; | 1293 int32_t nBits = 0; |
1294 uint32_t nTemp; | 1294 uint32_t nTemp; |
1295 while (true) { | 1295 while (true) { |
1296 if (pStream->read1Bit(&nTemp) != 0) | 1296 if (pStream->read1Bit(&nTemp) != 0) |
1297 return nullptr; | 1297 return nullptr; |
1298 | 1298 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 SBSYMCODES[CURTEMP].code = CURCODE; | 1406 SBSYMCODES[CURTEMP].code = CURCODE; |
1407 CURCODE = CURCODE + 1; | 1407 CURCODE = CURCODE + 1; |
1408 } | 1408 } |
1409 CURTEMP = CURTEMP + 1; | 1409 CURTEMP = CURTEMP + 1; |
1410 } | 1410 } |
1411 CURLEN = CURLEN + 1; | 1411 CURLEN = CURLEN + 1; |
1412 } | 1412 } |
1413 FX_Free(LENCOUNT); | 1413 FX_Free(LENCOUNT); |
1414 FX_Free(FIRSTCODE); | 1414 FX_Free(FIRSTCODE); |
1415 } | 1415 } |
OLD | NEW |