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

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

Issue 522029: If we can't read a unicode character, write the standard "unknown" (0xFFFD) c... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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 | « chrome/common/zip_unittest.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 (c) 2008 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // 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>
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 322 }
323 } 323 }
324 324
325 int FileStream::Open(const FilePath& path, int open_flags) { 325 int FileStream::Open(const FilePath& path, int open_flags) {
326 if (IsOpen()) { 326 if (IsOpen()) {
327 DLOG(FATAL) << "File is already open!"; 327 DLOG(FATAL) << "File is already open!";
328 return ERR_UNEXPECTED; 328 return ERR_UNEXPECTED;
329 } 329 }
330 330
331 open_flags_ = open_flags; 331 open_flags_ = open_flags;
332 file_ = base::CreatePlatformFile(path.ToWStringHack(), open_flags_, NULL); 332 file_ = base::CreatePlatformFile(path, open_flags_, NULL);
333 if (file_ == base::kInvalidPlatformFileValue) { 333 if (file_ == base::kInvalidPlatformFileValue) {
334 LOG(WARNING) << "Failed to open file: " << errno 334 LOG(WARNING) << "Failed to open file: " << errno
335 << " (" << path.ToWStringHack() << ")"; 335 << " (" << path.ToWStringHack() << ")";
336 return MapErrorCode(errno); 336 return MapErrorCode(errno);
337 } 337 }
338 338
339 if (open_flags_ & base::PLATFORM_FILE_ASYNC) { 339 if (open_flags_ & base::PLATFORM_FILE_ASYNC) {
340 async_context_.reset(new AsyncContext()); 340 async_context_.reset(new AsyncContext());
341 } 341 }
342 342
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 int64 seek_position = Seek(FROM_BEGIN, bytes); 451 int64 seek_position = Seek(FROM_BEGIN, bytes);
452 if (seek_position != bytes) 452 if (seek_position != bytes)
453 return ERR_UNEXPECTED; 453 return ERR_UNEXPECTED;
454 454
455 // And truncate the file. 455 // And truncate the file.
456 int result = ftruncate(file_, bytes); 456 int result = ftruncate(file_, bytes);
457 return result == 0 ? seek_position : MapErrorCode(errno); 457 return result == 0 ? seek_position : MapErrorCode(errno);
458 } 458 }
459 459
460 } // namespace net 460 } // namespace net
OLDNEW
« no previous file with comments | « chrome/common/zip_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698