Skip to content

Commit 637a306

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update zlib to 1.3.0.1-motley-887bb57
PR-URL: #53464 Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 569a739 commit 637a306

File tree

5 files changed

+70
-66
lines changed

5 files changed

+70
-66
lines changed

deps/zlib/google/zip_internal.cc

+52-52
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
#include <string.h>
99

1010
#include <algorithm>
11+
#include <string_view>
1112

1213
#include "base/containers/fixed_flat_set.h"
1314
#include "base/files/file_path.h"
1415
#include "base/logging.h"
1516
#include "base/notreached.h"
16-
#include "base/strings/string_piece.h"
1717
#include "base/strings/string_util.h"
1818
#include "base/strings/utf_string_conversions.h"
1919

@@ -398,64 +398,64 @@ Compression GetCompressionMethod(const base::FilePath& path) {
398398
if (ext.empty())
399399
return kDeflated;
400400

401-
using StringPiece = base::FilePath::StringPieceType;
402401

403402
// Skip the leading dot.
404-
StringPiece ext_without_dot = ext;
403+
base::FilePath::StringPieceType ext_without_dot = ext;
405404
DCHECK_EQ(ext_without_dot.front(), FILE_PATH_LITERAL('.'));
406405
ext_without_dot.remove_prefix(1);
407406

408407
// Well known filename extensions of files that a likely to be already
409408
// compressed. The extensions are in lower case without the leading dot.
410-
static constexpr auto kExts = base::MakeFixedFlatSet<StringPiece>({
411-
FILE_PATH_LITERAL("3g2"), //
412-
FILE_PATH_LITERAL("3gp"), //
413-
FILE_PATH_LITERAL("7z"), //
414-
FILE_PATH_LITERAL("7zip"), //
415-
FILE_PATH_LITERAL("aac"), //
416-
FILE_PATH_LITERAL("avi"), //
417-
FILE_PATH_LITERAL("bz"), //
418-
FILE_PATH_LITERAL("bz2"), //
419-
FILE_PATH_LITERAL("crx"), //
420-
FILE_PATH_LITERAL("gif"), //
421-
FILE_PATH_LITERAL("gz"), //
422-
FILE_PATH_LITERAL("jar"), //
423-
FILE_PATH_LITERAL("jpeg"), //
424-
FILE_PATH_LITERAL("jpg"), //
425-
FILE_PATH_LITERAL("lz"), //
426-
FILE_PATH_LITERAL("m2v"), //
427-
FILE_PATH_LITERAL("m4p"), //
428-
FILE_PATH_LITERAL("m4v"), //
429-
FILE_PATH_LITERAL("mng"), //
430-
FILE_PATH_LITERAL("mov"), //
431-
FILE_PATH_LITERAL("mp2"), //
432-
FILE_PATH_LITERAL("mp3"), //
433-
FILE_PATH_LITERAL("mp4"), //
434-
FILE_PATH_LITERAL("mpe"), //
435-
FILE_PATH_LITERAL("mpeg"), //
436-
FILE_PATH_LITERAL("mpg"), //
437-
FILE_PATH_LITERAL("mpv"), //
438-
FILE_PATH_LITERAL("ogg"), //
439-
FILE_PATH_LITERAL("ogv"), //
440-
FILE_PATH_LITERAL("png"), //
441-
FILE_PATH_LITERAL("qt"), //
442-
FILE_PATH_LITERAL("rar"), //
443-
FILE_PATH_LITERAL("taz"), //
444-
FILE_PATH_LITERAL("tb2"), //
445-
FILE_PATH_LITERAL("tbz"), //
446-
FILE_PATH_LITERAL("tbz2"), //
447-
FILE_PATH_LITERAL("tgz"), //
448-
FILE_PATH_LITERAL("tlz"), //
449-
FILE_PATH_LITERAL("tz"), //
450-
FILE_PATH_LITERAL("tz2"), //
451-
FILE_PATH_LITERAL("vob"), //
452-
FILE_PATH_LITERAL("webm"), //
453-
FILE_PATH_LITERAL("wma"), //
454-
FILE_PATH_LITERAL("wmv"), //
455-
FILE_PATH_LITERAL("xz"), //
456-
FILE_PATH_LITERAL("z"), //
457-
FILE_PATH_LITERAL("zip"), //
458-
});
409+
static constexpr auto kExts =
410+
base::MakeFixedFlatSet<base::FilePath::StringPieceType>({
411+
FILE_PATH_LITERAL("3g2"), //
412+
FILE_PATH_LITERAL("3gp"), //
413+
FILE_PATH_LITERAL("7z"), //
414+
FILE_PATH_LITERAL("7zip"), //
415+
FILE_PATH_LITERAL("aac"), //
416+
FILE_PATH_LITERAL("avi"), //
417+
FILE_PATH_LITERAL("bz"), //
418+
FILE_PATH_LITERAL("bz2"), //
419+
FILE_PATH_LITERAL("crx"), //
420+
FILE_PATH_LITERAL("gif"), //
421+
FILE_PATH_LITERAL("gz"), //
422+
FILE_PATH_LITERAL("jar"), //
423+
FILE_PATH_LITERAL("jpeg"), //
424+
FILE_PATH_LITERAL("jpg"), //
425+
FILE_PATH_LITERAL("lz"), //
426+
FILE_PATH_LITERAL("m2v"), //
427+
FILE_PATH_LITERAL("m4p"), //
428+
FILE_PATH_LITERAL("m4v"), //
429+
FILE_PATH_LITERAL("mng"), //
430+
FILE_PATH_LITERAL("mov"), //
431+
FILE_PATH_LITERAL("mp2"), //
432+
FILE_PATH_LITERAL("mp3"), //
433+
FILE_PATH_LITERAL("mp4"), //
434+
FILE_PATH_LITERAL("mpe"), //
435+
FILE_PATH_LITERAL("mpeg"), //
436+
FILE_PATH_LITERAL("mpg"), //
437+
FILE_PATH_LITERAL("mpv"), //
438+
FILE_PATH_LITERAL("ogg"), //
439+
FILE_PATH_LITERAL("ogv"), //
440+
FILE_PATH_LITERAL("png"), //
441+
FILE_PATH_LITERAL("qt"), //
442+
FILE_PATH_LITERAL("rar"), //
443+
FILE_PATH_LITERAL("taz"), //
444+
FILE_PATH_LITERAL("tb2"), //
445+
FILE_PATH_LITERAL("tbz"), //
446+
FILE_PATH_LITERAL("tbz2"), //
447+
FILE_PATH_LITERAL("tgz"), //
448+
FILE_PATH_LITERAL("tlz"), //
449+
FILE_PATH_LITERAL("tz"), //
450+
FILE_PATH_LITERAL("tz2"), //
451+
FILE_PATH_LITERAL("vob"), //
452+
FILE_PATH_LITERAL("webm"), //
453+
FILE_PATH_LITERAL("wma"), //
454+
FILE_PATH_LITERAL("wmv"), //
455+
FILE_PATH_LITERAL("xz"), //
456+
FILE_PATH_LITERAL("z"), //
457+
FILE_PATH_LITERAL("zip"), //
458+
});
459459

460460
if (kExts.count(ext_without_dot)) {
461461
return kStored;

deps/zlib/google/zip_reader.cc

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "third_party/zlib/google/zip_reader.h"
66

77
#include <algorithm>
8+
#include <string_view>
89
#include <utility>
910

1011
#include "base/check.h"
@@ -15,7 +16,6 @@
1516
#include "base/logging.h"
1617
#include "base/numerics/safe_conversions.h"
1718
#include "base/strings/strcat.h"
18-
#include "base/strings/string_piece.h"
1919
#include "base/strings/string_util.h"
2020
#include "base/strings/utf_string_conversions.h"
2121
#include "base/task/sequenced_task_runner.h"
@@ -267,7 +267,7 @@ bool ZipReader::OpenEntry() {
267267
return true;
268268
}
269269

270-
void ZipReader::Normalize(base::StringPiece16 in) {
270+
void ZipReader::Normalize(std::u16string_view in) {
271271
entry_.is_unsafe = true;
272272

273273
// Directory entries in ZIP have a path ending with "/".
@@ -281,15 +281,16 @@ void ZipReader::Normalize(base::StringPiece16 in) {
281281

282282
for (;;) {
283283
// Consume initial path separators.
284-
const base::StringPiece16::size_type i = in.find_first_not_of(u'/');
285-
if (i == base::StringPiece16::npos)
284+
const std::u16string_view::size_type i = in.find_first_not_of(u'/');
285+
if (i == std::u16string_view::npos) {
286286
break;
287+
}
287288

288289
in.remove_prefix(i);
289290
DCHECK(!in.empty());
290291

291292
// Isolate next path component.
292-
const base::StringPiece16 part = in.substr(0, in.find_first_of(u'/'));
293+
const std::u16string_view part = in.substr(0, in.find_first_of(u'/'));
293294
DCHECK(!part.empty());
294295

295296
in.remove_prefix(part.size());

deps/zlib/google/zip_reader.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <limits>
1111
#include <memory>
1212
#include <string>
13+
#include <string_view>
1314

1415
#include "base/files/file.h"
1516
#include "base/files/file_path.h"
@@ -281,7 +282,7 @@ class ZipReader {
281282

282283
// Normalizes the given path passed as UTF-16 string piece. Sets entry_.path,
283284
// entry_.is_directory and entry_.is_unsafe.
284-
void Normalize(base::StringPiece16 in);
285+
void Normalize(std::u16string_view in);
285286

286287
// Runs the ListenerCallback at a throttled rate.
287288
void ReportProgress(ListenerCallback listener_callback, uint64_t bytes) const;

deps/zlib/google/zip_reader_unittest.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <iterator>
1212
#include <string>
13+
#include <string_view>
1314
#include <vector>
1415

1516
#include "base/check.h"
@@ -22,7 +23,6 @@
2223
#include "base/i18n/time_formatting.h"
2324
#include "base/path_service.h"
2425
#include "base/run_loop.h"
25-
#include "base/strings/string_piece.h"
2626
#include "base/strings/stringprintf.h"
2727
#include "base/strings/utf_string_conversions.h"
2828
#include "base/test/bind.h"
@@ -172,7 +172,7 @@ class ZipReaderTest : public PlatformTest {
172172
}
173173

174174
static Paths GetPaths(const base::FilePath& zip_path,
175-
base::StringPiece encoding = {}) {
175+
std::string_view encoding = {}) {
176176
Paths paths;
177177

178178
if (ZipReader reader; reader.Open(zip_path)) {
@@ -422,7 +422,7 @@ TEST_F(ZipReaderTest, EncryptedFile_WrongPassword) {
422422
EXPECT_EQ("This is not encrypted.\n", contents);
423423
}
424424

425-
for (const base::StringPiece path : {
425+
for (const std::string_view path : {
426426
"Encrypted AES-128.txt",
427427
"Encrypted AES-192.txt",
428428
"Encrypted AES-256.txt",
@@ -458,7 +458,7 @@ TEST_F(ZipReaderTest, EncryptedFile_RightPassword) {
458458
}
459459

460460
// TODO(crbug.com/1296838) Support AES encryption.
461-
for (const base::StringPiece path : {
461+
for (const std::string_view path : {
462462
"Encrypted AES-128.txt",
463463
"Encrypted AES-192.txt",
464464
"Encrypted AES-256.txt",
@@ -713,12 +713,12 @@ TEST_F(ZipReaderTest, ExtractCurrentEntryToString) {
713713
if (i > 0) {
714714
// Exact byte read limit: must pass.
715715
EXPECT_TRUE(reader.ExtractCurrentEntryToString(i, &contents));
716-
EXPECT_EQ(std::string(base::StringPiece("0123456", i)), contents);
716+
EXPECT_EQ(std::string(std::string_view("0123456", i)), contents);
717717
}
718718

719719
// More than necessary byte read limit: must pass.
720720
EXPECT_TRUE(reader.ExtractCurrentEntryToString(&contents));
721-
EXPECT_EQ(std::string(base::StringPiece("0123456", i)), contents);
721+
EXPECT_EQ(std::string(std::string_view("0123456", i)), contents);
722722
}
723723
reader.Close();
724724
}

deps/zlib/google/zip_unittest.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
#include "third_party/zlib/google/zip.h"
6+
57
#include <stddef.h>
68
#include <stdint.h>
79

810
#include <iomanip>
911
#include <limits>
1012
#include <string>
13+
#include <string_view>
1114
#include <unordered_map>
1215
#include <unordered_set>
1316
#include <vector>
@@ -29,7 +32,6 @@
2932
#include "testing/gmock/include/gmock/gmock.h"
3033
#include "testing/gtest/include/gtest/gtest.h"
3134
#include "testing/platform_test.h"
32-
#include "third_party/zlib/google/zip.h"
3335
#include "third_party/zlib/google/zip_internal.h"
3436
#include "third_party/zlib/google/zip_reader.h"
3537

@@ -1290,7 +1292,7 @@ TEST_F(ZipTest, Compressed) {
12901292
EXPECT_TRUE(base::CreateDirectory(src_dir));
12911293

12921294
// Create some dummy source files.
1293-
for (const base::StringPiece s : {"foo", "bar.txt", ".hidden"}) {
1295+
for (const std::string_view s : {"foo", "bar.txt", ".hidden"}) {
12941296
base::File f(src_dir.AppendASCII(s),
12951297
base::File::FLAG_CREATE | base::File::FLAG_WRITE);
12961298
ASSERT_TRUE(f.SetLength(5000));

0 commit comments

Comments
 (0)