summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-11-09 21:02:48 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-09 21:02:48 +0000
commit309fa59a2992706924913a63e7c847bc431159bc (patch)
treecf0524d6db552b91137c9730d339226d53dbb654
parentb5d688b8852d2fd3bf8b5c3f367c5941dda18401 (diff)
downloadpdfium-chromium/3264.tar.xz
Rename some methods in CJBig2_Contextchromium/3264
This CL improves some method names and does other basic cleanup. Change-Id: I32ea88ff29383e9685d4c686625088c96f73f035 Reviewed-on: https://pdfium-review.googlesource.com/18210 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
-rw-r--r--core/fxcodec/jbig2/JBig2_Context.cpp47
-rw-r--r--core/fxcodec/jbig2/JBig2_Context.h7
2 files changed, 21 insertions, 33 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp
index 6985c0e927..f4be12e889 100644
--- a/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -69,8 +69,7 @@ CJBig2_Context::CJBig2_Context(const RetainPtr<CPDF_StreamAcc>& pGlobalStream,
CJBig2_Context::~CJBig2_Context() {}
-int32_t CJBig2_Context::decode_SquentialOrgnazation(
- IFX_PauseIndicator* pPause) {
+int32_t CJBig2_Context::decodeSequential(IFX_PauseIndicator* pPause) {
int32_t nRet;
if (m_pStream->getByteLeft() <= 0)
return JBIG2_END_OF_FILE;
@@ -119,21 +118,17 @@ int32_t CJBig2_Context::decode_SquentialOrgnazation(
return JBIG2_SUCCESS;
}
-int32_t CJBig2_Context::decode_EmbedOrgnazation(IFX_PauseIndicator* pPause) {
- return decode_SquentialOrgnazation(pPause);
-}
-
-int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage(
- IFX_PauseIndicator* pPause) {
+int32_t CJBig2_Context::decodeRandomFirstPage(IFX_PauseIndicator* pPause) {
int32_t nRet;
while (m_pStream->getByteLeft() > JBIG2_MIN_SEGMENT_SIZE) {
auto pSegment = pdfium::MakeUnique<CJBig2_Segment>();
nRet = parseSegmentHeader(pSegment.get());
- if (nRet != JBIG2_SUCCESS) {
+ if (nRet != JBIG2_SUCCESS)
return nRet;
- } else if (pSegment->m_cFlags.s.type == 51) {
+
+ if (pSegment->m_cFlags.s.type == 51)
break;
- }
+
m_SegmentList.push_back(std::move(pSegment));
if (pPause && pPause->NeedToPauseNow()) {
m_PauseStep = 3;
@@ -142,10 +137,10 @@ int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage(
}
}
m_nSegmentDecoded = 0;
- return decode_RandomOrgnazation(pPause);
+ return decodeRandom(pPause);
}
-int32_t CJBig2_Context::decode_RandomOrgnazation(IFX_PauseIndicator* pPause) {
+int32_t CJBig2_Context::decodeRandom(IFX_PauseIndicator* pPause) {
for (; m_nSegmentDecoded < m_SegmentList.size(); ++m_nSegmentDecoded) {
int32_t nRet =
parseSegmentData(m_SegmentList[m_nSegmentDecoded].get(), pPause);
@@ -171,7 +166,7 @@ int32_t CJBig2_Context::getFirstPage(uint8_t* pBuf,
IFX_PauseIndicator* pPause) {
int32_t nRet = 0;
if (m_pGlobalContext) {
- nRet = m_pGlobalContext->decode_EmbedOrgnazation(pPause);
+ nRet = m_pGlobalContext->decodeSequential(pPause);
if (nRet != JBIG2_SUCCESS) {
m_ProcessingStatus = FXCODEC_STATUS_ERROR;
return nRet;
@@ -191,40 +186,34 @@ int32_t CJBig2_Context::getFirstPage(uint8_t* pBuf,
int32_t CJBig2_Context::Continue(IFX_PauseIndicator* pPause) {
m_ProcessingStatus = FXCODEC_STATUS_DECODE_READY;
int32_t nRet = 0;
- if (m_PauseStep <= 1) {
- nRet = decode_EmbedOrgnazation(pPause);
- } else if (m_PauseStep == 2) {
- nRet = decode_SquentialOrgnazation(pPause);
+ if (m_PauseStep <= 2) {
+ nRet = decodeSequential(pPause);
} else if (m_PauseStep == 3) {
- nRet = decode_RandomOrgnazation_FirstPage(pPause);
+ nRet = decodeRandomFirstPage(pPause);
} else if (m_PauseStep == 4) {
- nRet = decode_RandomOrgnazation(pPause);
+ nRet = decodeRandom(pPause);
} else if (m_PauseStep == 5) {
m_ProcessingStatus = FXCODEC_STATUS_DECODE_FINISH;
return JBIG2_SUCCESS;
}
- if (m_ProcessingStatus == FXCODEC_STATUS_DECODE_TOBECONTINUE) {
+ if (m_ProcessingStatus == FXCODEC_STATUS_DECODE_TOBECONTINUE)
return nRet;
- }
+
m_PauseStep = 5;
if (!m_bBufSpecified && nRet == JBIG2_SUCCESS) {
m_ProcessingStatus = FXCODEC_STATUS_DECODE_FINISH;
return JBIG2_SUCCESS;
}
- if (nRet == JBIG2_SUCCESS) {
- m_ProcessingStatus = FXCODEC_STATUS_DECODE_FINISH;
- } else {
- m_ProcessingStatus = FXCODEC_STATUS_ERROR;
- }
+ m_ProcessingStatus = nRet == JBIG2_SUCCESS ? FXCODEC_STATUS_DECODE_FINISH
+ : FXCODEC_STATUS_ERROR;
return nRet;
}
CJBig2_Segment* CJBig2_Context::findSegmentByNumber(uint32_t dwNumber) {
if (m_pGlobalContext) {
CJBig2_Segment* pSeg = m_pGlobalContext->findSegmentByNumber(dwNumber);
- if (pSeg) {
+ if (pSeg)
return pSeg;
- }
}
for (const auto& pSeg : m_SegmentList) {
if (pSeg->m_dwNumber == dwNumber)
diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h
index 749ec901f4..f86aa2ea1d 100644
--- a/core/fxcodec/jbig2/JBig2_Context.h
+++ b/core/fxcodec/jbig2/JBig2_Context.h
@@ -55,10 +55,9 @@ class CJBig2_Context {
FXCODEC_STATUS GetProcessingStatus() const { return m_ProcessingStatus; }
private:
- int32_t decode_SquentialOrgnazation(IFX_PauseIndicator* pPause);
- int32_t decode_EmbedOrgnazation(IFX_PauseIndicator* pPause);
- int32_t decode_RandomOrgnazation_FirstPage(IFX_PauseIndicator* pPause);
- int32_t decode_RandomOrgnazation(IFX_PauseIndicator* pPause);
+ int32_t decodeSequential(IFX_PauseIndicator* pPause);
+ int32_t decodeRandomFirstPage(IFX_PauseIndicator* pPause);
+ int32_t decodeRandom(IFX_PauseIndicator* pPause);
CJBig2_Segment* findSegmentByNumber(uint32_t dwNumber);
CJBig2_Segment* findReferredSegmentByTypeAndIndex(CJBig2_Segment* pSegment,