diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-08-23 23:52:53 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-23 23:52:53 +0000 |
commit | 367ed462b51799c008795b19e886ccbed221b9be (patch) | |
tree | 3c94f25900ec5617954dbfd3e615e6a4751ddfcd /core/fpdfapi/parser/cpdf_object_unittest.cpp | |
parent | c1dde5d9b3da2af6e6f81df09ed41ab9c34bbde4 (diff) | |
download | pdfium-367ed462b51799c008795b19e886ccbed221b9be.tar.xz |
Use pdfium::span<> in CPDF_Stream::SetData().
Conversion to span makes this more elegant in a number of places,
owing to std::vector directly converting to span, and the bytestring's
ToRawSpan().
Disambiguate single-argument forms to allow passing {} as
an argument.
Change-Id: Ibd5eaadca8d8cbbd589338f375c7ee8439fd3eb2
Reviewed-on: https://pdfium-review.googlesource.com/41272
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_object_unittest.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_object_unittest.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/core/fpdfapi/parser/cpdf_object_unittest.cpp b/core/fpdfapi/parser/cpdf_object_unittest.cpp index 78a0af7299..768ce98265 100644 --- a/core/fpdfapi/parser/cpdf_object_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_object_unittest.cpp @@ -803,8 +803,7 @@ TEST(PDFArrayTest, ConvertIndirect) { TEST(PDFStreamTest, SetData) { std::vector<uint8_t> data(100); auto stream = pdfium::MakeUnique<CPDF_Stream>(); - stream->InitStream(data.data(), data.size(), - pdfium::MakeUnique<CPDF_Dictionary>()); + stream->InitStream(data, pdfium::MakeUnique<CPDF_Dictionary>()); EXPECT_EQ(static_cast<int>(data.size()), stream->GetDict()->GetIntegerFor(pdfium::stream::kLength)); @@ -814,7 +813,7 @@ TEST(PDFStreamTest, SetData) { L"SomeParams"); std::vector<uint8_t> new_data(data.size() * 2); - stream->SetData(new_data.data(), new_data.size()); + stream->SetData(new_data); // The "Length" field should be updated for new data size. EXPECT_EQ(static_cast<int>(new_data.size()), @@ -830,8 +829,7 @@ TEST(PDFStreamTest, SetData) { TEST(PDFStreamTest, SetDataAndRemoveFilter) { std::vector<uint8_t> data(100); auto stream = pdfium::MakeUnique<CPDF_Stream>(); - stream->InitStream(data.data(), data.size(), - pdfium::MakeUnique<CPDF_Dictionary>()); + stream->InitStream(data, pdfium::MakeUnique<CPDF_Dictionary>()); EXPECT_EQ(static_cast<int>(data.size()), stream->GetDict()->GetIntegerFor(pdfium::stream::kLength)); @@ -841,7 +839,7 @@ TEST(PDFStreamTest, SetDataAndRemoveFilter) { L"SomeParams"); std::vector<uint8_t> new_data(data.size() * 2); - stream->SetDataAndRemoveFilter(new_data.data(), new_data.size()); + stream->SetDataAndRemoveFilter(new_data); // The "Length" field should be updated for new data size. EXPECT_EQ(static_cast<int>(new_data.size()), stream->GetDict()->GetIntegerFor(pdfium::stream::kLength)); |