1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
7 #include "JBig2_SymbolDict.h"
9 #include "../../../include/fxcrt/fx_memory.h"
10 #include "JBig2_Image.h"
12 CJBig2_SymbolDict::CJBig2_SymbolDict() {
15 m_bContextRetained = FALSE;
16 m_gbContext = m_grContext = NULL;
19 nonstd::unique_ptr<CJBig2_SymbolDict> CJBig2_SymbolDict::DeepCopy() const {
20 nonstd::unique_ptr<CJBig2_SymbolDict> dst;
21 const CJBig2_SymbolDict* src = this;
22 if (src->m_bContextRetained || src->m_gbContext || src->m_grContext)
25 dst.reset(new CJBig2_SymbolDict);
26 dst->SDNUMEXSYMS = src->SDNUMEXSYMS;
27 dst->SDEXSYMS = FX_Alloc(CJBig2_Image*, src->SDNUMEXSYMS);
28 for (FX_DWORD i = 0; i < src->SDNUMEXSYMS; ++i) {
29 if (src->SDEXSYMS[i]) {
30 dst->SDEXSYMS[i] = new CJBig2_Image(*(src->SDEXSYMS[i]));
32 dst->SDEXSYMS[i] = NULL;
38 CJBig2_SymbolDict::~CJBig2_SymbolDict() {
40 for (FX_DWORD i = 0; i < SDNUMEXSYMS; i++) {
45 if (m_bContextRetained) {