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

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

Issue 1395613003: Put CJBig2_SymbolDict's images in a CJBig2_List container. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: 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
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 e8d4bb8cc81e118d74c015a167e79a9b8b008150..7b11ca2e5e77cfc8747eef96e2d00ef69766ad41 100644
--- a/core/src/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp
@@ -8,6 +8,7 @@
#include <list>
+#include "JBig2_ArithDecoder.h"
#include "JBig2_GrdProc.h"
#include "JBig2_GrrdProc.h"
#include "JBig2_HtrdProc.h"
@@ -478,7 +479,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment,
CJBig2_Segment* pSeg =
findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]);
if (pSeg->m_cFlags.s.type == 0) {
- pSymbolDictDecoder->SDNUMINSYMS += pSeg->m_Result.sd->SDNUMEXSYMS;
+ pSymbolDictDecoder->SDNUMINSYMS += pSeg->m_Result.sd->NumImages();
pLRSeg = pSeg;
}
}
@@ -491,9 +492,10 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment,
CJBig2_Segment* pSeg =
findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]);
if (pSeg->m_cFlags.s.type == 0) {
- JBIG2_memcpy(SDINSYMS.get() + dwTemp, pSeg->m_Result.sd->SDEXSYMS,
- pSeg->m_Result.sd->SDNUMEXSYMS * sizeof(CJBig2_Image*));
- dwTemp += pSeg->m_Result.sd->SDNUMEXSYMS;
+ const CJBig2_SymbolDict& dict = *pSeg->m_Result.sd;
+ for (size_t j = 0; j < dict.NumImages(); ++j)
+ SDINSYMS.get()[dwTemp + j] = dict.GetImage(j);
+ dwTemp += dict.NumImages();
}
}
}
@@ -721,7 +723,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) {
CJBig2_Segment* pSeg =
findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]);
if (pSeg->m_cFlags.s.type == 0) {
- pTRD->SBNUMSYMS += pSeg->m_Result.sd->SDNUMEXSYMS;
+ pTRD->SBNUMSYMS += pSeg->m_Result.sd->NumImages();
}
}
@@ -733,9 +735,10 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) {
CJBig2_Segment* pSeg =
findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]);
if (pSeg->m_cFlags.s.type == 0) {
- JBIG2_memcpy(SBSYMS.get() + dwTemp, pSeg->m_Result.sd->SDEXSYMS,
- pSeg->m_Result.sd->SDNUMEXSYMS * sizeof(CJBig2_Image*));
- dwTemp += pSeg->m_Result.sd->SDNUMEXSYMS;
+ const CJBig2_SymbolDict& dict = *pSeg->m_Result.sd;
+ for (size_t j = 0; j < dict.NumImages(); ++j)
+ SBSYMS.get()[dwTemp + j] = dict.GetImage(j);
+ dwTemp += dict.NumImages();
}
}
pTRD->SBSYMS = SBSYMS.get();

Powered by Google App Engine
This is Rietveld 408576698