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

Side by Side Diff: runtime/bin/file_win.cc

Issue 76283002: Fix File truncate on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | « no previous file | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include <fcntl.h> // NOLINT 10 #include <fcntl.h> // NOLINT
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 80
81 bool File::SetPosition(off64_t position) { 81 bool File::SetPosition(off64_t position) {
82 ASSERT(handle_->fd() >= 0); 82 ASSERT(handle_->fd() >= 0);
83 return _lseeki64(handle_->fd(), position, SEEK_SET) >= 0; 83 return _lseeki64(handle_->fd(), position, SEEK_SET) >= 0;
84 } 84 }
85 85
86 86
87 bool File::Truncate(off64_t length) { 87 bool File::Truncate(off64_t length) {
88 ASSERT(handle_->fd() >= 0); 88 ASSERT(handle_->fd() >= 0);
89 return (_chsize_s(handle_->fd(), length) != -1); 89 return _chsize_s(handle_->fd(), length) == 0;
90 } 90 }
91 91
92 92
93 bool File::Flush() { 93 bool File::Flush() {
94 ASSERT(handle_->fd()); 94 ASSERT(handle_->fd());
95 return _commit(handle_->fd()) != -1; 95 return _commit(handle_->fd()) != -1;
96 } 96 }
97 97
98 98
99 off64_t File::Length() { 99 off64_t File::Length() {
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 return kIdentical; 606 return kIdentical;
607 } else { 607 } else {
608 return kDifferent; 608 return kDifferent;
609 } 609 }
610 } 610 }
611 611
612 } // namespace bin 612 } // namespace bin
613 } // namespace dart 613 } // namespace dart
614 614
615 #endif // defined(TARGET_OS_WINDOWS) 615 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« 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