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

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

Issue 1365903002: Fix a leak in CJBig2_Context. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: more unique_ptr, fix leak Created 5 years, 3 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/codec/fx_codec_jbig.cpp ('k') | core/src/fxcodec/jbig2/JBig2_Context.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.h
diff --git a/core/src/fxcodec/jbig2/JBig2_Context.h b/core/src/fxcodec/jbig2/JBig2_Context.h
index 1af6b9444c98ec30259a7a1965118b01cc8eac5e..f6799b7d1cf5ba75c96d26f63bff037b2c8e09a4 100644
--- a/core/src/fxcodec/jbig2/JBig2_Context.h
+++ b/core/src/fxcodec/jbig2/JBig2_Context.h
@@ -28,10 +28,6 @@ using CJBig2_CachePair = std::pair<const uint8_t*, CJBig2_SymbolDict*>;
#define JBIG2_ERROR_FILE_FORMAT -4
#define JBIG2_ERROR_STREAM_TYPE -5
#define JBIG2_ERROR_LIMIT -6
-#define JBIG2_FILE_STREAM 0
-#define JBIG2_SQUENTIAL_STREAM 1
-#define JBIG2_RANDOM_STREAM 2
-#define JBIG2_EMBED_STREAM 3
#define JBIG2_MIN_SEGMENT_SIZE 11
class CJBig2_Context {
@@ -41,7 +37,6 @@ class CJBig2_Context {
FX_DWORD dwGlobalLength,
const uint8_t* pData,
FX_DWORD dwLength,
- int32_t nStreamType,
std::list<CJBig2_CachePair>* pSymbolDictCache,
IFX_Pause* pPause = NULL);
@@ -53,29 +48,19 @@ class CJBig2_Context {
int32_t stride,
IFX_Pause* pPause);
- int32_t getFirstPage(CJBig2_Image** image, IFX_Pause* pPause);
-
int32_t Continue(IFX_Pause* pPause);
FXCODEC_STATUS GetProcessingStatus() { return m_ProcessingStatus; }
private:
- enum JBig2State {
- JBIG2_OUT_OF_PAGE = 0,
- JBIG2_IN_PAGE,
- };
-
CJBig2_Context(const uint8_t* pGlobalData,
FX_DWORD dwGlobalLength,
const uint8_t* pData,
FX_DWORD dwLength,
- int32_t nStreamType,
std::list<CJBig2_CachePair>* pSymbolDictCache,
IFX_Pause* pPause);
~CJBig2_Context();
- int32_t decodeFile(IFX_Pause* pPause);
-
int32_t decode_SquentialOrgnazation(IFX_Pause* pPause);
int32_t decode_EmbedOrgnazation(IFX_Pause* pPause);
@@ -121,20 +106,18 @@ class CJBig2_Context {
private:
CJBig2_Context* m_pGlobalContext;
- int32_t m_nStreamType;
- CJBig2_BitStream* m_pStream;
- int32_t m_nState;
+ nonstd::unique_ptr<CJBig2_BitStream> m_pStream;
+ bool m_bInPage;
CJBig2_List<CJBig2_Segment> m_SegmentList;
CJBig2_List<JBig2PageInfo> m_PageInfoList;
- CJBig2_Image* m_pPage;
- FX_BOOL m_bBufSpecified;
+ nonstd::unique_ptr<CJBig2_Image> m_pPage;
+ bool m_bBufSpecified;
Tom Sepez 2015/09/24 16:44:38 nit: if we put all bools adjacent to each other, w
Lei Zhang 2015/09/24 19:55:25 Done. I changed the ctor to do all the variable in
size_t m_nSegmentDecoded;
IFX_Pause* m_pPause;
int32_t m_PauseStep;
FXCODEC_STATUS m_ProcessingStatus;
- FX_BOOL m_bFirstPage;
CJBig2_ArithDecoder* m_pArithDecoder;
- CJBig2_GRDProc* m_pGRD;
+ nonstd::unique_ptr<CJBig2_GRDProc> m_pGRD;
JBig2ArithCtx* m_gbContext;
nonstd::unique_ptr<CJBig2_Segment> m_pSegment;
FX_DWORD m_dwOffset;
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_jbig.cpp ('k') | core/src/fxcodec/jbig2/JBig2_Context.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698