summaryrefslogtreecommitdiff
path: root/core/src/fxcodec/jbig2/JBig2_Segment.cpp
blob: 7ad55f3515d4b9f39f57b203c5a17fb6c43e023d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#include "JBig2_Segment.h"

#include "../../../include/fxcrt/fx_memory.h"

CJBig2_Segment::CJBig2_Segment() {
  m_dwNumber = 0;
  m_cFlags.c = 0;
  m_nReferred_to_segment_count = 0;
  m_pReferred_to_segment_numbers = NULL;
  m_dwPage_association = 0;
  m_dwData_length = 0;
  m_dwHeader_Length = 0;
  m_pData = NULL;
  m_State = JBIG2_SEGMENT_HEADER_UNPARSED;
  m_nResultType = JBIG2_VOID_POINTER;
  m_Result.vd = NULL;
}
CJBig2_Segment::~CJBig2_Segment() {
  FX_Free(m_pReferred_to_segment_numbers);

  switch (m_nResultType) {
    case JBIG2_IMAGE_POINTER:
      delete m_Result.im;
      break;
    case JBIG2_SYMBOL_DICT_POINTER:
      delete m_Result.sd;
      break;
    case JBIG2_PATTERN_DICT_POINTER:
      delete m_Result.pd;
      break;
    case JBIG2_HUFFMAN_TABLE_POINTER:
      delete m_Result.ht;
      break;
    default:
      FX_Free(m_Result.vd);
  }
}