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

Unified Diff: base/event_recorder.cc

Issue 6005: Cross-platform equivalent of fopen, _wfopen_s etc.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 3 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 | base/file_util.h » ('j') | base/file_util_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/event_recorder.cc
===================================================================
--- base/event_recorder.cc (revision 2711)
+++ base/event_recorder.cc (working copy)
@@ -6,6 +6,7 @@
#include <mmsystem.h>
+#include "base/file_util.h"
#include "base/logging.h"
#include "base/time.h"
@@ -48,7 +49,8 @@
// Open the recording file.
DCHECK(file_ == NULL);
- if (_wfopen_s(&file_, filename.c_str(), L"wb+") != 0) {
+ file_ = file_util::OpenFile(filename, "wb+");
+ if (!file_) {
DLOG(ERROR) << "EventRecorder could not open log file";
return false;
}
@@ -61,7 +63,7 @@
GetModuleHandle(NULL), 0);
if (!journal_hook_) {
DLOG(ERROR) << "EventRecorder Record Hook failed";
- fclose(file_);
+ file_util::CloseFile(file_);
return false;
}
@@ -82,7 +84,7 @@
::timeEndPeriod(1);
DCHECK(file_ != NULL);
- fclose(file_);
+ file_util::CloseFile(file_);
file_ = NULL;
journal_hook_ = NULL;
@@ -98,14 +100,15 @@
// Open the recording file.
DCHECK(file_ == NULL);
- if (_wfopen_s(&file_, filename.c_str(), L"rb") != 0) {
+ file_ = file_util::OpenFile(filename, "rb");
+ if (!file_) {
DLOG(ERROR) << "EventRecorder Playback could not open log file";
return false;
}
// Read the first event from the record.
if (fread(&playback_msg_, sizeof(EVENTMSG), 1, file_) != 1) {
DLOG(ERROR) << "EventRecorder Playback has no records!";
- fclose(file_);
+ file_util::CloseFile(file_);
return false;
}
@@ -147,7 +150,7 @@
}
DCHECK(file_ != NULL);
- fclose(file_);
+ file_util::CloseFile(file_);
file_ = NULL;
::timeEndPeriod(1);
« no previous file with comments | « no previous file | base/file_util.h » ('j') | base/file_util_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698