Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1090)

Unified Diff: core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp

Issue 1395613003: Put CJBig2_SymbolDict's images in a CJBig2_List container. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_SymbolDict.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp
diff --git a/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp b/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp
index 1ec56dfacc1acbf9a58bc6d59de7193722dc410c..a8f8a945295dbd98186e35b6f0834a5e2b0d4791 100644
--- a/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp
@@ -10,12 +10,17 @@
#include "JBig2_Image.h"
CJBig2_SymbolDict::CJBig2_SymbolDict() {
- SDNUMEXSYMS = 0;
- SDEXSYMS = NULL;
m_bContextRetained = FALSE;
m_gbContext = m_grContext = NULL;
}
+CJBig2_SymbolDict::~CJBig2_SymbolDict() {
+ if (m_bContextRetained) {
+ FX_Free(m_gbContext);
+ FX_Free(m_grContext);
+ }
+}
+
nonstd::unique_ptr<CJBig2_SymbolDict> CJBig2_SymbolDict::DeepCopy() const {
nonstd::unique_ptr<CJBig2_SymbolDict> dst;
const CJBig2_SymbolDict* src = this;
@@ -23,27 +28,9 @@ nonstd::unique_ptr<CJBig2_SymbolDict> CJBig2_SymbolDict::DeepCopy() const {
return dst;
dst.reset(new CJBig2_SymbolDict);
- dst->SDNUMEXSYMS = src->SDNUMEXSYMS;
- dst->SDEXSYMS = FX_Alloc(CJBig2_Image*, src->SDNUMEXSYMS);
- for (FX_DWORD i = 0; i < src->SDNUMEXSYMS; ++i) {
- if (src->SDEXSYMS[i]) {
- dst->SDEXSYMS[i] = new CJBig2_Image(*(src->SDEXSYMS[i]));
- } else {
- dst->SDEXSYMS[i] = NULL;
- }
+ for (size_t i = 0; i < src->m_SDEXSYMS.size(); ++i) {
+ CJBig2_Image* image = src->m_SDEXSYMS.get(i);
+ dst->m_SDEXSYMS.push_back(image ? new CJBig2_Image(*image) : nullptr);
}
return dst;
}
-
-CJBig2_SymbolDict::~CJBig2_SymbolDict() {
- if (SDEXSYMS) {
- for (FX_DWORD i = 0; i < SDNUMEXSYMS; i++) {
- delete SDEXSYMS[i];
- }
- FX_Free(SDEXSYMS);
- }
- if (m_bContextRetained) {
- FX_Free(m_gbContext);
- FX_Free(m_grContext);
- }
-}
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_SymbolDict.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698