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/fpdfdoc/cpdf_metadata_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/fpdfdoc/cpdf_metadata_unittest.cpp')
-rw-r--r-- | core/fpdfdoc/cpdf_metadata_unittest.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/fpdfdoc/cpdf_metadata_unittest.cpp b/core/fpdfdoc/cpdf_metadata_unittest.cpp index 1a39948461..ed97b4f5bf 100644 --- a/core/fpdfdoc/cpdf_metadata_unittest.cpp +++ b/core/fpdfdoc/cpdf_metadata_unittest.cpp @@ -17,7 +17,7 @@ TEST(CPDF_MetadataTest, CheckSharedFormEmailAtTopLevel) { "</node>"; CPDF_Stream stream; - stream.SetData(reinterpret_cast<const uint8_t*>(data), strlen(data)); + stream.SetData(ByteStringView(data).span()); CPDF_Metadata metadata(&stream); auto results = metadata.CheckForSharedForm(); @@ -34,7 +34,7 @@ TEST(CPDF_MetadataTest, CheckSharedFormAcrobatAtTopLevel) { "</node>"; CPDF_Stream stream; - stream.SetData(reinterpret_cast<const uint8_t*>(data), strlen(data)); + stream.SetData(ByteStringView(data).span()); CPDF_Metadata metadata(&stream); auto results = metadata.CheckForSharedForm(); @@ -51,7 +51,7 @@ TEST(CPDF_MetadataTest, CheckSharedFormFilesystemAtTopLevel) { "</node>"; CPDF_Stream stream; - stream.SetData(reinterpret_cast<const uint8_t*>(data), strlen(data)); + stream.SetData(ByteStringView(data).span()); CPDF_Metadata metadata(&stream); auto results = metadata.CheckForSharedForm(); @@ -68,7 +68,7 @@ TEST(CPDF_MetadataTest, CheckSharedFormWithoutWorkflow) { "</node>"; CPDF_Stream stream; - stream.SetData(reinterpret_cast<const uint8_t*>(data), strlen(data)); + stream.SetData(ByteStringView(data).span()); CPDF_Metadata metadata(&stream); auto results = metadata.CheckForSharedForm(); @@ -86,7 +86,7 @@ TEST(CPDF_MetadataTest, CheckSharedFormAsChild) { "</parent></grandparent>"; CPDF_Stream stream; - stream.SetData(reinterpret_cast<const uint8_t*>(data), strlen(data)); + stream.SetData(ByteStringView(data).span()); CPDF_Metadata metadata(&stream); auto results = metadata.CheckForSharedForm(); @@ -100,7 +100,7 @@ TEST(CPDF_MetadataTest, CheckSharedFormAsNoAdhoc) { "<node></node>"; CPDF_Stream stream; - stream.SetData(reinterpret_cast<const uint8_t*>(data), strlen(data)); + stream.SetData(ByteStringView(data).span()); CPDF_Metadata metadata(&stream); auto results = metadata.CheckForSharedForm(); @@ -116,7 +116,7 @@ TEST(CPDF_MetadataTest, CheckSharedFormWrongNamespace) { "</node>"; CPDF_Stream stream; - stream.SetData(reinterpret_cast<const uint8_t*>(data), strlen(data)); + stream.SetData(ByteStringView(data).span()); CPDF_Metadata metadata(&stream); auto results = metadata.CheckForSharedForm(); @@ -146,7 +146,7 @@ TEST(CPDF_MetadataTest, CheckSharedFormMultipleErrors) { "</grandparent>"; CPDF_Stream stream; - stream.SetData(reinterpret_cast<const uint8_t*>(data), strlen(data)); + stream.SetData(ByteStringView(data).span()); CPDF_Metadata metadata(&stream); auto results = metadata.CheckForSharedForm(); |