From 89e01603ee5e0eb4bb6b8d607c8b3c12d9750551 Mon Sep 17 00:00:00 2001 From: Yijia Zhang Date: Tue, 30 Jul 2024 16:54:06 -0700 Subject: [PATCH] Fix Android file and stat wrapper. Change-Id: I6f4e922c73d8a2fc32c9da0ab8e97a780cf635be --- starboard/android/shared/asset_manager.cc | 45 ++++++++++++++++++- starboard/android/shared/asset_manager.h | 2 +- starboard/android/shared/file_can_open.cc | 4 +- starboard/android/shared/file_close.cc | 4 +- starboard/android/shared/file_delete.cc | 4 +- starboard/android/shared/file_flush.cc | 4 +- starboard/android/shared/file_get_info.cc | 4 +- starboard/android/shared/file_open.cc | 4 +- starboard/android/shared/file_read.cc | 4 +- starboard/android/shared/file_seek.cc | 4 +- starboard/android/shared/file_truncate.cc | 4 +- starboard/android/shared/file_write.cc | 4 +- starboard/android/shared/posix_emu/file.cc | 2 +- starboard/android/shared/posix_emu/stat.cc | 18 ++++---- starboard/common/file_wrapper.cc | 1 - starboard/elf_loader/exported_symbols.cc | 12 ++++- starboard/file.h | 16 ++++--- starboard/nplb/file_can_open_test.cc | 4 +- starboard/nplb/file_close_test.cc | 4 +- starboard/nplb/file_delete_recursive_test.cc | 24 ++++------ starboard/nplb/file_delete_test.cc | 4 +- starboard/nplb/file_flush_test.cc | 4 +- starboard/nplb/file_get_info_test.cc | 4 +- .../nplb/file_mode_string_to_flags_test.cc | 4 +- starboard/nplb/file_open_test.cc | 4 +- starboard/nplb/file_read_test.cc | 4 +- starboard/nplb/file_read_write_all_test.cc | 4 +- starboard/nplb/file_seek_test.cc | 4 +- starboard/nplb/file_truncate_test.cc | 4 +- starboard/nplb/file_write_test.cc | 4 +- starboard/shared/posix/file_can_open.cc | 4 +- starboard/shared/posix/file_close.cc | 4 +- starboard/shared/posix/file_delete.cc | 4 +- starboard/shared/posix/file_flush.cc | 4 +- starboard/shared/posix/file_get_info.cc | 4 +- starboard/shared/posix/file_open.cc | 4 +- starboard/shared/posix/file_read.cc | 4 +- starboard/shared/posix/file_seek.cc | 4 +- starboard/shared/posix/file_truncate.cc | 4 +- starboard/shared/posix/file_write.cc | 4 +- .../starboard/file_mode_string_to_flags.cc | 4 +- starboard/shared/stub/file_can_open.cc | 4 +- starboard/shared/stub/file_close.cc | 4 +- starboard/shared/stub/file_delete.cc | 4 +- starboard/shared/stub/file_flush.cc | 4 +- starboard/shared/stub/file_get_info.cc | 4 +- starboard/shared/stub/file_open.cc | 4 +- starboard/shared/stub/file_read.cc | 4 +- starboard/shared/stub/file_seek.cc | 4 +- starboard/shared/stub/file_truncate.cc | 4 +- starboard/shared/stub/file_write.cc | 4 +- starboard/shared/win32/file_can_open.cc | 4 ++ starboard/shared/win32/file_close.cc | 4 ++ starboard/shared/win32/file_delete.cc | 4 ++ starboard/shared/win32/file_exists.cc | 3 +- starboard/shared/win32/file_flush.cc | 4 ++ starboard/shared/win32/file_get_info.cc | 4 ++ starboard/shared/win32/file_open.cc | 4 ++ starboard/shared/win32/file_read.cc | 4 ++ starboard/shared/win32/file_seek.cc | 4 ++ starboard/shared/win32/file_truncate.cc | 4 ++ starboard/shared/win32/file_write.cc | 4 ++ 62 files changed, 210 insertions(+), 125 deletions(-) diff --git a/starboard/android/shared/asset_manager.cc b/starboard/android/shared/asset_manager.cc index a386544390db..201b956e7ba6 100644 --- a/starboard/android/shared/asset_manager.cc +++ b/starboard/android/shared/asset_manager.cc @@ -15,6 +15,7 @@ #include "starboard/android/shared/asset_manager.h" #include +#include #include #include #include @@ -33,6 +34,44 @@ namespace starboard { namespace android { namespace shared { +namespace { + +// Returns the fallback for the given asset path, or an empty string if none. +// NOTE: While Cobalt now provides a mechanism for loading system fonts through +// SbSystemGetPath(), using the fallback logic within SbFileOpen() is +// still preferred for Android's fonts. The reason for this is that the +// Android OS actually allows fonts to be loaded from two locations: one +// that it provides; and one that the devices running its OS, which it +// calls vendors, can provide. Rather than including the full Android font +// package, vendors have the option of using a smaller Android font +// package and supplementing it with their own fonts. +// +// If Android were to use SbSystemGetPath() for its fonts, vendors would +// have no way of providing those supplemental fonts to Cobalt, which +// could result in a limited selection of fonts being available. By +// treating Android's fonts as Cobalt's fonts, Cobalt can still offer a +// straightforward mechanism for including vendor fonts via +// SbSystemGetPath(). +std::string FallbackPath(const std::string& path) { + // We don't package most font files in Cobalt content and fallback to the + // system font file of the same name. + const std::string fonts_xml("fonts.xml"); + const std::string system_fonts_dir("/system/fonts/"); + const std::string cobalt_fonts_dir("/cobalt/assets/fonts/"); + + // Fonts fallback to the system fonts. + if (path.compare(0, cobalt_fonts_dir.length(), cobalt_fonts_dir) == 0) { + std::string file_name = path.substr(cobalt_fonts_dir.length()); + // fonts.xml doesn't fallback. + if (file_name != fonts_xml) { + return system_fonts_dir + file_name; + } + } + return std::string(); +} + +} // namespace + // static SB_ONCE_INITIALIZE_FUNCTION(AssetManager, AssetManager::GetInstance); @@ -60,13 +99,17 @@ std::string AssetManager::TempFilepath(uint64_t internal_fd) const { return tmp_root_ + "/" + std::to_string(internal_fd); } -int AssetManager::Open(const char* path) { +int AssetManager::Open(const char* path, int oflag) { if (!path) { return -1; } AAsset* asset = OpenAndroidAsset(path); if (!asset) { + std::string fallback_path = FallbackPath(path); + if (!fallback_path.empty()) { + return open(fallback_path.c_str(), oflag); + } SB_LOG(WARNING) << "Asset path not found within package: " << path; return -1; } diff --git a/starboard/android/shared/asset_manager.h b/starboard/android/shared/asset_manager.h index 10f1a8b5d526..8be4cf8fe90d 100644 --- a/starboard/android/shared/asset_manager.h +++ b/starboard/android/shared/asset_manager.h @@ -29,7 +29,7 @@ namespace shared { class AssetManager { public: static AssetManager* GetInstance(); - int Open(const char* path); + int Open(const char* path, int oflag); int Close(int fd); bool IsAssetFd(int fd) const; diff --git a/starboard/android/shared/file_can_open.cc b/starboard/android/shared/file_can_open.cc index 708f58dd1ce0..3849cf96cb5a 100644 --- a/starboard/android/shared/file_can_open.cc +++ b/starboard/android/shared/file_can_open.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -45,4 +45,4 @@ bool SbFileCanOpen(const char* path, int flags) { return result; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/android/shared/file_close.cc b/starboard/android/shared/file_close.cc index 7691e8869b84..b44eeca4ae62 100644 --- a/starboard/android/shared/file_close.cc +++ b/starboard/android/shared/file_close.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -31,4 +31,4 @@ bool SbFileClose(SbFile file) { return ::starboard::shared::posix::impl::FileClose(file); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/android/shared/file_delete.cc b/starboard/android/shared/file_delete.cc index 04b70fd2a4bf..477b6ecc4bf0 100644 --- a/starboard/android/shared/file_delete.cc +++ b/starboard/android/shared/file_delete.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -23,4 +23,4 @@ bool SbFileDelete(const char* path) { return ::starboard::shared::posix::impl::FileDelete(path); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/android/shared/file_flush.cc b/starboard/android/shared/file_flush.cc index eafc12e9ce0b..7ab036bb0f5c 100644 --- a/starboard/android/shared/file_flush.cc +++ b/starboard/android/shared/file_flush.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -23,4 +23,4 @@ bool SbFileFlush(SbFile file) { return ::starboard::shared::posix::impl::FileFlush(file); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/android/shared/file_get_info.cc b/starboard/android/shared/file_get_info.cc index 74643998b9d5..c7979fbee19a 100644 --- a/starboard/android/shared/file_get_info.cc +++ b/starboard/android/shared/file_get_info.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -35,4 +35,4 @@ bool SbFileGetInfo(SbFile file, SbFileInfo* out_info) { return ::starboard::shared::posix::impl::FileGetInfo(file, out_info); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/android/shared/file_open.cc b/starboard/android/shared/file_open.cc index a8239cea1424..8102b58f32d8 100644 --- a/starboard/android/shared/file_open.cc +++ b/starboard/android/shared/file_open.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -107,4 +107,4 @@ SbFile SbFileOpen(const char* path, return kSbFileInvalid; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/android/shared/file_read.cc b/starboard/android/shared/file_read.cc index 3a99ca93f332..2d90d4f8d5b3 100644 --- a/starboard/android/shared/file_read.cc +++ b/starboard/android/shared/file_read.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -33,4 +33,4 @@ int SbFileRead(SbFile file, char* data, int size) { } } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/android/shared/file_seek.cc b/starboard/android/shared/file_seek.cc index 4da94081914b..e64f7fc5b6e9 100644 --- a/starboard/android/shared/file_seek.cc +++ b/starboard/android/shared/file_seek.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -29,4 +29,4 @@ int64_t SbFileSeek(SbFile file, SbFileWhence whence, int64_t offset) { } } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/android/shared/file_truncate.cc b/starboard/android/shared/file_truncate.cc index d017dd914248..fe96b632a924 100644 --- a/starboard/android/shared/file_truncate.cc +++ b/starboard/android/shared/file_truncate.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -23,4 +23,4 @@ bool SbFileTruncate(SbFile file, int64_t length) { return ::starboard::shared::posix::impl::FileTruncate(file, length); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/android/shared/file_write.cc b/starboard/android/shared/file_write.cc index 6f09a3dede85..e6c99cb85515 100644 --- a/starboard/android/shared/file_write.cc +++ b/starboard/android/shared/file_write.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -23,4 +23,4 @@ int SbFileWrite(SbFile file, const char* data, int size) { return ::starboard::shared::posix::impl::FileWrite(file, data, size); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/android/shared/posix_emu/file.cc b/starboard/android/shared/posix_emu/file.cc index d18ebefb3997..6f876e5856d9 100644 --- a/starboard/android/shared/posix_emu/file.cc +++ b/starboard/android/shared/posix_emu/file.cc @@ -55,7 +55,7 @@ int __wrap_open(const char* path, int oflag, ...) { return __real_open(path, oflag); } } - return AssetManager::GetInstance()->Open(path); + return AssetManager::GetInstance()->Open(path, oflag); } } // extern "C" diff --git a/starboard/android/shared/posix_emu/stat.cc b/starboard/android/shared/posix_emu/stat.cc index 7e0115f247c5..572fca2f2dbc 100644 --- a/starboard/android/shared/posix_emu/stat.cc +++ b/starboard/android/shared/posix_emu/stat.cc @@ -20,6 +20,7 @@ #include "starboard/android/shared/directory_internal.h" #include "starboard/android/shared/file_internal.h" +#include "starboard/common/log.h" #include "starboard/directory.h" using starboard::android::shared::IsAndroidAssetPath; @@ -51,22 +52,21 @@ int __wrap_stat(const char* path, struct stat* info) { } int file = open(path, O_RDONLY, S_IRUSR | S_IWUSR); - struct stat out_info; - if (file) { - bool result = !fstat(file, &out_info); + if (file >= 0) { + int result = fstat(file, info); close(file); - return 0; + return result; } // Values from SbFileGetPathInfo if (IsAndroidAssetPath(path)) { AAssetDir* asset_dir = OpenAndroidAssetDir(path); if (asset_dir) { - out_info.st_mode = S_IFDIR; - out_info.st_ctime = 0; - out_info.st_atime = 0; - out_info.st_mtime = 0; - out_info.st_size = 0; + info->st_mode = S_IFDIR; + info->st_ctime = 0; + info->st_atime = 0; + info->st_mtime = 0; + info->st_size = 0; AAssetDir_close(asset_dir); return 0; } diff --git a/starboard/common/file_wrapper.cc b/starboard/common/file_wrapper.cc index ed0d5f490422..62ee448a8602 100644 --- a/starboard/common/file_wrapper.cc +++ b/starboard/common/file_wrapper.cc @@ -93,7 +93,6 @@ int file_close(FilePtr file) { FilePtr file_open(const char* path, int mode) { FilePtr file = new FileStruct(); file->fd = open(path, mode, S_IRUSR | S_IWUSR); - SB_LOG(INFO) << "yyHERE IN FILE_OPEN, VALUE OF OPEN IS: " << file->fd << "\n"; return file; } diff --git a/starboard/elf_loader/exported_symbols.cc b/starboard/elf_loader/exported_symbols.cc index 1be83ebc0829..9d0232271d94 100644 --- a/starboard/elf_loader/exported_symbols.cc +++ b/starboard/elf_loader/exported_symbols.cc @@ -178,21 +178,29 @@ ExportedSymbols::ExportedSymbols() { REGISTER_SYMBOL(SbEventCancel); REGISTER_SYMBOL(SbEventSchedule); REGISTER_SYMBOL(SbFileAtomicReplace); -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 REGISTER_SYMBOL(SbFileCanOpen); REGISTER_SYMBOL(SbFileClose); REGISTER_SYMBOL(SbFileDelete); +#endif // SB_API_VERSION < 17 +#if SB_API_VERSION < 16 REGISTER_SYMBOL(SbFileExists); +#endif // SB_API_VERSION < 16 +#if SB_API_VERSION < 17 REGISTER_SYMBOL(SbFileFlush); REGISTER_SYMBOL(SbFileGetInfo); +#endif // SB_API_VERSION < 17 +#if SB_API_VERSION < 16 REGISTER_SYMBOL(SbFileGetPathInfo); +#endif // SB_API_VERSION < 16 +#if SB_API_VERSION < 17 REGISTER_SYMBOL(SbFileModeStringToFlags); REGISTER_SYMBOL(SbFileOpen); REGISTER_SYMBOL(SbFileRead); REGISTER_SYMBOL(SbFileSeek); REGISTER_SYMBOL(SbFileTruncate); REGISTER_SYMBOL(SbFileWrite); -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 REGISTER_SYMBOL(SbGetEglInterface); REGISTER_SYMBOL(SbGetGlesInterface); #if SB_API_VERSION < 16 diff --git a/starboard/file.h b/starboard/file.h index ddd53fa1b770..ead07597879a 100644 --- a/starboard/file.h +++ b/starboard/file.h @@ -127,7 +127,7 @@ static inline bool SbFileIsValid(SbFile file) { return file != kSbFileInvalid; } -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 // DEPRECATED with SB_API_VERSION 16 // @@ -160,7 +160,7 @@ SB_EXPORT SbFile SbFileOpen(const char* path, // |file|: The absolute path of the file to be closed. SB_EXPORT bool SbFileClose(SbFile file); -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 // Replaces the content of the file at |path| with |data|. Returns whether the // contents of the file were replaced. The replacement of the content is an @@ -173,7 +173,7 @@ SB_EXPORT bool SbFileAtomicReplace(const char* path, const char* data, int64_t data_size); -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 // DEPRECATED with SB_API_VERSION 16 // @@ -270,13 +270,17 @@ SB_EXPORT bool SbFileGetPathInfo(const char* path, SbFileInfo* out_info); // |path|: The absolute path of the file, symlink, or directory to be deleted. SB_EXPORT bool SbFileDelete(const char* path); +#endif // SB_API_VERSION < 17 + +#if SB_API_VERSION < 16 // Indicates whether a file or directory exists at |path|. // // |path|: The absolute path of the file or directory being checked. SB_EXPORT bool SbFileExists(const char* path); - #endif // SB_API_VERSION < 16 +#if SB_API_VERSION < 17 + // DEPRECATED with SB_API_VERSION 16 // // Indicates whether SbFileOpen() with the given |flags| is allowed for |path|. @@ -285,8 +289,6 @@ SB_EXPORT bool SbFileExists(const char* path); // |flags|: The flags that are being evaluated for the given |path|. SB_EXPORT bool SbFileCanOpen(const char* path, int flags); -#if SB_API_VERSION < 16 - // DEPRECATED with SB_API_VERSION 16 // // Converts an ISO |fopen()| mode string into flags that can be equivalently @@ -354,7 +356,7 @@ static inline int SbFileWriteAll(SbFile file, const char* data, int size) { return bytes_written ? bytes_written : rv; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 #ifdef __cplusplus } // extern "C" diff --git a/starboard/nplb/file_can_open_test.cc b/starboard/nplb/file_can_open_test.cc index f9c7f3c99c3f..93572606c15e 100644 --- a/starboard/nplb/file_can_open_test.cc +++ b/starboard/nplb/file_can_open_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include @@ -73,4 +73,4 @@ TEST(SbFileCanOpenTest, ExistingStaticContentFileSucceeds) { } // namespace nplb } // namespace starboard -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/nplb/file_close_test.cc b/starboard/nplb/file_close_test.cc index 425bdf6d534d..2a40d4274b36 100644 --- a/starboard/nplb/file_close_test.cc +++ b/starboard/nplb/file_close_test.cc @@ -14,7 +14,7 @@ // SbFileClose is partially tested in file_open_test.cc. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" #include "testing/gtest/include/gtest/gtest.h" @@ -32,4 +32,4 @@ TEST(SbFileCloseTest, CloseInvalidFails) { } // namespace nplb } // namespace starboard -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/nplb/file_delete_recursive_test.cc b/starboard/nplb/file_delete_recursive_test.cc index cbd07c7e1909..3ed6d0e69792 100644 --- a/starboard/nplb/file_delete_recursive_test.cc +++ b/starboard/nplb/file_delete_recursive_test.cc @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 - #include #include @@ -71,8 +69,7 @@ TEST(SbFileDeleteRecursiveTest, SunnyDayDeleteExistingPath) { EXPECT_TRUE(DirectoryExists(path.c_str())); } - SbFileError err = kSbFileOk; - SbFile file = kSbFileInvalid; + int file = -1; // Create files in our directory tree. for (size_t i = 0; i < kFileCount; ++i) { @@ -80,11 +77,10 @@ TEST(SbFileDeleteRecursiveTest, SunnyDayDeleteExistingPath) { EXPECT_FALSE(FileExists(path.c_str())); - file = SbFileOpen(path.c_str(), kSbFileCreateAlways | kSbFileWrite, NULL, - &err); + file = open(path.c_str(), O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR); - EXPECT_EQ(kSbFileOk, err); - EXPECT_TRUE(SbFileClose(file)); + EXPECT_TRUE(file >= 0); + EXPECT_EQ(close(file), 0); EXPECT_TRUE(FileExists(path.c_str())); } @@ -112,14 +108,12 @@ TEST(SbFileDeleteRecursiveTest, RainyDayDeleteFileIgnoresPreserveRoot) { EXPECT_FALSE(FileExists(path.c_str())); - SbFileError err = kSbFileOk; - SbFile file = kSbFileInvalid; + int file = -1; - file = - SbFileOpen(path.c_str(), kSbFileCreateAlways | kSbFileWrite, NULL, &err); + file = open(path.c_str(), O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR); - EXPECT_EQ(kSbFileOk, err); - EXPECT_TRUE(SbFileClose(file)); + EXPECT_TRUE(file >= 0); + EXPECT_EQ(close(file), 0); EXPECT_TRUE(FileExists(path.c_str())); EXPECT_TRUE(SbFileDeleteRecursive(path.c_str(), true)); EXPECT_FALSE(FileExists(path.c_str())); @@ -135,5 +129,3 @@ TEST(SbFileDeleteRecursiveTest, RainyDayNonExistentPathErrors) { } // namespace } // namespace nplb } // namespace starboard - -#endif // SB_API_VERSION < 16 diff --git a/starboard/nplb/file_delete_test.cc b/starboard/nplb/file_delete_test.cc index dc40610e2758..95052867700d 100644 --- a/starboard/nplb/file_delete_test.cc +++ b/starboard/nplb/file_delete_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include @@ -66,4 +66,4 @@ TEST(SbFileDeleteTest, RainyDayNonExistentFileErrors) { } // namespace nplb } // namespace starboard -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/nplb/file_flush_test.cc b/starboard/nplb/file_flush_test.cc index 92337b74928a..7b8b3143ccbd 100644 --- a/starboard/nplb/file_flush_test.cc +++ b/starboard/nplb/file_flush_test.cc @@ -14,7 +14,7 @@ // SbFileFlush is otherwise tested in SbFileWriteTest. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" #include "starboard/nplb/file_helpers.h" @@ -33,4 +33,4 @@ TEST(SbFileFlushTest, InvalidFileErrors) { } // namespace nplb } // namespace starboard -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/nplb/file_get_info_test.cc b/starboard/nplb/file_get_info_test.cc index 7fe609024676..2bfc5da8120a 100644 --- a/starboard/nplb/file_get_info_test.cc +++ b/starboard/nplb/file_get_info_test.cc @@ -14,7 +14,7 @@ // GetInfo is mostly tested in the course of other tests. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include @@ -90,4 +90,4 @@ TEST(SbFileGetInfoTest, WorksOnStaticContentFiles) { } // namespace nplb } // namespace starboard -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/nplb/file_mode_string_to_flags_test.cc b/starboard/nplb/file_mode_string_to_flags_test.cc index ed159ed413fd..9efdf3a2163e 100644 --- a/starboard/nplb/file_mode_string_to_flags_test.cc +++ b/starboard/nplb/file_mode_string_to_flags_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include @@ -62,4 +62,4 @@ TEST(SbFileModeStringToFlagsTest, Aah) { } // namespace nplb } // namespace starboard -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/nplb/file_open_test.cc b/starboard/nplb/file_open_test.cc index a711e6aa199a..4a99d746c886 100644 --- a/starboard/nplb/file_open_test.cc +++ b/starboard/nplb/file_open_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include @@ -168,4 +168,4 @@ TEST(SbFileOpenTest, OpenOnlyDoesNotOpenNonExistingStaticContentFile) { } // namespace nplb } // namespace starboard -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/nplb/file_read_test.cc b/starboard/nplb/file_read_test.cc index b6fe296a833c..7d4d4a0a0d4e 100644 --- a/starboard/nplb/file_read_test.cc +++ b/starboard/nplb/file_read_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include @@ -297,4 +297,4 @@ TYPED_TEST(SbFileReadTest, ReadStaticContent) { } // namespace nplb } // namespace starboard -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/nplb/file_read_write_all_test.cc b/starboard/nplb/file_read_write_all_test.cc index 881ad7273202..6dc621363818 100644 --- a/starboard/nplb/file_read_write_all_test.cc +++ b/starboard/nplb/file_read_write_all_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" #include "starboard/nplb/file_helpers.h" @@ -66,4 +66,4 @@ INSTANTIATE_TEST_CASE_P( } // namespace nplb } // namespace starboard -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/nplb/file_seek_test.cc b/starboard/nplb/file_seek_test.cc index a39e3a024865..35789796c1e0 100644 --- a/starboard/nplb/file_seek_test.cc +++ b/starboard/nplb/file_seek_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include @@ -238,4 +238,4 @@ TEST(SbFileSeekTest, FromBeginInStaticContentWorks) { } // namespace nplb } // namespace starboard -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/nplb/file_truncate_test.cc b/starboard/nplb/file_truncate_test.cc index fe7eb437e6f3..6a316d2d7694 100644 --- a/starboard/nplb/file_truncate_test.cc +++ b/starboard/nplb/file_truncate_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include @@ -118,4 +118,4 @@ TEST(SbFileTruncateTest, TruncateUpInSize) { } // namespace nplb } // namespace starboard -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/nplb/file_write_test.cc b/starboard/nplb/file_write_test.cc index 364f2e3d6581..6493a783bc30 100644 --- a/starboard/nplb/file_write_test.cc +++ b/starboard/nplb/file_write_test.cc @@ -15,7 +15,7 @@ // Writing is partially tested by some of the file helpers that create files for // the tests to operate on. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include @@ -170,4 +170,4 @@ TYPED_TEST(SbFileWriteTest, WriteZeroBytes) { } // namespace nplb } // namespace starboard -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/posix/file_can_open.cc b/starboard/shared/posix/file_can_open.cc index 04391989b8c2..896e5faf8b56 100644 --- a/starboard/shared/posix/file_can_open.cc +++ b/starboard/shared/posix/file_can_open.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/shared/posix/file_internal.h" @@ -22,4 +22,4 @@ bool SbFileCanOpen(const char* path, int flags) { return ::starboard::shared::posix::impl::FileCanOpen(path, flags); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/posix/file_close.cc b/starboard/shared/posix/file_close.cc index 0ea2983e1a1e..f9a6f5d638e6 100644 --- a/starboard/shared/posix/file_close.cc +++ b/starboard/shared/posix/file_close.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/shared/posix/file_internal.h" @@ -22,4 +22,4 @@ bool SbFileClose(SbFile file) { return ::starboard::shared::posix::impl::FileClose(file); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/posix/file_delete.cc b/starboard/shared/posix/file_delete.cc index 246cf940e3ec..3ad7ea095407 100644 --- a/starboard/shared/posix/file_delete.cc +++ b/starboard/shared/posix/file_delete.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/shared/posix/file_internal.h" @@ -22,4 +22,4 @@ bool SbFileDelete(const char* path) { return ::starboard::shared::posix::impl::FileDelete(path); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/posix/file_flush.cc b/starboard/shared/posix/file_flush.cc index 2c27255b7b5f..3f1a4c3c9751 100644 --- a/starboard/shared/posix/file_flush.cc +++ b/starboard/shared/posix/file_flush.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/shared/posix/file_internal.h" @@ -22,4 +22,4 @@ bool SbFileFlush(SbFile file) { return ::starboard::shared::posix::impl::FileFlush(file); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/posix/file_get_info.cc b/starboard/shared/posix/file_get_info.cc index 6085569c76fd..2443587bbce9 100644 --- a/starboard/shared/posix/file_get_info.cc +++ b/starboard/shared/posix/file_get_info.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/shared/posix/file_internal.h" @@ -22,4 +22,4 @@ bool SbFileGetInfo(SbFile file, SbFileInfo* out_info) { return ::starboard::shared::posix::impl::FileGetInfo(file, out_info); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/posix/file_open.cc b/starboard/shared/posix/file_open.cc index e4c547d399ff..56675c63fd7a 100644 --- a/starboard/shared/posix/file_open.cc +++ b/starboard/shared/posix/file_open.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/shared/posix/file_internal.h" @@ -26,4 +26,4 @@ SbFile SbFileOpen(const char* path, out_error); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/posix/file_read.cc b/starboard/shared/posix/file_read.cc index 68e7f6fab962..3721a8b9b500 100644 --- a/starboard/shared/posix/file_read.cc +++ b/starboard/shared/posix/file_read.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/shared/posix/file_internal.h" @@ -22,4 +22,4 @@ int SbFileRead(SbFile file, char* data, int size) { return ::starboard::shared::posix::impl::FileRead(file, data, size); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/posix/file_seek.cc b/starboard/shared/posix/file_seek.cc index 8be12c9192a8..ba6ba4ab47b9 100644 --- a/starboard/shared/posix/file_seek.cc +++ b/starboard/shared/posix/file_seek.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/shared/posix/file_internal.h" @@ -22,4 +22,4 @@ int64_t SbFileSeek(SbFile file, SbFileWhence whence, int64_t offset) { return ::starboard::shared::posix::impl::FileSeek(file, whence, offset); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/posix/file_truncate.cc b/starboard/shared/posix/file_truncate.cc index 264cc05a07eb..f119fb3d0f4d 100644 --- a/starboard/shared/posix/file_truncate.cc +++ b/starboard/shared/posix/file_truncate.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/shared/posix/file_internal.h" @@ -22,4 +22,4 @@ bool SbFileTruncate(SbFile file, int64_t length) { return ::starboard::shared::posix::impl::FileTruncate(file, length); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/posix/file_write.cc b/starboard/shared/posix/file_write.cc index 0a9a832a3172..118d183de2b6 100644 --- a/starboard/shared/posix/file_write.cc +++ b/starboard/shared/posix/file_write.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/shared/posix/file_internal.h" @@ -22,4 +22,4 @@ int SbFileWrite(SbFile file, const char* data, int size) { return ::starboard::shared::posix::impl::FileWrite(file, data, size); } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/starboard/file_mode_string_to_flags.cc b/starboard/shared/starboard/file_mode_string_to_flags.cc index 5105b86afd13..d6c217869a45 100644 --- a/starboard/shared/starboard/file_mode_string_to_flags.cc +++ b/starboard/shared/starboard/file_mode_string_to_flags.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/common/log.h" #include "starboard/common/string.h" @@ -67,4 +67,4 @@ int SbFileModeStringToFlags(const char* mode) { return flags; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/stub/file_can_open.cc b/starboard/shared/stub/file_can_open.cc index 0b05d9d153fb..132438067b99 100644 --- a/starboard/shared/stub/file_can_open.cc +++ b/starboard/shared/stub/file_can_open.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -20,4 +20,4 @@ bool SbFileCanOpen(const char* path, int flags) { return false; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/stub/file_close.cc b/starboard/shared/stub/file_close.cc index 4d73424eb017..768d28e26435 100644 --- a/starboard/shared/stub/file_close.cc +++ b/starboard/shared/stub/file_close.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -20,4 +20,4 @@ bool SbFileClose(SbFile file) { return false; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/stub/file_delete.cc b/starboard/shared/stub/file_delete.cc index 2ca408b893bf..298b5e0912bf 100644 --- a/starboard/shared/stub/file_delete.cc +++ b/starboard/shared/stub/file_delete.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -20,4 +20,4 @@ bool SbFileDelete(const char* path) { return false; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/stub/file_flush.cc b/starboard/shared/stub/file_flush.cc index 0d7f68661229..48268327c115 100644 --- a/starboard/shared/stub/file_flush.cc +++ b/starboard/shared/stub/file_flush.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -20,4 +20,4 @@ bool SbFileFlush(SbFile file) { return false; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/stub/file_get_info.cc b/starboard/shared/stub/file_get_info.cc index 80a30cbf415a..aa8d32f762f2 100644 --- a/starboard/shared/stub/file_get_info.cc +++ b/starboard/shared/stub/file_get_info.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -20,4 +20,4 @@ bool SbFileGetInfo(SbFile file, SbFileInfo* out_info) { return false; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/stub/file_open.cc b/starboard/shared/stub/file_open.cc index 8685f90554b5..084fbd7eb37b 100644 --- a/starboard/shared/stub/file_open.cc +++ b/starboard/shared/stub/file_open.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -23,4 +23,4 @@ SbFile SbFileOpen(const char* path, return kSbFileInvalid; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/stub/file_read.cc b/starboard/shared/stub/file_read.cc index 105b942813fa..8db62d342148 100644 --- a/starboard/shared/stub/file_read.cc +++ b/starboard/shared/stub/file_read.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -20,4 +20,4 @@ int SbFileRead(SbFile file, char* data, int size) { return 0; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/stub/file_seek.cc b/starboard/shared/stub/file_seek.cc index b5b8d327c45a..3655631fd497 100644 --- a/starboard/shared/stub/file_seek.cc +++ b/starboard/shared/stub/file_seek.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -20,4 +20,4 @@ int64_t SbFileSeek(SbFile file, SbFileWhence whence, int64_t offset) { return 0; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/stub/file_truncate.cc b/starboard/shared/stub/file_truncate.cc index bd65a0c8f603..21c63ca67f52 100644 --- a/starboard/shared/stub/file_truncate.cc +++ b/starboard/shared/stub/file_truncate.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -20,4 +20,4 @@ bool SbFileTruncate(SbFile file, int64_t length) { return false; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/stub/file_write.cc b/starboard/shared/stub/file_write.cc index f7956852de60..35e1314a784c 100644 --- a/starboard/shared/stub/file_write.cc +++ b/starboard/shared/stub/file_write.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if SB_API_VERSION < 16 +#if SB_API_VERSION < 17 #include "starboard/file.h" @@ -20,4 +20,4 @@ int SbFileWrite(SbFile file, const char* data, int size) { return 0; } -#endif // SB_API_VERSION < 16 +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/win32/file_can_open.cc b/starboard/shared/win32/file_can_open.cc index 8f830b250e3e..7744b103eec5 100644 --- a/starboard/shared/win32/file_can_open.cc +++ b/starboard/shared/win32/file_can_open.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#if SB_API_VERSION < 17 + #include "starboard/file.h" #include @@ -52,3 +54,5 @@ bool SbFileCanOpen(const char* path, int flags) { return can_open; } + +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/win32/file_close.cc b/starboard/shared/win32/file_close.cc index afd99ae3c9c5..fa47181459dc 100644 --- a/starboard/shared/win32/file_close.cc +++ b/starboard/shared/win32/file_close.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#if SB_API_VERSION < 17 + #include "starboard/file.h" #include @@ -36,3 +38,5 @@ bool SbFileClose(SbFile file) { return success; } + +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/win32/file_delete.cc b/starboard/shared/win32/file_delete.cc index 2d5aa0cba3bd..d20cd80ed217 100644 --- a/starboard/shared/win32/file_delete.cc +++ b/starboard/shared/win32/file_delete.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#if SB_API_VERSION < 17 + #include "starboard/file.h" #include @@ -37,3 +39,5 @@ bool SbFileDelete(const char* path) { return DeleteFileW(path_wstring.c_str()) || RemoveDirectoryW(path_wstring.c_str()); } + +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/win32/file_exists.cc b/starboard/shared/win32/file_exists.cc index 3072769ecbea..70093daf6e29 100644 --- a/starboard/shared/win32/file_exists.cc +++ b/starboard/shared/win32/file_exists.cc @@ -52,4 +52,5 @@ bool SbFileExists(const char* path) { return PathEndsWith(path_wstring, find_data.cFileName); } -#endif + +#endif // SB_API_VERSION < 16 diff --git a/starboard/shared/win32/file_flush.cc b/starboard/shared/win32/file_flush.cc index c42e69e5db98..ad566da0cc73 100644 --- a/starboard/shared/win32/file_flush.cc +++ b/starboard/shared/win32/file_flush.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#if SB_API_VERSION < 17 + #include "starboard/file.h" #include @@ -26,3 +28,5 @@ bool SbFileFlush(SbFile file) { return FlushFileBuffers(file->file_handle); } + +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/win32/file_get_info.cc b/starboard/shared/win32/file_get_info.cc index 6a3bff46d956..f4176e5b014f 100644 --- a/starboard/shared/win32/file_get_info.cc +++ b/starboard/shared/win32/file_get_info.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#if SB_API_VERSION < 17 + #include "starboard/file.h" #include @@ -56,3 +58,5 @@ bool SbFileGetInfo(SbFile file, SbFileInfo* out_info) { return true; } + +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/win32/file_open.cc b/starboard/shared/win32/file_open.cc index 2aa61824e32d..be8459b9921d 100644 --- a/starboard/shared/win32/file_open.cc +++ b/starboard/shared/win32/file_open.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#if SB_API_VERSION < 16 + #include "starboard/file.h" #include "starboard/shared/win32/file_internal.h" @@ -39,3 +41,5 @@ SbFile SbFileOpen(const char* path, return new SbFilePrivate(file_handle); } + +#endif // SB_API_VERSION < 16 diff --git a/starboard/shared/win32/file_read.cc b/starboard/shared/win32/file_read.cc index e0efce44825e..f8415ae71765 100644 --- a/starboard/shared/win32/file_read.cc +++ b/starboard/shared/win32/file_read.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#if SB_API_VERSION < 17 + #include "starboard/file.h" #include @@ -45,3 +47,5 @@ int SbFileRead(SbFile file, char* data, int size) { return number_bytes_read; } + +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/win32/file_seek.cc b/starboard/shared/win32/file_seek.cc index 640059430da7..117df70b36a7 100644 --- a/starboard/shared/win32/file_seek.cc +++ b/starboard/shared/win32/file_seek.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#if SB_API_VERSION < 17 + #include "starboard/file.h" #include @@ -36,3 +38,5 @@ int64_t SbFileSeek(SbFile file, SbFileWhence whence, int64_t offset) { return new_file_pointer.QuadPart; } + +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/win32/file_truncate.cc b/starboard/shared/win32/file_truncate.cc index 7e77ab97ca38..21fef69fa87e 100644 --- a/starboard/shared/win32/file_truncate.cc +++ b/starboard/shared/win32/file_truncate.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#if SB_API_VERSION < 17 + #include "starboard/file.h" #include @@ -100,3 +102,5 @@ bool SbFileTruncate(SbFile file, int64_t length) { return return_value; } + +#endif // SB_API_VERSION < 17 diff --git a/starboard/shared/win32/file_write.cc b/starboard/shared/win32/file_write.cc index 6e56f68f9ffc..b95460c8b0f6 100644 --- a/starboard/shared/win32/file_write.cc +++ b/starboard/shared/win32/file_write.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#if SB_API_VERSION < 17 + #include "starboard/file.h" #include @@ -40,3 +42,5 @@ int SbFileWrite(SbFile file, const char* data, int size) { return bytes_written; } + +#endif // SB_API_VERSION < 17