summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/page/fpdf_page_parser_old.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler.cpp22
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler.h10
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.cpp9
-rw-r--r--core/fpdfapi/render/fpdf_render_loadimage.cpp2
-rw-r--r--core/fpdfapi/render/fpdf_render_pattern.cpp20
-rw-r--r--core/fpdftext/cpdf_textpagefind.cpp2
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp10
8 files changed, 40 insertions, 37 deletions
diff --git a/core/fpdfapi/page/fpdf_page_parser_old.cpp b/core/fpdfapi/page/fpdf_page_parser_old.cpp
index 8c69903b2c..ccee12dd03 100644
--- a/core/fpdfapi/page/fpdf_page_parser_old.cpp
+++ b/core/fpdfapi/page/fpdf_page_parser_old.cpp
@@ -107,7 +107,7 @@ uint32_t PDF_DecodeInlineStream(const uint8_t* src_buf,
CCodec_ScanlineDecoder* pDecoder =
CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder(
src_buf, limit, width, height, 0,
- pParam ? pParam->GetIntegerFor("ColorTransform", 1) : 1);
+ !pParam || pParam->GetIntegerFor("ColorTransform", 1));
return DecodeAllScanlines(pDecoder, dest_buf, dest_size);
}
if (decoder == "RunLengthDecode" || decoder == "RL") {
diff --git a/core/fpdfapi/parser/cpdf_security_handler.cpp b/core/fpdfapi/parser/cpdf_security_handler.cpp
index 039ba4e1ab..83fb6254bc 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler.cpp
@@ -387,21 +387,21 @@ FX_BOOL CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
return TRUE;
}
-int CPDF_SecurityHandler::CheckPassword(const uint8_t* password,
- uint32_t size,
- FX_BOOL bOwner,
- uint8_t* key,
- int32_t key_len) {
- if (m_Revision >= 5) {
+FX_BOOL CPDF_SecurityHandler::CheckPassword(const uint8_t* password,
+ uint32_t size,
+ FX_BOOL bOwner,
+ uint8_t* key,
+ int32_t key_len) {
+ if (m_Revision >= 5)
return AES256_CheckPassword(password, size, bOwner, key);
- }
+
uint8_t keybuf[32];
- if (!key) {
+ if (!key)
key = keybuf;
- }
- if (bOwner) {
+
+ if (bOwner)
return CheckOwnerPassword(password, size, key, key_len);
- }
+
return CheckUserPassword(password, size, FALSE, key, key_len) ||
CheckUserPassword(password, size, TRUE, key, key_len);
}
diff --git a/core/fpdfapi/parser/cpdf_security_handler.h b/core/fpdfapi/parser/cpdf_security_handler.h
index 686a25c1c5..9132fd9a46 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.h
+++ b/core/fpdfapi/parser/cpdf_security_handler.h
@@ -50,11 +50,11 @@ class CPDF_SecurityHandler {
CFX_ByteString GetUserPassword(const uint8_t* owner_pass,
uint32_t pass_size,
int32_t key_len);
- int CheckPassword(const uint8_t* password,
- uint32_t pass_size,
- FX_BOOL bOwner,
- uint8_t* key,
- int key_len);
+ FX_BOOL CheckPassword(const uint8_t* password,
+ uint32_t pass_size,
+ FX_BOOL bOwner,
+ uint8_t* key,
+ int key_len);
private:
FX_BOOL LoadDict(CPDF_Dictionary* pEncryptDict);
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index 88712c9760..ed379c7028 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -305,17 +305,18 @@ uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
uint8_t*& dest_buf,
uint32_t& dest_size) {
int predictor = 0;
+ int Colors = 0;
+ int BitsPerComponent = 0;
+ int Columns = 0;
FX_BOOL bEarlyChange = TRUE;
- int Colors = 0, BitsPerComponent = 0, Columns = 0;
if (pParams) {
predictor = pParams->GetIntegerFor("Predictor");
- bEarlyChange = pParams->GetIntegerFor("EarlyChange", 1);
+ bEarlyChange = !!pParams->GetIntegerFor("EarlyChange", 1);
Colors = pParams->GetIntegerFor("Colors", 1);
BitsPerComponent = pParams->GetIntegerFor("BitsPerComponent", 8);
Columns = pParams->GetIntegerFor("Columns", 1);
- if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
+ if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns))
return (uint32_t)-1;
- }
}
return CPDF_ModuleMgr::Get()->GetFlateModule()->FlateOrLZWDecode(
bLZW, src_buf, src_size, bEarlyChange, predictor, Colors,
diff --git a/core/fpdfapi/render/fpdf_render_loadimage.cpp b/core/fpdfapi/render/fpdf_render_loadimage.cpp
index a4f0e7befb..553481db60 100644
--- a/core/fpdfapi/render/fpdf_render_loadimage.cpp
+++ b/core/fpdfapi/render/fpdf_render_loadimage.cpp
@@ -551,7 +551,7 @@ int CPDF_DIBSource::CreateDecoder() {
} else if (decoder == "DCTDecode") {
m_pDecoder.reset(CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder(
src_data, src_size, m_Width, m_Height, m_nComponents,
- pParams ? pParams->GetIntegerFor("ColorTransform", 1) : 1));
+ !pParams || pParams->GetIntegerFor("ColorTransform", 1)));
if (!m_pDecoder) {
bool bTransform = false;
int comps;
diff --git a/core/fpdfapi/render/fpdf_render_pattern.cpp b/core/fpdfapi/render/fpdf_render_pattern.cpp
index dfb5669d8f..f55a0e8b97 100644
--- a/core/fpdfapi/render/fpdf_render_pattern.cpp
+++ b/core/fpdfapi/render/fpdf_render_pattern.cpp
@@ -54,17 +54,19 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap,
FX_FLOAT start_y = pCoords->GetNumberAt(1);
FX_FLOAT end_x = pCoords->GetNumberAt(2);
FX_FLOAT end_y = pCoords->GetNumberAt(3);
- FX_FLOAT t_min = 0, t_max = 1.0f;
+ FX_FLOAT t_min = 0;
+ FX_FLOAT t_max = 1.0f;
CPDF_Array* pArray = pDict->GetArrayFor("Domain");
if (pArray) {
t_min = pArray->GetNumberAt(0);
t_max = pArray->GetNumberAt(1);
}
- FX_BOOL bStartExtend = FALSE, bEndExtend = FALSE;
+ FX_BOOL bStartExtend = FALSE;
+ FX_BOOL bEndExtend = FALSE;
pArray = pDict->GetArrayFor("Extend");
if (pArray) {
- bStartExtend = pArray->GetIntegerAt(0);
- bEndExtend = pArray->GetIntegerAt(1);
+ bStartExtend = !!pArray->GetIntegerAt(0);
+ bEndExtend = !!pArray->GetIntegerAt(1);
}
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
@@ -139,17 +141,19 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap,
FX_FLOAT end_r = pCoords->GetNumberAt(5);
CFX_Matrix matrix;
matrix.SetReverse(*pObject2Bitmap);
- FX_FLOAT t_min = 0, t_max = 1.0f;
+ FX_FLOAT t_min = 0;
+ FX_FLOAT t_max = 1.0f;
CPDF_Array* pArray = pDict->GetArrayFor("Domain");
if (pArray) {
t_min = pArray->GetNumberAt(0);
t_max = pArray->GetNumberAt(1);
}
- FX_BOOL bStartExtend = FALSE, bEndExtend = FALSE;
+ FX_BOOL bStartExtend = FALSE;
+ FX_BOOL bEndExtend = FALSE;
pArray = pDict->GetArrayFor("Extend");
if (pArray) {
- bStartExtend = pArray->GetIntegerAt(0);
- bEndExtend = pArray->GetIntegerAt(1);
+ bStartExtend = !!pArray->GetIntegerAt(0);
+ bEndExtend = !!pArray->GetIntegerAt(1);
}
uint32_t total_results =
std::max(CountOutputs(funcs), pCS->CountComponents());
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 9ccfcea86f..1eb5c4e67b 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -101,7 +101,7 @@ FX_BOOL CPDF_TextPageFind::FindFirst(const CFX_WideString& findwhat,
findwhatStr.MakeLower();
m_strText.MakeLower();
}
- m_bMatchWholeWord = flags & FPDFTEXT_MATCHWHOLEWORD;
+ m_bMatchWholeWord = !!(flags & FPDFTEXT_MATCHWHOLEWORD);
m_findNextStart = startPos;
if (startPos == -1)
m_findPreStart = m_strText.GetLength() - 1;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 2a2bb3c48d..a5efd50adb 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -919,7 +919,6 @@ FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
return FALSE;
}
- FPDF_BOOL bRet = TRUE;
FPDF_FILEHANDLER* pFileHandler = nullptr;
int fileFlag = -1;
switch (submit.GetSubmitFormat()) {
@@ -966,11 +965,10 @@ FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
CFX_WideString csBCCAddress;
CFX_WideString csSubject;
CFX_WideString csMsg;
- bRet = MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject,
- csMsg);
- if (!bRet)
+ if (!MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject,
+ csMsg)) {
return FALSE;
-
+ }
CFX_ByteString bsTo = CFX_WideString(csToAddress).UTF16LE_Encode();
CFX_ByteString bsCC = CFX_WideString(csCCAddress).UTF16LE_Encode();
CFX_ByteString bsBcc = CFX_WideString(csBCCAddress).UTF16LE_Encode();
@@ -997,7 +995,7 @@ FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
(FPDF_WIDESTRING)bs.GetBuffer(len));
bs.ReleaseBuffer(len);
}
- return bRet;
+ return TRUE;
}
FX_BOOL CPDFXFA_DocEnvironment::SetGlobalProperty(