From f8cf36b2a385ed17bc34cf394dfe4e379a563820 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Mon, 4 Jun 2018 18:41:01 +0000 Subject: Clean up of comment from post-submit Landed https://pdfium-review.googlesource.com/c/pdfium/+/33592 without addressing some comments that appeared after I sent it to CQ, this addresses them. Change-Id: Ic9c4d81328aafee6ff8431460c5b8b674e25ad38 Reviewed-on: https://pdfium-review.googlesource.com/33712 Reviewed-by: Henrique Nakashima Commit-Queue: Ryan Harrison --- .../parser/cpdf_cross_ref_avail_unittest.cpp | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/core/fpdfapi/parser/cpdf_cross_ref_avail_unittest.cpp b/core/fpdfapi/parser/cpdf_cross_ref_avail_unittest.cpp index 12b94ffb2d..e158bafd3e 100644 --- a/core/fpdfapi/parser/cpdf_cross_ref_avail_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_cross_ref_avail_unittest.cpp @@ -136,9 +136,8 @@ TEST(CPDF_CrossRefAvailTest, IncorrectData) { TEST(CPDF_CrossRefAvailTest, ThreeCrossRefV4) { char int_buffer[100]; - int cur_offset = 0; std::string table = "pdf blah blah blah\n"; - cur_offset = static_cast(table.size()); + size_t cur_offset = table.size(); table += "xref \n" "0 6 \n" @@ -148,8 +147,8 @@ TEST(CPDF_CrossRefAvailTest, ThreeCrossRefV4) { "[<4f9bb2e7978401808f8f1f2a75c322c8>]" "/Info 15 0 R/Size 16>>\n"; table += "Dummy Data jgwhughouiwbahng"; - int prev_offset = cur_offset; - cur_offset = static_cast(table.size()); + size_t prev_offset = cur_offset; + cur_offset = table.size(); table += std::string( "xref \n" "0 6 \n" @@ -160,10 +159,10 @@ TEST(CPDF_CrossRefAvailTest, ThreeCrossRefV4) { "4f9bb2e7978401808f8f1f2a75c322c8>]" "/Info 15 0 R/Size 16" "/Prev ") + - FXSYS_itoa(prev_offset, int_buffer, 10) + ">>\n"; + FXSYS_itoa(static_cast(prev_offset), int_buffer, 10) + ">>\n"; table += "More Dummy Data jgwhughouiwbahng"; prev_offset = cur_offset; - cur_offset = static_cast(table.size()); + cur_offset = table.size(); table += std::string( "xref \n" "0 6 \n" @@ -174,8 +173,8 @@ TEST(CPDF_CrossRefAvailTest, ThreeCrossRefV4) { "4f9bb2e7978401808f8f1f2a75c322c8>]" "/Info 15 0 R/Size 16" "/Prev ") + - FXSYS_itoa(prev_offset, int_buffer, 10) + ">>\n"; - const FX_FILESIZE last_crossref_offset = cur_offset; + FXSYS_itoa(static_cast(prev_offset), int_buffer, 10) + ">>\n"; + const FX_FILESIZE last_crossref_offset = static_cast(cur_offset); auto parser = MakeParserForBuffer( reinterpret_cast(table.data()), table.size()); @@ -186,9 +185,8 @@ TEST(CPDF_CrossRefAvailTest, ThreeCrossRefV4) { TEST(CPDF_CrossRefAvailTest, ThreeCrossRefV5) { char int_buffer[100]; - int cur_offset = 0; std::string table = "pdf blah blah blah\n"; - cur_offset = static_cast(table.size()); + size_t cur_offset = table.size(); table += "16 0 obj\n" "<>" @@ -198,12 +196,12 @@ TEST(CPDF_CrossRefAvailTest, ThreeCrossRefV5) { "endobj\n"; table += "Dummy Data jgwhughouiwbahng"; - int prev_offset = cur_offset; - cur_offset = static_cast(table.size()); + size_t prev_offset = cur_offset; + cur_offset = table.size(); table += std::string( "55 0 obj\n" "<(prev_offset), int_buffer, 10) + ">>" " stream \n" "STREAM DATA STREAM DATA STREAM DATA\n" @@ -211,17 +209,17 @@ TEST(CPDF_CrossRefAvailTest, ThreeCrossRefV5) { "endobj\n"; table += "More Dummy Data jgwhughouiwbahng"; prev_offset = cur_offset; - cur_offset = static_cast(table.size()); + cur_offset = table.size(); table += std::string( "88 0 obj\n" "<(prev_offset), int_buffer, 10) + ">>" " stream \n" "STREAM DATA STREAM DATA STREAM DATA favav\n" "endstream\n" "endobj\n"; - const FX_FILESIZE last_crossref_offset = cur_offset; + const FX_FILESIZE last_crossref_offset = static_cast(cur_offset); auto parser = MakeParserForBuffer( reinterpret_cast(table.data()), table.size()); -- cgit v1.2.3