summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-22 15:04:26 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-22 15:04:26 -0700
commit4eb4d7f6c707cc2c23c806aa540d055c8832b55d (patch)
tree43b7a7fac7b4ce08c287bfc03d09e5e1201e20d0 /core/src/fpdfapi/fpdf_page
parent7cc97521db1e52d5927f5605de5f9a7102f8af40 (diff)
downloadpdfium-4eb4d7f6c707cc2c23c806aa540d055c8832b55d.tar.xz
Revert "Fix else-after-returns throughout pdfium."
This reverts commit 7cc97521db1e52d5927f5605de5f9a7102f8af40.
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp7
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp22
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp3
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp20
4 files changed, 24 insertions, 28 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index c0cdb228f4..db3966ec17 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -754,17 +754,18 @@ void CPDF_PageObjects::ContinueParse(IFX_Pause* pPause)
}
int CPDF_PageObjects::EstimateParseProgress() const
{
- if (!m_pParser) {
+ if (m_pParser == NULL) {
return m_ParseState == PDF_CONTENT_PARSED ? 100 : 0;
}
return m_pParser->EstimateProgress();
}
FX_POSITION CPDF_PageObjects::InsertObject(FX_POSITION posInsertAfter, CPDF_PageObject* pNewObject)
{
- if (!posInsertAfter) {
+ if (posInsertAfter == NULL) {
return m_ObjectList.AddHead(pNewObject);
+ } else {
+ return m_ObjectList.InsertAfter(posInsertAfter, pNewObject);
}
- return m_ObjectList.InsertAfter(posInsertAfter, pNewObject);
}
int CPDF_PageObjects::GetObjectIndex(CPDF_PageObject* pObj) const
{
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index 198054ef7e..101a197968 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -103,15 +103,14 @@ FX_BOOL CPDF_DeviceCS::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B
pBuf[1] = G;
pBuf[2] = B;
return TRUE;
- }
- if (m_Family == PDFCS_DEVICEGRAY) {
+ } else if (m_Family == PDFCS_DEVICEGRAY) {
if (R == G && R == B) {
*pBuf = R;
return TRUE;
+ } else {
+ return FALSE;
}
- return FALSE;
- }
- if (m_Family == PDFCS_DEVICECMYK) {
+ } else if (m_Family == PDFCS_DEVICECMYK) {
sRGB_to_AdobeCMYK(R, G, B, pBuf[0], pBuf[1], pBuf[2], pBuf[3]);
return TRUE;
}
@@ -122,8 +121,9 @@ FX_BOOL CPDF_DeviceCS::v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOA
if (m_Family == PDFCS_DEVICERGB) {
AdobeCMYK_to_sRGB(c, m, y, k, pBuf[0], pBuf[1], pBuf[2]);
return TRUE;
- }
- if (m_Family == PDFCS_DEVICECMYK) {
+ } else if (m_Family == PDFCS_DEVICEGRAY) {
+ return FALSE;
+ } else if (m_Family == PDFCS_DEVICECMYK) {
pBuf[0] = c;
pBuf[1] = m;
pBuf[2] = y;
@@ -314,8 +314,9 @@ FX_BOOL CPDF_CalGray::SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B)
if (R == G && R == B) {
*pBuf = R;
return TRUE;
+ } else {
+ return FALSE;
}
- return FALSE;
}
void CPDF_CalGray::TranslateImageLine(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels, int image_width, int image_height, FX_BOOL bTransMask) const
{
@@ -992,9 +993,10 @@ FX_BOOL CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_F
if (m_pAltCS) {
m_pAltCS->GetRGB(results, R, G, B);
return TRUE;
+ } else {
+ R = G = B = 0;
+ return FALSE;
}
- R = G = B = 0;
- return FALSE;
}
void CPDF_SeparationCS::EnableStdConversion(FX_BOOL bEnabled)
{
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 892e2153b7..5b5703b868 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -337,8 +337,7 @@ FX_BOOL CPDF_StreamContentParser::OnOperator(const FX_CHAR* op)
if (compare == 0) {
(this->*g_OpCodes[middle].m_OpHandler)();
return TRUE;
- }
- if (compare < 0) {
+ } else if (compare < 0) {
high = middle - 1;
} else {
low = middle + 1;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 37ffea9742..ebd4d83310 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -288,25 +288,19 @@ FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit,
if (decoder == FX_BSTRC("CCITTFaxDecode") || decoder == FX_BSTRC("CCF")) {
ICodec_ScanlineDecoder* pDecoder = FPDFAPI_CreateFaxDecoder(src_buf, limit, width, height, pParam);
return _DecodeAllScanlines(pDecoder, dest_buf, dest_size);
- }
- if (decoder == FX_BSTRC("ASCII85Decode") || decoder == FX_BSTRC("A85")) {
+ } else if (decoder == FX_BSTRC("ASCII85Decode") || decoder == FX_BSTRC("A85")) {
return _A85Decode(src_buf, limit, dest_buf, dest_size);
- }
- if (decoder == FX_BSTRC("ASCIIHexDecode") || decoder == FX_BSTRC("AHx")) {
+ } else if (decoder == FX_BSTRC("ASCIIHexDecode") || decoder == FX_BSTRC("AHx")) {
return _HexDecode(src_buf, limit, dest_buf, dest_size);
- }
- if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) {
+ } else if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) {
return FPDFAPI_FlateOrLZWDecode(FALSE, src_buf, limit, pParam, dest_size, dest_buf, dest_size);
- }
- if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) {
+ } else if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) {
return FPDFAPI_FlateOrLZWDecode(TRUE, src_buf, limit, pParam, 0, dest_buf, dest_size);
- }
- if (decoder == FX_BSTRC("DCTDecode") || decoder == FX_BSTRC("DCT")) {
+ } else if (decoder == FX_BSTRC("DCTDecode") || decoder == FX_BSTRC("DCT")) {
ICodec_ScanlineDecoder* pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder(
- src_buf, limit, width, height, 0, pParam ? pParam->GetInteger(FX_BSTRC("ColorTransform"), 1) : 1);
+ src_buf, limit, width, height, 0, pParam ? pParam->GetInteger(FX_BSTRC("ColorTransform"), 1) : 1);
return _DecodeAllScanlines(pDecoder, dest_buf, dest_size);
- }
- if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC("RL")) {
+ } else if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC("RL")) {
return RunLengthDecode(src_buf, limit, dest_buf, dest_size);
}
dest_size = 0;