diff options
author | weili <weili@chromium.org> | 2016-06-03 11:22:16 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-03 11:22:16 -0700 |
commit | 12367cb5e83e771cd67948c810fdd5f63d61af87 (patch) | |
tree | 47daac780e5c028ba531830b514c0c60102f1368 /core/fpdfapi/fpdf_parser | |
parent | 79d798da0d4b5f9f1fc27917102bdd7bcfbe863e (diff) | |
download | pdfium-12367cb5e83e771cd67948c810fdd5f63d61af87.tar.xz |
Fix some code which causes warnings when compiled by /analyze tool
The code may not cause error conditions, but can be improved. These
warnings include uninitialized variables, signed/unsigned mismatch,
redundant condition, and using bool in arithmetic operations.
Also remove a chunk of unused code.
BUG=chromium:613623, chromium:427616
Review-Url: https://codereview.chromium.org/2036203004
Diffstat (limited to 'core/fpdfapi/fpdf_parser')
-rw-r--r-- | core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp index 4fd26b9153..308c9f11c9 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp @@ -73,7 +73,7 @@ TEST_F(FPDFParserDecodeEmbeddertest, FlateDecode) { for (size_t i = 0; i < FX_ArraySize(flate_decode_cases); ++i) { const pdfium::DecodeTestData& data = flate_decode_cases[i]; - unsigned char* result; + unsigned char* result = nullptr; unsigned int result_size; EXPECT_EQ(data.processed_size, FlateDecode(data.input, data.input_size, result, result_size)) diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp index 352e4ee15c..cd96c4a72a 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp @@ -29,7 +29,7 @@ TEST(fpdf_parser_decode, A85Decode) { for (size_t i = 0; i < FX_ArraySize(test_data); ++i) { pdfium::DecodeTestData* ptr = &test_data[i]; uint8_t* result = nullptr; - uint32_t result_size; + uint32_t result_size = 0; EXPECT_EQ(ptr->processed_size, A85Decode(ptr->input, ptr->input_size, result, result_size)) << "for case " << i; @@ -64,7 +64,7 @@ TEST(fpdf_parser_decode, HexDecode) { for (size_t i = 0; i < FX_ArraySize(test_data); ++i) { pdfium::DecodeTestData* ptr = &test_data[i]; uint8_t* result = nullptr; - uint32_t result_size; + uint32_t result_size = 0; EXPECT_EQ(ptr->processed_size, HexDecode(ptr->input, ptr->input_size, result, result_size)) << "for case " << i; |