summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-06-04 18:41:01 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-04 18:41:01 +0000
commitf8cf36b2a385ed17bc34cf394dfe4e379a563820 (patch)
tree357d002a60eb39f8dca55b174d0f54098bd14694
parentf06ed6d3578fff9e1d2990e5757dc460e60e5dd3 (diff)
downloadpdfium-f8cf36b2a385ed17bc34cf394dfe4e379a563820.tar.xz
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 <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--core/fpdfapi/parser/cpdf_cross_ref_avail_unittest.cpp30
1 files 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<int>(table.size());
+ size_t cur_offset = table.size();
table +=
"xref \n"
"0 6 \n"
@@ -148,8 +147,8 @@ TEST(CPDF_CrossRefAvailTest, ThreeCrossRefV4) {
"[<afbb0f593c2d2aea5b519cb61da1c17b><4f9bb2e7978401808f8f1f2a75c322c8>]"
"/Info 15 0 R/Size 16>>\n";
table += "Dummy Data jgwhughouiwbahng";
- int prev_offset = cur_offset;
- cur_offset = static_cast<int>(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<int>(prev_offset), int_buffer, 10) + ">>\n";
table += "More Dummy Data jgwhughouiwbahng";
prev_offset = cur_offset;
- cur_offset = static_cast<int>(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<int>(prev_offset), int_buffer, 10) + ">>\n";
+ const FX_FILESIZE last_crossref_offset = static_cast<FX_FILESIZE>(cur_offset);
auto parser = MakeParserForBuffer(
reinterpret_cast<const unsigned char*>(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<int>(table.size());
+ size_t cur_offset = table.size();
table +=
"16 0 obj\n"
"<</Type /XRef>>"
@@ -198,12 +196,12 @@ TEST(CPDF_CrossRefAvailTest, ThreeCrossRefV5) {
"endobj\n";
table += "Dummy Data jgwhughouiwbahng";
- int prev_offset = cur_offset;
- cur_offset = static_cast<int>(table.size());
+ size_t prev_offset = cur_offset;
+ cur_offset = table.size();
table += std::string(
"55 0 obj\n"
"<</Type /XRef /Prev ") +
- FXSYS_itoa(prev_offset, int_buffer, 10) +
+ FXSYS_itoa(static_cast<int>(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<int>(table.size());
+ cur_offset = table.size();
table += std::string(
"88 0 obj\n"
"<</Type /XRef /NNNN /Prev ") +
- FXSYS_itoa(prev_offset, int_buffer, 10) +
+ FXSYS_itoa(static_cast<int>(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<FX_FILESIZE>(cur_offset);
auto parser = MakeParserForBuffer(
reinterpret_cast<const unsigned char*>(table.data()), table.size());