summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
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, 28 insertions, 24 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index db3966ec17..c0cdb228f4 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -754,18 +754,17 @@ void CPDF_PageObjects::ContinueParse(IFX_Pause* pPause)
}
int CPDF_PageObjects::EstimateParseProgress() const
{
- if (m_pParser == NULL) {
+ if (!m_pParser) {
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 == NULL) {
+ if (!posInsertAfter) {
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 101a197968..198054ef7e 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -103,14 +103,15 @@ 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;
- } else if (m_Family == PDFCS_DEVICEGRAY) {
+ }
+ if (m_Family == PDFCS_DEVICEGRAY) {
if (R == G && R == B) {
*pBuf = R;
return TRUE;
- } else {
- return FALSE;
}
- } else if (m_Family == PDFCS_DEVICECMYK) {
+ return FALSE;
+ }
+ if (m_Family == PDFCS_DEVICECMYK) {
sRGB_to_AdobeCMYK(R, G, B, pBuf[0], pBuf[1], pBuf[2], pBuf[3]);
return TRUE;
}
@@ -121,9 +122,8 @@ 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;
- } else if (m_Family == PDFCS_DEVICEGRAY) {
- return FALSE;
- } else if (m_Family == PDFCS_DEVICECMYK) {
+ }
+ if (m_Family == PDFCS_DEVICECMYK) {
pBuf[0] = c;
pBuf[1] = m;
pBuf[2] = y;
@@ -314,9 +314,8 @@ 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
{
@@ -993,10 +992,9 @@ 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 5b5703b868..892e2153b7 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -337,7 +337,8 @@ FX_BOOL CPDF_StreamContentParser::OnOperator(const FX_CHAR* op)
if (compare == 0) {
(this->*g_OpCodes[middle].m_OpHandler)();
return TRUE;
- } else if (compare < 0) {
+ }
+ 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 ebd4d83310..37ffea9742 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -288,19 +288,25 @@ 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);
- } else if (decoder == FX_BSTRC("ASCII85Decode") || decoder == FX_BSTRC("A85")) {
+ }
+ if (decoder == FX_BSTRC("ASCII85Decode") || decoder == FX_BSTRC("A85")) {
return _A85Decode(src_buf, limit, dest_buf, dest_size);
- } else if (decoder == FX_BSTRC("ASCIIHexDecode") || decoder == FX_BSTRC("AHx")) {
+ }
+ if (decoder == FX_BSTRC("ASCIIHexDecode") || decoder == FX_BSTRC("AHx")) {
return _HexDecode(src_buf, limit, dest_buf, dest_size);
- } else if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) {
+ }
+ if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) {
return FPDFAPI_FlateOrLZWDecode(FALSE, src_buf, limit, pParam, dest_size, dest_buf, dest_size);
- } else if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) {
+ }
+ if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) {
return FPDFAPI_FlateOrLZWDecode(TRUE, src_buf, limit, pParam, 0, dest_buf, dest_size);
- } else if (decoder == FX_BSTRC("DCTDecode") || decoder == FX_BSTRC("DCT")) {
+ }
+ 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);
- } else if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC("RL")) {
+ }
+ if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC("RL")) {
return RunLengthDecode(src_buf, limit, dest_buf, dest_size);
}
dest_size = 0;