From d4e8f1222ca17b57ac74019b2fc3706e1192645c Mon Sep 17 00:00:00 2001 From: Wei Li Date: Mon, 21 Mar 2016 11:20:44 -0700 Subject: Re-enable several MSVC warnings Re-enable the following warnings: 4245: signed/unsigned conversion mismatch; 4310: cast may truncate data; 4389: operator on signed/unsigned mismatch; 4701: use potentially uninitialized local variable; 4706: assignment within conditional expression Clean up the code to avoid those warnings. BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1801383002 . --- core/fpdfapi/fpdf_parser/cpdf_parser.cpp | 5 ++--- core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'core/fpdfapi/fpdf_parser') diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp index c9b8583d16..3ee53e6cf9 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp @@ -1538,9 +1538,8 @@ CPDF_Parser::Error CPDF_Parser::StartAsyncParse(IFX_FileRead* pFileAccess) { FX_FILESIZE dwFirstXRefOffset = m_pSyntax->SavePos(); FX_BOOL bXRefRebuilt = FALSE; - FX_BOOL bLoadV4 = FALSE; - if (!(bLoadV4 = LoadCrossRefV4(dwFirstXRefOffset, 0, FALSE)) && - !LoadCrossRefV5(&dwFirstXRefOffset, TRUE)) { + FX_BOOL bLoadV4 = LoadCrossRefV4(dwFirstXRefOffset, 0, FALSE); + if (!bLoadV4 && !LoadCrossRefV5(&dwFirstXRefOffset, TRUE)) { if (!RebuildCrossRef()) return FORMAT_ERROR; diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index f7fc3099fc..c91e99b9cb 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -177,14 +177,14 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf, old = dest_size; dest_size += src_buf[i] + 1; if (dest_size < old) { - return (FX_DWORD)-1; + return static_cast(-1); } i += src_buf[i] + 2; } else if (src_buf[i] > 128) { old = dest_size; dest_size += 257 - src_buf[i]; if (dest_size < old) { - return (FX_DWORD)-1; + return static_cast(-1); } i += 2; } else { @@ -192,7 +192,7 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf, } } if (dest_size >= _STREAM_MAX_SIZE_) { - return -1; + return static_cast(-1); } dest_buf = FX_Alloc(uint8_t, dest_size); i = 0; -- cgit v1.2.3