OLD | NEW |
1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved. | 1 // Copyright (c) 2011 The LevelDB 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. See the AUTHORS file for names of contributors. | 3 // found in the LICENSE file. See the AUTHORS file for names of contributors. |
4 | 4 |
5 #include <errno.h> | 5 #include <errno.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return HANDLE_EINTR(fsync(fildes)); | 77 return HANDLE_EINTR(fsync(fildes)); |
78 #endif | 78 #endif |
79 } | 79 } |
80 #endif | 80 #endif |
81 | 81 |
82 #endif | 82 #endif |
83 | 83 |
84 // Wide-char safe fopen wrapper. | 84 // Wide-char safe fopen wrapper. |
85 FILE* fopen_internal(const char* fname, const char* mode) { | 85 FILE* fopen_internal(const char* fname, const char* mode) { |
86 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
87 return _wfopen(UTF8ToUTF16(fname).c_str(), ASCIIToUTF16(mode).c_str()); | 87 return _wfopen(base::UTF8ToUTF16(fname).c_str(), |
| 88 base::ASCIIToUTF16(mode).c_str()); |
88 #else | 89 #else |
89 return fopen(fname, mode); | 90 return fopen(fname, mode); |
90 #endif | 91 #endif |
91 } | 92 } |
92 | 93 |
93 base::FilePath CreateFilePath(const std::string& file_path) { | 94 base::FilePath CreateFilePath(const std::string& file_path) { |
94 #if defined(OS_WIN) | 95 #if defined(OS_WIN) |
95 return base::FilePath(UTF8ToUTF16(file_path)); | 96 return base::FilePath(base::UTF8ToUTF16(file_path)); |
96 #else | 97 #else |
97 return base::FilePath(file_path); | 98 return base::FilePath(file_path); |
98 #endif | 99 #endif |
99 } | 100 } |
100 | 101 |
101 static const base::FilePath::CharType kLevelDBTestDirectoryPrefix[] | 102 static const base::FilePath::CharType kLevelDBTestDirectoryPrefix[] |
102 = FILE_PATH_LITERAL("leveldb-test-"); | 103 = FILE_PATH_LITERAL("leveldb-test-"); |
103 | 104 |
104 const char* PlatformFileErrorString(const ::base::PlatformFileError& error) { | 105 const char* PlatformFileErrorString(const ::base::PlatformFileError& error) { |
105 switch (error) { | 106 switch (error) { |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } | 481 } |
481 | 482 |
482 bool IsCorruption(const leveldb::Status& status) { | 483 bool IsCorruption(const leveldb::Status& status) { |
483 // LevelDB returns InvalidArgument when an sst file is truncated but there is | 484 // LevelDB returns InvalidArgument when an sst file is truncated but there is |
484 // no IsInvalidArgument() accessor defined. | 485 // no IsInvalidArgument() accessor defined. |
485 return status.IsCorruption() || (!status.ok() && !IsIOError(status)); | 486 return status.IsCorruption() || (!status.ok() && !IsIOError(status)); |
486 } | 487 } |
487 | 488 |
488 std::string FilePathToString(const base::FilePath& file_path) { | 489 std::string FilePathToString(const base::FilePath& file_path) { |
489 #if defined(OS_WIN) | 490 #if defined(OS_WIN) |
490 return UTF16ToUTF8(file_path.value()); | 491 return base::UTF16ToUTF8(file_path.value()); |
491 #else | 492 #else |
492 return file_path.value(); | 493 return file_path.value(); |
493 #endif | 494 #endif |
494 } | 495 } |
495 | 496 |
496 ChromiumWritableFile::ChromiumWritableFile(const std::string& fname, | 497 ChromiumWritableFile::ChromiumWritableFile(const std::string& fname, |
497 FILE* f, | 498 FILE* f, |
498 const UMALogger* uma_logger, | 499 const UMALogger* uma_logger, |
499 WriteTracker* tracker, | 500 WriteTracker* tracker, |
500 bool make_backup) | 501 bool make_backup) |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 Env* IDBEnv() { | 1209 Env* IDBEnv() { |
1209 return leveldb_env::idb_env.Pointer(); | 1210 return leveldb_env::idb_env.Pointer(); |
1210 } | 1211 } |
1211 | 1212 |
1212 Env* Env::Default() { | 1213 Env* Env::Default() { |
1213 return leveldb_env::default_env.Pointer(); | 1214 return leveldb_env::default_env.Pointer(); |
1214 } | 1215 } |
1215 | 1216 |
1216 } // namespace leveldb | 1217 } // namespace leveldb |
1217 | 1218 |
OLD | NEW |