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

Side by Side Diff: base/file_util_posix.cc

Issue 796983002: Move file_util to be POSIX-only (Closed) Base URL: https://chromium.googlesource.com/chromium/mini_chromium@string-convert-cast
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « base/file_util.cc ('k') | 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 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 8
9 #include "base/posix/eintr_wrapper.h" 9 #include "base/posix/eintr_wrapper.h"
10 10
11 namespace base { 11 namespace base {
12 12
13 bool ReadFromFD(int fd, char* buffer, size_t bytes) { 13 bool ReadFromFD(int fd, char* buffer, size_t bytes) {
14 size_t total_read = 0; 14 size_t total_read = 0;
15 while (total_read < bytes) { 15 while (total_read < bytes) {
16 ssize_t bytes_read = 16 ssize_t bytes_read =
17 HANDLE_EINTR(read(fd, buffer + total_read, bytes - total_read)); 17 HANDLE_EINTR(read(fd, buffer + total_read, bytes - total_read));
18 if (bytes_read <= 0) { 18 if (bytes_read <= 0) {
19 break; 19 break;
20 } 20 }
21 total_read += bytes_read; 21 total_read += bytes_read;
22 } 22 }
23 return total_read == bytes; 23 return total_read == bytes;
24 } 24 }
25 25
26 } // namespace base 26 } // namespace base
OLDNEW
« no previous file with comments | « base/file_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698