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/src/fxcodec/jbig2/JBig2_Context.h" | 7 #include "core/src/fxcodec/jbig2/JBig2_Context.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
| 11 #include <utility> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "core/src/fxcodec/jbig2/JBig2_ArithDecoder.h" | 14 #include "core/src/fxcodec/jbig2/JBig2_ArithDecoder.h" |
14 #include "core/src/fxcodec/jbig2/JBig2_BitStream.h" | 15 #include "core/src/fxcodec/jbig2/JBig2_BitStream.h" |
15 #include "core/src/fxcodec/jbig2/JBig2_GrdProc.h" | 16 #include "core/src/fxcodec/jbig2/JBig2_GrdProc.h" |
16 #include "core/src/fxcodec/jbig2/JBig2_GrrdProc.h" | 17 #include "core/src/fxcodec/jbig2/JBig2_GrrdProc.h" |
17 #include "core/src/fxcodec/jbig2/JBig2_HtrdProc.h" | 18 #include "core/src/fxcodec/jbig2/JBig2_HtrdProc.h" |
18 #include "core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h" | 19 #include "core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h" |
19 #include "core/src/fxcodec/jbig2/JBig2_PddProc.h" | 20 #include "core/src/fxcodec/jbig2/JBig2_PddProc.h" |
20 #include "core/src/fxcodec/jbig2/JBig2_SddProc.h" | 21 #include "core/src/fxcodec/jbig2/JBig2_SddProc.h" |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 } | 1113 } |
1113 } else { | 1114 } else { |
1114 for (int32_t i = 0; i < 2; ++i) { | 1115 for (int32_t i = 0; i < 2; ++i) { |
1115 if (m_pStream->read1Byte((uint8_t*)&pGRD->GBAT[i]) != 0) { | 1116 if (m_pStream->read1Byte((uint8_t*)&pGRD->GBAT[i]) != 0) { |
1116 return JBIG2_ERROR_TOO_SHORT; | 1117 return JBIG2_ERROR_TOO_SHORT; |
1117 } | 1118 } |
1118 } | 1119 } |
1119 } | 1120 } |
1120 } | 1121 } |
1121 pGRD->USESKIP = 0; | 1122 pGRD->USESKIP = 0; |
1122 m_pGRD = nonstd::move(pGRD); | 1123 m_pGRD = std::move(pGRD); |
1123 } | 1124 } |
1124 pSegment->m_nResultType = JBIG2_IMAGE_POINTER; | 1125 pSegment->m_nResultType = JBIG2_IMAGE_POINTER; |
1125 if (m_pGRD->MMR == 0) { | 1126 if (m_pGRD->MMR == 0) { |
1126 if (!m_gbContext) { | 1127 if (!m_gbContext) { |
1127 const size_t size = GetHuffContextSize(m_pGRD->GBTEMPLATE); | 1128 const size_t size = GetHuffContextSize(m_pGRD->GBTEMPLATE); |
1128 m_gbContext = FX_Alloc(JBig2ArithCtx, size); | 1129 m_gbContext = FX_Alloc(JBig2ArithCtx, size); |
1129 JBIG2_memset(m_gbContext, 0, sizeof(JBig2ArithCtx) * size); | 1130 JBIG2_memset(m_gbContext, 0, sizeof(JBig2ArithCtx) * size); |
1130 } | 1131 } |
1131 if (!m_pArithDecoder) { | 1132 if (!m_pArithDecoder) { |
1132 m_pArithDecoder.reset(new CJBig2_ArithDecoder(m_pStream.get())); | 1133 m_pArithDecoder.reset(new CJBig2_ArithDecoder(m_pStream.get())); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 SBSYMCODES[CURTEMP].code = CURCODE; | 1426 SBSYMCODES[CURTEMP].code = CURCODE; |
1426 CURCODE = CURCODE + 1; | 1427 CURCODE = CURCODE + 1; |
1427 } | 1428 } |
1428 CURTEMP = CURTEMP + 1; | 1429 CURTEMP = CURTEMP + 1; |
1429 } | 1430 } |
1430 CURLEN = CURLEN + 1; | 1431 CURLEN = CURLEN + 1; |
1431 } | 1432 } |
1432 FX_Free(LENCOUNT); | 1433 FX_Free(LENCOUNT); |
1433 FX_Free(FIRSTCODE); | 1434 FX_Free(FIRSTCODE); |
1434 } | 1435 } |
OLD | NEW |