| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,6 +2,7 @@ Name: zlib | |||
| 2 | 2 | Short Name: zlib | |
| 3 | 3 | URL: http://zlib.net/ | |
| 4 | 4 | Version: 1.3.0.1 | |
| 5 | + Revision: ac8f12c97d1afd9bafa9c710f827d40a407d3266 | ||
| 5 | 6 | CPEPrefix: cpe:/a:zlib:zlib:1.3.0.1 | |
| 6 | 7 | Security Critical: yes | |
| 7 | 8 | Shipped: yes | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -165,8 +165,7 @@ struct ZipBuffer { | |||
| 165 | 165 | // writing compressed data and it returns NULL for this case.) | |
| 166 | 166 | void* OpenZipBuffer(void* opaque, const void* /*filename*/, int mode) { | |
| 167 | 167 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) != ZLIB_FILEFUNC_MODE_READ) { | |
| 168 | - NOTREACHED_IN_MIGRATION(); | ||
| 169 | - return NULL; | ||
| 168 | + NOTREACHED(); | ||
| 170 | 169 | } | |
| 171 | 170 | ZipBuffer* buffer = static_cast<ZipBuffer*>(opaque); | |
| 172 | 171 | if (!buffer || !buffer->data || !buffer->length) | |
@@ -196,8 +195,7 @@ uLong WriteZipBuffer(void* /*opaque*/, | |||
| 196 | 195 | void* /*stream*/, | |
| 197 | 196 | const void* /*buf*/, | |
| 198 | 197 | uLong /*size*/) { | |
| 199 | - NOTREACHED_IN_MIGRATION(); | ||
| 200 | - return 0; | ||
| 198 | + NOTREACHED(); | ||
| 201 | 199 | } | |
| 202 | 200 | ||
| 203 | 201 | // Returns the offset from the beginning of the data. | |
@@ -228,8 +226,7 @@ long SeekZipBuffer(void* opaque, | |||
| 228 | 226 | buffer->offset = std::min(buffer->length, offset); | |
| 229 | 227 | return 0; | |
| 230 | 228 | } | |
| 231 | - NOTREACHED_IN_MIGRATION(); | ||
| 232 | - return -1; | ||
| 229 | + NOTREACHED(); | ||
| 233 | 230 | } | |
| 234 | 231 | ||
| 235 | 232 | // Closes the input offset and deletes all resources used for compressing or | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,7 @@ | |||
| 9 | 9 | #include <string.h> | |
| 10 | 10 | ||
| 11 | 11 | #include <iterator> | |
| 12 | + #include <optional> | ||
| 12 | 13 | #include <string> | |
| 13 | 14 | #include <string_view> | |
| 14 | 15 | #include <vector> | |
@@ -555,10 +556,10 @@ TEST_F(ZipReaderTest, ExtractToFileAsync_RegularFile) { | |||
| 555 | 556 | const std::string md5 = base::MD5String(output); | |
| 556 | 557 | EXPECT_EQ(kQuuxExpectedMD5, md5); | |
| 557 | 558 | ||
| 558 | - int64_t file_size = 0; | ||
| 559 | - ASSERT_TRUE(base::GetFileSize(target_file, &file_size)); | ||
| 559 | + std::optional<int64_t> file_size = base::GetFileSize(target_file); | ||
| 560 | + ASSERT_TRUE(file_size.has_value()); | ||
| 560 | 561 | ||
| 561 | - EXPECT_EQ(file_size, listener.current_progress()); | ||
| 562 | + EXPECT_EQ(file_size.value(), listener.current_progress()); | ||
| 562 | 563 | } | |
| 563 | 564 | ||
| 564 | 565 | TEST_F(ZipReaderTest, ExtractToFileAsync_Encrypted_NoPassword) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,8 +63,9 @@ bool CreateFile(const std::string& content, | |||
| 63 | 63 | if (!base::CreateTemporaryFile(file_path)) | |
| 64 | 64 | return false; | |
| 65 | 65 | ||
| 66 | - if (base::WriteFile(*file_path, content.data(), content.size()) == -1) | ||
| 66 | + if (!base::WriteFile(*file_path, content)) { | ||
| 67 | 67 | return false; | |
| 68 | + } | ||
| 68 | 69 | ||
| 69 | 70 | *file = base::File( | |
| 70 | 71 | *file_path, base::File::Flags::FLAG_OPEN | base::File::Flags::FLAG_READ); | |
@@ -350,7 +351,7 @@ class ZipTest : public PlatformTest { | |||
| 350 | 351 | base::Time now_time; | |
| 351 | 352 | EXPECT_TRUE(base::Time::FromUTCExploded(now_parts, &now_time)); | |
| 352 | 353 | ||
| 353 | - EXPECT_EQ(1, base::WriteFile(src_file, "1", 1)); | ||
| 354 | + EXPECT_TRUE(base::WriteFile(src_file, "1")); | ||
| 354 | 355 | EXPECT_TRUE(base::TouchFile(src_file, base::Time::Now(), test_mtime)); | |
| 355 | 356 | ||
| 356 | 357 | EXPECT_TRUE(zip::Zip(src_dir, zip_file, true)); | |
@@ -748,6 +749,8 @@ TEST_F(ZipTest, UnzipMixedPaths) { | |||
| 748 | 749 | "Space→", // | |
| 749 | 750 | #else | |
| 750 | 751 | " ", // | |
| 752 | + "...", // Disappears on Windows | ||
| 753 | + "....", // Disappears on Windows | ||
| 751 | 754 | "AUX", // Disappears on Windows | |
| 752 | 755 | "COM1", // Disappears on Windows | |
| 753 | 756 | "COM2", // Disappears on Windows | |
@@ -1113,9 +1116,9 @@ TEST_F(ZipTest, UnzipFilesWithIncorrectSize) { | |||
| 1113 | 1116 | SCOPED_TRACE(base::StringPrintf("Processing %d.txt", i)); | |
| 1114 | 1117 | base::FilePath file_path = | |
| 1115 | 1118 | temp_dir.AppendASCII(base::StringPrintf("%d.txt", i)); | |
| 1116 | - int64_t file_size = -1; | ||
| 1117 | - EXPECT_TRUE(base::GetFileSize(file_path, &file_size)); | ||
| 1118 | - EXPECT_EQ(static_cast<int64_t>(i), file_size); | ||
| 1119 | + std::optional<int64_t> file_size = base::GetFileSize(file_path); | ||
| 1120 | + EXPECT_TRUE(file_size.has_value()); | ||
| 1121 | + EXPECT_EQ(static_cast<int64_t>(i), file_size.value()); | ||
| 1119 | 1122 | } | |
| 1120 | 1123 | } | |
| 1121 | 1124 | ||
@@ -1306,10 +1309,10 @@ TEST_F(ZipTest, Compressed) { | |||
| 1306 | 1309 | ||
| 1307 | 1310 | // Since the source files compress well, the destination ZIP file should be | |
| 1308 | 1311 | // smaller than the source files. | |
| 1309 | - int64_t dest_file_size; | ||
| 1310 | - ASSERT_TRUE(base::GetFileSize(dest_file, &dest_file_size)); | ||
| 1311 | - EXPECT_GT(dest_file_size, 300); | ||
| 1312 | - EXPECT_LT(dest_file_size, 1000); | ||
| 1312 | + std::optional<int64_t> dest_file_size = base::GetFileSize(dest_file); | ||
| 1313 | + ASSERT_TRUE(dest_file_size.has_value()); | ||
| 1314 | + EXPECT_GT(dest_file_size.value(), 300); | ||
| 1315 | + EXPECT_LT(dest_file_size.value(), 1000); | ||
| 1313 | 1316 | } | |
| 1314 | 1317 | ||
| 1315 | 1318 | // Tests that a ZIP put inside a ZIP is simply stored instead of being | |
@@ -1338,10 +1341,10 @@ TEST_F(ZipTest, NestedZip) { | |||
| 1338 | 1341 | // Since the dummy source (inner) ZIP file should simply be stored in the | |
| 1339 | 1342 | // destination (outer) ZIP file, the destination file should be bigger than | |
| 1340 | 1343 | // the source file, but not much bigger. | |
| 1341 | - int64_t dest_file_size; | ||
| 1342 | - ASSERT_TRUE(base::GetFileSize(dest_file, &dest_file_size)); | ||
| 1343 | - EXPECT_GT(dest_file_size, src_size + 100); | ||
| 1344 | - EXPECT_LT(dest_file_size, src_size + 300); | ||
| 1344 | + std::optional<int64_t> dest_file_size = base::GetFileSize(dest_file); | ||
| 1345 | + ASSERT_TRUE(dest_file_size.has_value()); | ||
| 1346 | + EXPECT_GT(dest_file_size.value(), src_size + 100); | ||
| 1347 | + EXPECT_LT(dest_file_size.value(), src_size + 300); | ||
| 1345 | 1348 | } | |
| 1346 | 1349 | ||
| 1347 | 1350 | // Tests that there is no 2GB or 4GB limits. Tests that big files can be zipped | |
@@ -1402,10 +1405,10 @@ TEST_F(ZipTest, BigFile) { | |||
| 1402 | 1405 | // Since the dummy source (inner) ZIP file should simply be stored in the | |
| 1403 | 1406 | // destination (outer) ZIP file, the destination file should be bigger than | |
| 1404 | 1407 | // the source file, but not much bigger. | |
| 1405 | - int64_t dest_file_size; | ||
| 1406 | - ASSERT_TRUE(base::GetFileSize(dest_file, &dest_file_size)); | ||
| 1407 | - EXPECT_GT(dest_file_size, src_size + 100); | ||
| 1408 | - EXPECT_LT(dest_file_size, src_size + 300); | ||
| 1408 | + std::optional<int64_t> dest_file_size = base::GetFileSize(dest_file); | ||
| 1409 | + ASSERT_TRUE(dest_file_size.has_value()); | ||
| 1410 | + EXPECT_GT(dest_file_size.value(), src_size + 100); | ||
| 1411 | + EXPECT_LT(dest_file_size.value(), src_size + 300); | ||
| 1409 | 1412 | ||
| 1410 | 1413 | LOG(INFO) << "Reading big ZIP " << dest_file; | |
| 1411 | 1414 | zip::ZipReader reader; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments