deps: update zlib to 1.3.0.1-motley-887bb57 · nodejs/node@637a306 · GitHub
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 <chemi@atlow.co.il> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 569a739 commit 637a306

5 files changed

Lines changed: 70 additions & 66 deletions

File tree

deps/zlib/google/zip_internal.cc

Lines changed: 52 additions & 52 deletions

deps/zlib/google/zip_reader.cc

Lines changed: 6 additions & 5 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 4 additions & 2 deletions

0 commit comments

Comments
 (0)