summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-10-26 08:45:31 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-26 08:45:31 -0700
commit16b703cb504abedbae3e14f69c1ae355363a7ad8 (patch)
treee3561dae57648b23312c06991d96795ef0524b6c /core/fpdfapi/parser
parent04c1009af887eb5d3a183dd26421f644f63d8b77 (diff)
downloadpdfium-16b703cb504abedbae3e14f69c1ae355363a7ad8.tar.xz
Fix some bool/int mismatches.
Found by winxfa bot when fx_bool defined to bool. Review-Url: https://codereview.chromium.org/2449293002
Diffstat (limited to 'core/fpdfapi/parser')
-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
3 files changed, 21 insertions, 20 deletions
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,