diff --git a/deps/zlib/google/zip_internal.cc b/deps/zlib/google/zip_internal.cc index d15c6cfe4f5de2..aa49f4546caa0e 100644 --- a/deps/zlib/google/zip_internal.cc +++ b/deps/zlib/google/zip_internal.cc @@ -8,12 +8,12 @@ #include #include +#include #include "base/containers/fixed_flat_set.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/notreached.h" -#include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -398,64 +398,64 @@ Compression GetCompressionMethod(const base::FilePath& path) { if (ext.empty()) return kDeflated; - using StringPiece = base::FilePath::StringPieceType; // Skip the leading dot. - StringPiece ext_without_dot = ext; + base::FilePath::StringPieceType ext_without_dot = ext; DCHECK_EQ(ext_without_dot.front(), FILE_PATH_LITERAL('.')); ext_without_dot.remove_prefix(1); // Well known filename extensions of files that a likely to be already // compressed. The extensions are in lower case without the leading dot. - static constexpr auto kExts = base::MakeFixedFlatSet({ - FILE_PATH_LITERAL("3g2"), // - FILE_PATH_LITERAL("3gp"), // - FILE_PATH_LITERAL("7z"), // - FILE_PATH_LITERAL("7zip"), // - FILE_PATH_LITERAL("aac"), // - FILE_PATH_LITERAL("avi"), // - FILE_PATH_LITERAL("bz"), // - FILE_PATH_LITERAL("bz2"), // - FILE_PATH_LITERAL("crx"), // - FILE_PATH_LITERAL("gif"), // - FILE_PATH_LITERAL("gz"), // - FILE_PATH_LITERAL("jar"), // - FILE_PATH_LITERAL("jpeg"), // - FILE_PATH_LITERAL("jpg"), // - FILE_PATH_LITERAL("lz"), // - FILE_PATH_LITERAL("m2v"), // - FILE_PATH_LITERAL("m4p"), // - FILE_PATH_LITERAL("m4v"), // - FILE_PATH_LITERAL("mng"), // - FILE_PATH_LITERAL("mov"), // - FILE_PATH_LITERAL("mp2"), // - FILE_PATH_LITERAL("mp3"), // - FILE_PATH_LITERAL("mp4"), // - FILE_PATH_LITERAL("mpe"), // - FILE_PATH_LITERAL("mpeg"), // - FILE_PATH_LITERAL("mpg"), // - FILE_PATH_LITERAL("mpv"), // - FILE_PATH_LITERAL("ogg"), // - FILE_PATH_LITERAL("ogv"), // - FILE_PATH_LITERAL("png"), // - FILE_PATH_LITERAL("qt"), // - FILE_PATH_LITERAL("rar"), // - FILE_PATH_LITERAL("taz"), // - FILE_PATH_LITERAL("tb2"), // - FILE_PATH_LITERAL("tbz"), // - FILE_PATH_LITERAL("tbz2"), // - FILE_PATH_LITERAL("tgz"), // - FILE_PATH_LITERAL("tlz"), // - FILE_PATH_LITERAL("tz"), // - FILE_PATH_LITERAL("tz2"), // - FILE_PATH_LITERAL("vob"), // - FILE_PATH_LITERAL("webm"), // - FILE_PATH_LITERAL("wma"), // - FILE_PATH_LITERAL("wmv"), // - FILE_PATH_LITERAL("xz"), // - FILE_PATH_LITERAL("z"), // - FILE_PATH_LITERAL("zip"), // - }); + static constexpr auto kExts = + base::MakeFixedFlatSet({ + FILE_PATH_LITERAL("3g2"), // + FILE_PATH_LITERAL("3gp"), // + FILE_PATH_LITERAL("7z"), // + FILE_PATH_LITERAL("7zip"), // + FILE_PATH_LITERAL("aac"), // + FILE_PATH_LITERAL("avi"), // + FILE_PATH_LITERAL("bz"), // + FILE_PATH_LITERAL("bz2"), // + FILE_PATH_LITERAL("crx"), // + FILE_PATH_LITERAL("gif"), // + FILE_PATH_LITERAL("gz"), // + FILE_PATH_LITERAL("jar"), // + FILE_PATH_LITERAL("jpeg"), // + FILE_PATH_LITERAL("jpg"), // + FILE_PATH_LITERAL("lz"), // + FILE_PATH_LITERAL("m2v"), // + FILE_PATH_LITERAL("m4p"), // + FILE_PATH_LITERAL("m4v"), // + FILE_PATH_LITERAL("mng"), // + FILE_PATH_LITERAL("mov"), // + FILE_PATH_LITERAL("mp2"), // + FILE_PATH_LITERAL("mp3"), // + FILE_PATH_LITERAL("mp4"), // + FILE_PATH_LITERAL("mpe"), // + FILE_PATH_LITERAL("mpeg"), // + FILE_PATH_LITERAL("mpg"), // + FILE_PATH_LITERAL("mpv"), // + FILE_PATH_LITERAL("ogg"), // + FILE_PATH_LITERAL("ogv"), // + FILE_PATH_LITERAL("png"), // + FILE_PATH_LITERAL("qt"), // + FILE_PATH_LITERAL("rar"), // + FILE_PATH_LITERAL("taz"), // + FILE_PATH_LITERAL("tb2"), // + FILE_PATH_LITERAL("tbz"), // + FILE_PATH_LITERAL("tbz2"), // + FILE_PATH_LITERAL("tgz"), // + FILE_PATH_LITERAL("tlz"), // + FILE_PATH_LITERAL("tz"), // + FILE_PATH_LITERAL("tz2"), // + FILE_PATH_LITERAL("vob"), // + FILE_PATH_LITERAL("webm"), // + FILE_PATH_LITERAL("wma"), // + FILE_PATH_LITERAL("wmv"), // + FILE_PATH_LITERAL("xz"), // + FILE_PATH_LITERAL("z"), // + FILE_PATH_LITERAL("zip"), // + }); if (kExts.count(ext_without_dot)) { return kStored; diff --git a/deps/zlib/google/zip_reader.cc b/deps/zlib/google/zip_reader.cc index 34a815e5f52e9f..182a802ad84000 100644 --- a/deps/zlib/google/zip_reader.cc +++ b/deps/zlib/google/zip_reader.cc @@ -5,6 +5,7 @@ #include "third_party/zlib/google/zip_reader.h" #include +#include #include #include "base/check.h" @@ -15,7 +16,6 @@ #include "base/logging.h" #include "base/numerics/safe_conversions.h" #include "base/strings/strcat.h" -#include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/task/sequenced_task_runner.h" @@ -267,7 +267,7 @@ bool ZipReader::OpenEntry() { return true; } -void ZipReader::Normalize(base::StringPiece16 in) { +void ZipReader::Normalize(std::u16string_view in) { entry_.is_unsafe = true; // Directory entries in ZIP have a path ending with "/". @@ -281,15 +281,16 @@ void ZipReader::Normalize(base::StringPiece16 in) { for (;;) { // Consume initial path separators. - const base::StringPiece16::size_type i = in.find_first_not_of(u'/'); - if (i == base::StringPiece16::npos) + const std::u16string_view::size_type i = in.find_first_not_of(u'/'); + if (i == std::u16string_view::npos) { break; + } in.remove_prefix(i); DCHECK(!in.empty()); // Isolate next path component. - const base::StringPiece16 part = in.substr(0, in.find_first_of(u'/')); + const std::u16string_view part = in.substr(0, in.find_first_of(u'/')); DCHECK(!part.empty()); in.remove_prefix(part.size()); diff --git a/deps/zlib/google/zip_reader.h b/deps/zlib/google/zip_reader.h index b7680cc839386a..0dbf50b87b6b91 100644 --- a/deps/zlib/google/zip_reader.h +++ b/deps/zlib/google/zip_reader.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "base/files/file.h" #include "base/files/file_path.h" @@ -281,7 +282,7 @@ class ZipReader { // Normalizes the given path passed as UTF-16 string piece. Sets entry_.path, // entry_.is_directory and entry_.is_unsafe. - void Normalize(base::StringPiece16 in); + void Normalize(std::u16string_view in); // Runs the ListenerCallback at a throttled rate. void ReportProgress(ListenerCallback listener_callback, uint64_t bytes) const; diff --git a/deps/zlib/google/zip_reader_unittest.cc b/deps/zlib/google/zip_reader_unittest.cc index 9eb7d7d2b10e05..9d1406feff9887 100644 --- a/deps/zlib/google/zip_reader_unittest.cc +++ b/deps/zlib/google/zip_reader_unittest.cc @@ -10,6 +10,7 @@ #include #include +#include #include #include "base/check.h" @@ -22,7 +23,6 @@ #include "base/i18n/time_formatting.h" #include "base/path_service.h" #include "base/run_loop.h" -#include "base/strings/string_piece.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/test/bind.h" @@ -172,7 +172,7 @@ class ZipReaderTest : public PlatformTest { } static Paths GetPaths(const base::FilePath& zip_path, - base::StringPiece encoding = {}) { + std::string_view encoding = {}) { Paths paths; if (ZipReader reader; reader.Open(zip_path)) { @@ -422,7 +422,7 @@ TEST_F(ZipReaderTest, EncryptedFile_WrongPassword) { EXPECT_EQ("This is not encrypted.\n", contents); } - for (const base::StringPiece path : { + for (const std::string_view path : { "Encrypted AES-128.txt", "Encrypted AES-192.txt", "Encrypted AES-256.txt", @@ -458,7 +458,7 @@ TEST_F(ZipReaderTest, EncryptedFile_RightPassword) { } // TODO(crbug.com/1296838) Support AES encryption. - for (const base::StringPiece path : { + for (const std::string_view path : { "Encrypted AES-128.txt", "Encrypted AES-192.txt", "Encrypted AES-256.txt", @@ -713,12 +713,12 @@ TEST_F(ZipReaderTest, ExtractCurrentEntryToString) { if (i > 0) { // Exact byte read limit: must pass. EXPECT_TRUE(reader.ExtractCurrentEntryToString(i, &contents)); - EXPECT_EQ(std::string(base::StringPiece("0123456", i)), contents); + EXPECT_EQ(std::string(std::string_view("0123456", i)), contents); } // More than necessary byte read limit: must pass. EXPECT_TRUE(reader.ExtractCurrentEntryToString(&contents)); - EXPECT_EQ(std::string(base::StringPiece("0123456", i)), contents); + EXPECT_EQ(std::string(std::string_view("0123456", i)), contents); } reader.Close(); } diff --git a/deps/zlib/google/zip_unittest.cc b/deps/zlib/google/zip_unittest.cc index 922d38303ce845..58bafb809d6bf9 100644 --- a/deps/zlib/google/zip_unittest.cc +++ b/deps/zlib/google/zip_unittest.cc @@ -2,12 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "third_party/zlib/google/zip.h" + #include #include #include #include #include +#include #include #include #include @@ -29,7 +32,6 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" -#include "third_party/zlib/google/zip.h" #include "third_party/zlib/google/zip_internal.h" #include "third_party/zlib/google/zip_reader.h" @@ -1290,7 +1292,7 @@ TEST_F(ZipTest, Compressed) { EXPECT_TRUE(base::CreateDirectory(src_dir)); // Create some dummy source files. - for (const base::StringPiece s : {"foo", "bar.txt", ".hidden"}) { + for (const std::string_view s : {"foo", "bar.txt", ".hidden"}) { base::File f(src_dir.AppendASCII(s), base::File::FLAG_CREATE | base::File::FLAG_WRITE); ASSERT_TRUE(f.SetLength(5000)); diff --git a/src/zlib_version.h b/src/zlib_version.h index c7e5a26f7a0a78..66940a82f4f095 100644 --- a/src/zlib_version.h +++ b/src/zlib_version.h @@ -2,5 +2,5 @@ // Refer to tools/dep_updaters/update-zlib.sh #ifndef SRC_ZLIB_VERSION_H_ #define SRC_ZLIB_VERSION_H_ -#define ZLIB_VERSION "1.3.0.1-motley-209717d" +#define ZLIB_VERSION "1.3.0.1-motley-887bb57" #endif // SRC_ZLIB_VERSION_H_