Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update zlib to 1.3.0.1-motley-71660e1 #53464

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion deps/zlib/contrib/minizip/README.chromium
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ Name: ZIP file API for reading file entries in a ZIP archive
Short Name: minizip
URL: https://github.com/madler/zlib/tree/master/contrib/minizip
Version: 1.3.0.1
Revision: 643e17b7498d12ab8d15565662880579692f769d
License: Zlib
License File: //third_party/zlib/LICENSE
Security Critical: yes
Shipped: yes
Security Critical: yes
CPEPrefix: cpe:/a:minizip_project:minizip

Description:
Expand Down
6 changes: 3 additions & 3 deletions deps/zlib/crc32_simd.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ uint32_t ZLIB_INTERNAL crc32_sse42_simd_( /* SSE4.2+PCLMUL */
#endif

#if defined(__aarch64__)
#define TARGET_ARMV8_WITH_CRC __attribute__((target("aes,crc")))
#define TARGET_ARMV8_WITH_CRC __attribute__((target("arch=armv8-a+aes+crc")))
#else // !defined(__aarch64__)
#define TARGET_ARMV8_WITH_CRC __attribute__((target("armv8-a,crc")))
#define TARGET_ARMV8_WITH_CRC __attribute__((target("crc")))
#endif // defined(__aarch64__)

#elif defined(__GNUC__)
Expand All @@ -398,7 +398,7 @@ uint32_t ZLIB_INTERNAL crc32_sse42_simd_( /* SSE4.2+PCLMUL */
*/
#include <arm_acle.h>
#include <arm_neon.h>
#define TARGET_ARMV8_WITH_CRC
#define TARGET_ARMV8_WITH_CRC __attribute__((target("arch=armv8-a+crc")))
#else // !defined(__GNUC__) && !defined(_aarch64__)
#error ARM CRC32 SIMD extensions only supported for Clang and GCC
#endif
Expand Down
104 changes: 52 additions & 52 deletions deps/zlib/google/zip_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#include <string.h>

#include <algorithm>
#include <string_view>

#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"

Expand Down Expand Up @@ -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<StringPiece>({
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<base::FilePath::StringPieceType>({
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;
Expand Down
11 changes: 6 additions & 5 deletions deps/zlib/google/zip_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "third_party/zlib/google/zip_reader.h"

#include <algorithm>
#include <string_view>
#include <utility>

#include "base/check.h"
Expand All @@ -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"
Expand Down Expand Up @@ -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 "/".
Expand All @@ -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());
Expand Down
3 changes: 2 additions & 1 deletion deps/zlib/google/zip_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <limits>
#include <memory>
#include <string>
#include <string_view>

#include "base/files/file.h"
#include "base/files/file_path.h"
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions deps/zlib/google/zip_reader_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <iterator>
#include <string>
#include <string_view>
#include <vector>

#include "base/check.h"
Expand All @@ -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"
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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();
}
Expand Down
6 changes: 4 additions & 2 deletions deps/zlib/google/zip_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stddef.h>
#include <stdint.h>

#include <iomanip>
#include <limits>
#include <string>
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <vector>
Expand All @@ -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"

Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/zlib_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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-8b7eff8"
#endif // SRC_ZLIB_VERSION_H_