diff options
author | Wei Li <weili@chromium.org> | 2016-03-21 11:20:44 -0700 |
---|---|---|
committer | Wei Li <weili@chromium.org> | 2016-03-21 11:20:44 -0700 |
commit | d4e8f1222ca17b57ac74019b2fc3706e1192645c (patch) | |
tree | 0dd5e1627fd684205631f875cbf5946178177766 /core/fpdfapi/fpdf_parser | |
parent | 34fa8d90ae2f60fae219e4dbeff14c053d2e8eef (diff) | |
download | pdfium-d4e8f1222ca17b57ac74019b2fc3706e1192645c.tar.xz |
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 .
Diffstat (limited to 'core/fpdfapi/fpdf_parser')
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_parser.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 6 |
2 files changed, 5 insertions, 6 deletions
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<FX_DWORD>(-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<FX_DWORD>(-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<FX_DWORD>(-1); } dest_buf = FX_Alloc(uint8_t, dest_size); i = 0; |