summaryrefslogtreecommitdiff
path: root/core/src/fxcodec/jbig2/JBig2_Context.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-18 17:01:09 -0800
committerLei Zhang <thestig@chromium.org>2015-12-18 17:01:09 -0800
commitaedd4555ec1a80121f176586cb72180337e4ccd8 (patch)
tree75a23e3962e47e0eb1cdf0472bd69729bf406029 /core/src/fxcodec/jbig2/JBig2_Context.cpp
parent4b84705b63eacb0140186983d55113f48d093f16 (diff)
downloadpdfium-aedd4555ec1a80121f176586cb72180337e4ccd8.tar.xz
Merge to XFA: Cleanup CJBig2_HuffmanTable and friends.
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1536923002 . (cherry picked from commit 9c061e2dfb22a0e321728b73c8650eded8828d90) Review URL: https://codereview.chromium.org/1539023002 .
Diffstat (limited to 'core/src/fxcodec/jbig2/JBig2_Context.cpp')
-rw-r--r--core/src/fxcodec/jbig2/JBig2_Context.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp
index 1cc8fbde24..2a28185d88 100644
--- a/core/src/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp
@@ -4,17 +4,21 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "JBig2_Context.h"
+#include "core/src/fxcodec/jbig2/JBig2_Context.h"
+#include <algorithm>
#include <list>
-
-#include "JBig2_ArithDecoder.h"
-#include "JBig2_GrdProc.h"
-#include "JBig2_GrrdProc.h"
-#include "JBig2_HtrdProc.h"
-#include "JBig2_PddProc.h"
-#include "JBig2_SddProc.h"
-#include "JBig2_TrdProc.h"
+#include <vector>
+
+#include "core/src/fxcodec/jbig2/JBig2_ArithDecoder.h"
+#include "core/src/fxcodec/jbig2/JBig2_BitStream.h"
+#include "core/src/fxcodec/jbig2/JBig2_GrdProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_GrrdProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_HtrdProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h"
+#include "core/src/fxcodec/jbig2/JBig2_PddProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_SddProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_TrdProc.h"
namespace {
@@ -1262,12 +1266,13 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) {
int32_t CJBig2_Context::parseTable(CJBig2_Segment* pSegment) {
pSegment->m_nResultType = JBIG2_HUFFMAN_TABLE_POINTER;
- pSegment->m_Result.ht = new CJBig2_HuffmanTable(m_pStream.get());
- if (!pSegment->m_Result.ht->isOK()) {
- delete pSegment->m_Result.ht;
- pSegment->m_Result.ht = NULL;
+ pSegment->m_Result.ht = nullptr;
+ nonstd::unique_ptr<CJBig2_HuffmanTable> pHuff(
+ new CJBig2_HuffmanTable(m_pStream.get()));
+ if (!pHuff->IsOK())
return JBIG2_ERROR_FATAL;
- }
+
+ pSegment->m_Result.ht = pHuff.release();
m_pStream->alignByte();
return JBIG2_SUCCESS;
}