OLD | NEW |
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 Loading... |
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 Loading... |
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) |
OLD | NEW |