summaryrefslogtreecommitdiff
path: root/core/fxcodec
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec')
-rw-r--r--core/fxcodec/jbig2/JBig2_Context.cpp30
-rw-r--r--core/fxcodec/jbig2/JBig2_Segment.cpp25
-rw-r--r--core/fxcodec/jbig2/JBig2_Segment.h3
3 files changed, 28 insertions, 30 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp
index a1f6cc6bca..363be2fc31 100644
--- a/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -238,7 +238,7 @@ CJBig2_Segment* CJBig2_Context::findReferredSegmentByTypeAndIndex(
int32_t count = 0;
for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) {
CJBig2_Segment* pSeg =
- findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]);
+ findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]);
if (pSeg && pSeg->m_cFlags.s.type == cType) {
if (count == nIndex)
return pSeg;
@@ -278,31 +278,31 @@ int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) {
pSegment->m_dwNumber > 65536 ? 4 : pSegment->m_dwNumber > 256 ? 2 : 1;
uint8_t cPSize = pSegment->m_cFlags.s.page_association_size ? 4 : 1;
if (pSegment->m_nReferred_to_segment_count) {
- pSegment->m_pReferred_to_segment_numbers =
- FX_Alloc(uint32_t, pSegment->m_nReferred_to_segment_count);
+ pSegment->m_Referred_to_segment_numbers.resize(
+ pSegment->m_nReferred_to_segment_count);
for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) {
switch (cSSize) {
case 1:
if (m_pStream->read1Byte(&cTemp) != 0)
return JBIG2_ERROR_TOO_SHORT;
- pSegment->m_pReferred_to_segment_numbers[i] = cTemp;
+ pSegment->m_Referred_to_segment_numbers[i] = cTemp;
break;
case 2:
uint16_t wTemp;
if (m_pStream->readShortInteger(&wTemp) != 0)
return JBIG2_ERROR_TOO_SHORT;
- pSegment->m_pReferred_to_segment_numbers[i] = wTemp;
+ pSegment->m_Referred_to_segment_numbers[i] = wTemp;
break;
case 4:
if (m_pStream->readInteger(&dwTemp) != 0)
return JBIG2_ERROR_TOO_SHORT;
- pSegment->m_pReferred_to_segment_numbers[i] = dwTemp;
+ pSegment->m_Referred_to_segment_numbers[i] = dwTemp;
break;
}
- if (pSegment->m_pReferred_to_segment_numbers[i] >= pSegment->m_dwNumber)
+ if (pSegment->m_Referred_to_segment_numbers[i] >= pSegment->m_dwNumber)
return JBIG2_ERROR_TOO_SHORT;
}
}
@@ -457,14 +457,14 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) {
return JBIG2_ERROR_LIMIT;
}
for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) {
- if (!findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]))
+ if (!findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]))
return JBIG2_ERROR_FATAL;
}
CJBig2_Segment* pLRSeg = nullptr;
pSymbolDictDecoder->SDNUMINSYMS = 0;
for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) {
CJBig2_Segment* pSeg =
- findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]);
+ findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]);
if (pSeg->m_cFlags.s.type == 0) {
pSymbolDictDecoder->SDNUMINSYMS += pSeg->m_SymbolDict->NumImages();
pLRSeg = pSeg;
@@ -477,7 +477,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) {
uint32_t dwTemp = 0;
for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) {
CJBig2_Segment* pSeg =
- findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]);
+ findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]);
if (pSeg->m_cFlags.s.type == 0) {
const CJBig2_SymbolDict& dict = *pSeg->m_SymbolDict.get();
for (size_t j = 0; j < dict.NumImages(); ++j)
@@ -693,14 +693,14 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) {
return JBIG2_ERROR_TOO_SHORT;
for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) {
- if (!findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]))
+ if (!findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]))
return JBIG2_ERROR_FATAL;
}
pTRD->SBNUMSYMS = 0;
for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) {
CJBig2_Segment* pSeg =
- findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]);
+ findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]);
if (pSeg->m_cFlags.s.type == 0) {
pTRD->SBNUMSYMS += pSeg->m_SymbolDict->NumImages();
}
@@ -712,7 +712,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) {
dwTemp = 0;
for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) {
CJBig2_Segment* pSeg =
- findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]);
+ findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]);
if (pSeg->m_cFlags.s.type == 0) {
const CJBig2_SymbolDict& dict = *pSeg->m_SymbolDict.get();
for (size_t j = 0; j < dict.NumImages(); ++j)
@@ -1002,7 +1002,7 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment,
return JBIG2_ERROR_FATAL;
CJBig2_Segment* pSeg =
- findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[0]);
+ findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[0]);
if (!pSeg || (pSeg->m_cFlags.s.type != 16))
return JBIG2_ERROR_FATAL;
@@ -1170,7 +1170,7 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) {
if (pSegment->m_nReferred_to_segment_count > 0) {
int32_t i;
for (i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) {
- pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[0]);
+ pSeg = findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[0]);
if (!pSeg)
return JBIG2_ERROR_FATAL;
diff --git a/core/fxcodec/jbig2/JBig2_Segment.cpp b/core/fxcodec/jbig2/JBig2_Segment.cpp
index 886989abd8..58be8103d7 100644
--- a/core/fxcodec/jbig2/JBig2_Segment.cpp
+++ b/core/fxcodec/jbig2/JBig2_Segment.cpp
@@ -8,20 +8,17 @@
#include "core/fxcrt/fx_memory.h"
-CJBig2_Segment::CJBig2_Segment() {
- m_dwNumber = 0;
+CJBig2_Segment::CJBig2_Segment()
+ : m_dwNumber(0),
+ m_nReferred_to_segment_count(0),
+ m_dwPage_association(0),
+ m_dwData_length(0),
+ m_dwHeader_Length(0),
+ m_dwObjNum(0),
+ m_dwDataOffset(0),
+ m_State(JBIG2_SEGMENT_HEADER_UNPARSED),
+ m_nResultType(JBIG2_VOID_POINTER) {
m_cFlags.c = 0;
- m_nReferred_to_segment_count = 0;
- m_pReferred_to_segment_numbers = nullptr;
- m_dwPage_association = 0;
- m_dwData_length = 0;
- m_dwHeader_Length = 0;
- m_dwObjNum = 0;
- m_dwDataOffset = 0;
- m_State = JBIG2_SEGMENT_HEADER_UNPARSED;
- m_nResultType = JBIG2_VOID_POINTER;
}
-CJBig2_Segment::~CJBig2_Segment() {
- FX_Free(m_pReferred_to_segment_numbers);
-}
+CJBig2_Segment::~CJBig2_Segment() {}
diff --git a/core/fxcodec/jbig2/JBig2_Segment.h b/core/fxcodec/jbig2/JBig2_Segment.h
index 26af0f6890..5dc57a37d4 100644
--- a/core/fxcodec/jbig2/JBig2_Segment.h
+++ b/core/fxcodec/jbig2/JBig2_Segment.h
@@ -8,6 +8,7 @@
#define CORE_FXCODEC_JBIG2_JBIG2_SEGMENT_H_
#include <memory>
+#include <vector>
#include "core/fxcodec/jbig2/JBig2_Define.h"
#include "core/fxcodec/jbig2/JBig2_HuffmanTable.h"
@@ -47,7 +48,7 @@ class CJBig2_Segment {
uint8_t c;
} m_cFlags;
int32_t m_nReferred_to_segment_count;
- uint32_t* m_pReferred_to_segment_numbers;
+ std::vector<uint32_t> m_Referred_to_segment_numbers;
uint32_t m_dwPage_association;
uint32_t m_dwData_length;