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

Unified Diff: base/file_util_win.cc

Issue 668022: Change default fopen() on Windows from fopen_s() to fsopen(,,_SH_DENYNO). (Closed)
Patch Set: simplify to single-line implementations Created 10 years, 10 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 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: base/file_util_win.cc
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 8f76c5cee87f24a069cbed17d82bc5b492d07a8f..d1cdc6cee4bf68ac9b00671a46ce0f3766ba7b7c 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -609,19 +609,11 @@ bool SetLastModifiedTime(const FilePath& file_path, base::Time last_modified) {
FILE* OpenFile(const FilePath& filename, const char* mode) {
std::wstring w_mode = ASCIIToWide(std::string(mode));
- FILE* file;
- if (_wfopen_s(&file, filename.value().c_str(), w_mode.c_str()) != 0) {
- return NULL;
- }
- return file;
+ return _wfsopen(filename.value().c_str(), w_mode.c_str(), _SH_DENYNO);
}
FILE* OpenFile(const std::string& filename, const char* mode) {
- FILE* file;
- if (fopen_s(&file, filename.c_str(), mode) != 0) {
- return NULL;
- }
- return file;
+ return _fsopen(filename.c_str(), mode, _SH_DENYNO);
}
int ReadFile(const FilePath& filename, char* data, int size) {
« 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