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

Side by Side Diff: net/tools/dump_cache/cache_dumper.cc

Issue 2081007: Enable warning 4389 as an error on windows builds. This will make... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/base/network_change_notifier_win.cc ('k') | net/tools/dump_cache/upgrade.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "net/tools/dump_cache/cache_dumper.h" 5 #include "net/tools/dump_cache/cache_dumper.h"
6 6
7 #include "net/base/io_buffer.h" 7 #include "net/base/io_buffer.h"
8 #include "net/disk_cache/entry_impl.h" 8 #include "net/disk_cache/entry_impl.h"
9 #include "net/http/http_cache.h" 9 #include "net/http/http_cache.h"
10 #include "net/http/http_response_headers.h" 10 #include "net/http/http_response_headers.h"
11 #include "net/http/http_response_info.h" 11 #include "net/http/http_response_info.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 entry_url_ = key; 83 entry_url_ = key;
84 84
85 FilePath directory = entry_path_.DirName(); 85 FilePath directory = entry_path_.DirName();
86 SafeCreateDirectory(directory.value()); 86 SafeCreateDirectory(directory.value());
87 87
88 std::wstring file = entry_path_.value(); 88 std::wstring file = entry_path_.value();
89 #ifdef WIN32_LARGE_FILENAME_SUPPORT 89 #ifdef WIN32_LARGE_FILENAME_SUPPORT
90 entry_ = CreateFileW(file.c_str(), GENERIC_WRITE|GENERIC_READ, 0, 0, 90 entry_ = CreateFileW(file.c_str(), GENERIC_WRITE|GENERIC_READ, 0, 0,
91 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); 91 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
92 if (entry_ == INVALID_HANDLE_VALUE) {
93 wprintf(L"CreateFileW (%s) failed: %d\n", file.c_str(), GetLastError());
94 return false;
95 }
92 return entry_ != INVALID_HANDLE_VALUE; 96 return entry_ != INVALID_HANDLE_VALUE;
93 #else 97 #else
94 entry_ = file_util::OpenFile(entry_path_, "w+"); 98 entry_ = file_util::OpenFile(entry_path_, "w+");
95 return entry_ != NULL; 99 return entry_ != NULL;
96 #endif 100 #endif
97 } 101 }
98 102
99 // Utility Function to create a normalized header string from a 103 // Utility Function to create a normalized header string from a
100 // HttpResponseInfo. The output will be formatted exactly 104 // HttpResponseInfo. The output will be formatted exactly
101 // like so: 105 // like so:
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 181
178 data = headers.c_str(); 182 data = headers.c_str();
179 len = headers.size(); 183 len = headers.size();
180 } else if (index == 1) { // Stream 1 is the data. 184 } else if (index == 1) { // Stream 1 is the data.
181 data = buf->data(); 185 data = buf->data();
182 len = buf_len; 186 len = buf_len;
183 } 187 }
184 #ifdef WIN32_LARGE_FILENAME_SUPPORT 188 #ifdef WIN32_LARGE_FILENAME_SUPPORT
185 DWORD bytes; 189 DWORD bytes;
186 DWORD rv = WriteFile(entry_, data, len, &bytes, 0); 190 DWORD rv = WriteFile(entry_, data, len, &bytes, 0);
187 return rv == TRUE && bytes == len; 191 return rv == TRUE && bytes == static_cast<DWORD>(len);
188 #else 192 #else
189 int bytes = fwrite(data, 1, len, entry_); 193 int bytes = fwrite(data, 1, len, entry_);
190 return bytes == len; 194 return bytes == len;
191 #endif 195 #endif
192 } 196 }
193 197
194 void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used, 198 void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used,
195 base::Time last_modified) { 199 base::Time last_modified) {
196 #ifdef WIN32_LARGE_FILENAME_SUPPORT 200 #ifdef WIN32_LARGE_FILENAME_SUPPORT
197 CloseHandle(entry_); 201 CloseHandle(entry_);
198 #else 202 #else
199 file_util::CloseFile(entry_); 203 file_util::CloseFile(entry_);
200 #endif 204 #endif
201 } 205 }
202 206
OLDNEW
« no previous file with comments | « net/base/network_change_notifier_win.cc ('k') | net/tools/dump_cache/upgrade.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698