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