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

Unified Diff: util/file/file_io_win.cc

Issue 812593005: Add LoggingSeekFile (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: SetFilePointerEx Created 6 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 | « util/file/file_io_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/file/file_io_win.cc
diff --git a/util/file/file_io_win.cc b/util/file/file_io_win.cc
index 7426737dcfe9cdaf82e5601ccd1e5f9d97af67d8..9106ab0bd32f5693d1cbabf31e67ddf4b193af34 100644
--- a/util/file/file_io_win.cc
+++ b/util/file/file_io_win.cc
@@ -103,6 +103,34 @@ FileHandle LoggingOpenFileForWrite(const base::FilePath& path,
return file;
}
+FileOffset LoggingSeekFile(FileHandle file, FileOffset offset, int whence) {
+ DWORD method = 0;
+ switch (whence) {
+ case SEEK_SET:
+ method = FILE_BEGIN;
+ break;
+ case SEEK_CUR:
+ method = FILE_CURRENT;
+ break;
+ case SEEK_END:
+ method = FILE_END;
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+
+ LARGE_INTEGER distance_to_move;
+ distance_to_move.QuadPart = offset;
+ LARGE_INTEGER new_offset;
+ BOOL result = SetFilePointerEx(file, distance_to_move, &new_offset, method);
+ if (!result) {
+ PLOG(ERROR) << "SetFilePointerEx";
+ return -1;
+ }
+ return new_offset.QuadPart;
+}
+
bool LoggingCloseFile(FileHandle file) {
BOOL rv = CloseHandle(file);
PLOG_IF(ERROR, !rv) << "CloseHandle";
« no previous file with comments | « util/file/file_io_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698