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_Segment.h" | 7 #include "JBig2_Segment.h" |
8 CJBig2_Segment::CJBig2_Segment() | 8 CJBig2_Segment::CJBig2_Segment() { |
9 { | 9 init(); |
10 init(); | |
11 } | 10 } |
12 CJBig2_Segment::~CJBig2_Segment() | 11 CJBig2_Segment::~CJBig2_Segment() { |
13 { | 12 clean(); |
14 clean(); | |
15 } | 13 } |
16 void CJBig2_Segment::init() | 14 void CJBig2_Segment::init() { |
17 { | 15 m_dwNumber = 0; |
18 m_dwNumber = 0; | 16 m_cFlags.c = 0; |
19 m_cFlags.c = 0; | 17 m_nReferred_to_segment_count = 0; |
20 m_nReferred_to_segment_count = 0; | 18 m_pReferred_to_segment_numbers = NULL; |
21 m_pReferred_to_segment_numbers = NULL; | 19 m_dwPage_association = 0; |
22 m_dwPage_association = 0; | 20 m_dwData_length = 0; |
23 m_dwData_length = 0; | 21 m_dwHeader_Length = 0; |
24 m_dwHeader_Length = 0; | 22 m_pData = NULL; |
25 m_pData = NULL; | 23 m_State = JBIG2_SEGMENT_HEADER_UNPARSED; |
26 m_State = JBIG2_SEGMENT_HEADER_UNPARSED; | 24 m_nResultType = JBIG2_VOID_POINTER; |
27 m_nResultType = JBIG2_VOID_POINTER; | 25 m_Result.vd = NULL; |
28 m_Result.vd = NULL; | |
29 } | 26 } |
30 void CJBig2_Segment::clean() | 27 void CJBig2_Segment::clean() { |
31 { | 28 if (m_pReferred_to_segment_numbers) { |
32 if(m_pReferred_to_segment_numbers) { | 29 m_pModule->JBig2_Free(m_pReferred_to_segment_numbers); |
33 m_pModule->JBig2_Free(m_pReferred_to_segment_numbers); | 30 } |
| 31 if (m_Result.vd) { |
| 32 switch (m_nResultType) { |
| 33 case JBIG2_IMAGE_POINTER: |
| 34 delete m_Result.im; |
| 35 break; |
| 36 case JBIG2_SYMBOL_DICT_POINTER: |
| 37 delete m_Result.sd; |
| 38 break; |
| 39 case JBIG2_PATTERN_DICT_POINTER: |
| 40 delete m_Result.pd; |
| 41 break; |
| 42 case JBIG2_HUFFMAN_TABLE_POINTER: |
| 43 delete m_Result.ht; |
| 44 break; |
| 45 default: |
| 46 m_pModule->JBig2_Free(m_Result.vd); |
34 } | 47 } |
35 if(m_Result.vd) { | 48 } |
36 switch(m_nResultType) { | |
37 case JBIG2_IMAGE_POINTER: | |
38 delete m_Result.im; | |
39 break; | |
40 case JBIG2_SYMBOL_DICT_POINTER: | |
41 delete m_Result.sd; | |
42 break; | |
43 case JBIG2_PATTERN_DICT_POINTER: | |
44 delete m_Result.pd; | |
45 break; | |
46 case JBIG2_HUFFMAN_TABLE_POINTER: | |
47 delete m_Result.ht; | |
48 break; | |
49 default: | |
50 m_pModule->JBig2_Free(m_Result.vd); | |
51 } | |
52 } | |
53 } | 49 } |
OLD | NEW |