Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: third_party/zlib/google/zip.cc

Issue 94093003: Zip utf-8 file names with encoding bit set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Argument indentation Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/zlib/google/zip.cc
diff --git a/third_party/zlib/google/zip.cc b/third_party/zlib/google/zip.cc
index 64aead1d64a1edfae35e9d21acb8025c97b151e4..a7bcc3cc284609b74cef8177c8d679de8811c89c 100644
--- a/third_party/zlib/google/zip.cc
+++ b/third_party/zlib/google/zip.cc
@@ -61,11 +61,29 @@ bool AddEntryToZip(zipFile zip_file, const base::FilePath& path,
if (is_directory)
str_path += "/";
- if (ZIP_OK != zipOpenNewFileInZip(
- zip_file, str_path.c_str(),
- NULL, NULL, 0u, NULL, 0u, NULL, // file info, extrafield local, length,
- // extrafield global, length, comment
- Z_DEFLATED, Z_DEFAULT_COMPRESSION)) {
+ // Section 4.4.4 http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+ // Setting the Language encoding flag so the file is told to be in utf-8.
+ const unsigned long LANGUAGE_ENCODING_FLAG = 0x1 << 11;
+
+ if (ZIP_OK != zipOpenNewFileInZip4(
+ zip_file, //file
+ str_path.c_str(), // filename
+ NULL, // zipfi (file_info)
+ NULL, // extrafield_local,
+ 0u, // size_extrafield_local
+ NULL, // extrafield_global
+ 0u, // size_extrafield_global
+ NULL, // comment
+ Z_DEFLATED, // method
+ Z_DEFAULT_COMPRESSION, // level
+ 0, // raw
+ -MAX_WBITS, // windowBits
+ DEF_MEM_LEVEL, // memLevel
+ Z_DEFAULT_STRATEGY, // strategy
+ NULL, //password
+ 0, // crcForCrypting
+ 0, // versionMadeBy
+ LANGUAGE_ENCODING_FLAG)) { // flagBase
DLOG(ERROR) << "Could not open zip file entry " << str_path;
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698