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

Unified Diff: runtime/bin/file_win.cc

Issue 9034005: Change the behavior of open on files to not truncate by default (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comment.s Created 8 years, 12 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 | « runtime/bin/file_test.cc ('k') | runtime/bin/gen_snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_win.cc
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
index 8e4e3c14bcee9ddd4522ede070ca24165ff1745e..6d0522145d3c327f9267dc73188652b8c3781d05 100644
--- a/runtime/bin/file_win.cc
+++ b/runtime/bin/file_win.cc
@@ -100,10 +100,13 @@ off_t File::Length() {
}
-File* File::Open(const char* name, bool writable) {
+File* File::Open(const char* name, FileOpenMode mode) {
int flags = O_RDONLY | O_BINARY;
- if (writable) {
- flags = (O_RDWR | O_CREAT | O_TRUNC | O_BINARY);
+ if ((mode & kWrite) != 0) {
+ flags = (O_RDWR | O_CREAT | O_BINARY);
+ }
+ if ((mode & kTruncate) != 0) {
+ flags = flags | O_TRUNC;
}
int fd = open(name, flags, 0666);
if (fd < 0) {
« no previous file with comments | « runtime/bin/file_test.cc ('k') | runtime/bin/gen_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698