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

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

Issue 1536923002: Cleanup CJBig2_HuffmanTable and friends. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years 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 | « no previous file | core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcodec/jbig2/JBig2_Context.cpp
diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp
index 1cc8fbde24fbebcad7e7d7159ee89ea4db6309e4..2a28185d88ec10edff3c110e59eb7adee3a28171 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;
}
« no previous file with comments | « no previous file | core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698