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

Side by Side Diff: net/base/file_stream_posix.cc

Issue 2937010: Reland r52336. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 5 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 unified diff | Download patch
« no previous file with comments | « net/base/capturing_net_log.h ('k') | net/base/file_stream_win.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // For 64-bit file access (off_t = off64_t, lseek64, etc). 5 // For 64-bit file access (off_t = off64_t, lseek64, etc).
6 #define _FILE_OFFSET_BITS 64 6 #define _FILE_OFFSET_BITS 64
7 7
8 #include "net/base/file_stream.h" 8 #include "net/base/file_stream.h"
9 9
10 #include <sys/types.h> 10 #include <sys/types.h>
11 #include <sys/stat.h> 11 #include <sys/stat.h>
12 #include <fcntl.h> 12 #include <fcntl.h>
13 #include <unistd.h> 13 #include <unistd.h>
14 #include <errno.h> 14 #include <errno.h>
15 15
16 #include "base/basictypes.h" 16 #include "base/basictypes.h"
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/eintr_wrapper.h" 18 #include "base/eintr_wrapper.h"
19 #include "base/file_path.h" 19 #include "base/file_path.h"
20 #include "base/histogram.h"
20 #include "base/logging.h" 21 #include "base/logging.h"
21 #include "base/message_loop.h" 22 #include "base/message_loop.h"
22 #include "base/string_util.h" 23 #include "base/string_util.h"
23 #include "base/waitable_event.h" 24 #include "base/waitable_event.h"
24 #include "base/worker_pool.h" 25 #include "base/worker_pool.h"
25 #include "net/base/net_errors.h" 26 #include "net/base/net_errors.h"
26 27
27 // We cast back and forth, so make sure it's the size we're expecting. 28 // We cast back and forth, so make sure it's the size we're expecting.
28 COMPILE_ASSERT(sizeof(int64) == sizeof(off_t), off_t_64_bit); 29 COMPILE_ASSERT(sizeof(int64) == sizeof(off_t), off_t_64_bit);
29 30
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 int64 seek_position = Seek(FROM_BEGIN, bytes); 474 int64 seek_position = Seek(FROM_BEGIN, bytes);
474 if (seek_position != bytes) 475 if (seek_position != bytes)
475 return ERR_UNEXPECTED; 476 return ERR_UNEXPECTED;
476 477
477 // And truncate the file. 478 // And truncate the file.
478 int result = ftruncate(file_, bytes); 479 int result = ftruncate(file_, bytes);
479 return result == 0 ? seek_position : MapErrorCode(errno); 480 return result == 0 ? seek_position : MapErrorCode(errno);
480 } 481 }
481 482
482 } // namespace net 483 } // namespace net
OLDNEW
« no previous file with comments | « net/base/capturing_net_log.h ('k') | net/base/file_stream_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698