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

Side by Side Diff: third_party/zlib/google/zip.cc

Issue 1200393002: Add more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string
Patch Set: Android Created 5 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « third_party/boringssl/boringssl_unittest.cc ('k') | tools/gn/command_args.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "third_party/zlib/google/zip.h" 5 #include "third_party/zlib/google/zip.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return true; 49 return true;
50 } 50 }
51 51
52 bool AddEntryToZip(zipFile zip_file, const base::FilePath& path, 52 bool AddEntryToZip(zipFile zip_file, const base::FilePath& path,
53 const base::FilePath& root_path) { 53 const base::FilePath& root_path) {
54 base::FilePath relative_path; 54 base::FilePath relative_path;
55 bool result = root_path.AppendRelativePath(path, &relative_path); 55 bool result = root_path.AppendRelativePath(path, &relative_path);
56 DCHECK(result); 56 DCHECK(result);
57 std::string str_path = relative_path.AsUTF8Unsafe(); 57 std::string str_path = relative_path.AsUTF8Unsafe();
58 #if defined(OS_WIN) 58 #if defined(OS_WIN)
59 ReplaceSubstringsAfterOffset(&str_path, 0u, "\\", "/"); 59 base::ReplaceSubstringsAfterOffset(&str_path, 0u, "\\", "/");
60 #endif 60 #endif
61 61
62 bool is_directory = base::DirectoryExists(path); 62 bool is_directory = base::DirectoryExists(path);
63 if (is_directory) 63 if (is_directory)
64 str_path += "/"; 64 str_path += "/";
65 65
66 zip_fileinfo file_info = zip::internal::GetFileInfoForZipping(path); 66 zip_fileinfo file_info = zip::internal::GetFileInfoForZipping(path);
67 if (!zip::internal::ZipOpenNewFileInZip(zip_file, str_path, &file_info)) 67 if (!zip::internal::ZipOpenNewFileInZip(zip_file, str_path, &file_info))
68 return false; 68 return false;
69 69
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 if (ZIP_OK != zipClose(zip_file, NULL)) { 195 if (ZIP_OK != zipClose(zip_file, NULL)) {
196 DLOG(ERROR) << "Error closing zip file for fd " << dest_fd; 196 DLOG(ERROR) << "Error closing zip file for fd " << dest_fd;
197 success = false; 197 success = false;
198 } 198 }
199 199
200 return success; 200 return success;
201 } 201 }
202 #endif // defined(OS_POSIX) 202 #endif // defined(OS_POSIX)
203 203
204 } // namespace zip 204 } // namespace zip
OLDNEW
« no previous file with comments | « third_party/boringssl/boringssl_unittest.cc ('k') | tools/gn/command_args.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698