diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-05 01:51:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-05 01:51:21 +0300 |
commit | 9d1c9937a9e24e6d1ed52dedca4852e57f8c21a0 (patch) | |
tree | 8a3356497ca1d8da1d4ba8ba0629aa1829111364 /src/fs/virtfs | |
parent | 7594ad94dfdf580a82fb07ddb346442160b3d91d (diff) | |
download | plus-9d1c9937a9e24e6d1ed52dedca4852e57f8c21a0.tar.gz plus-9d1c9937a9e24e6d1ed52dedca4852e57f8c21a0.tar.bz2 plus-9d1c9937a9e24e6d1ed52dedca4852e57f8c21a0.tar.xz plus-9d1c9937a9e24e6d1ed52dedca4852e57f8c21a0.zip |
Rename virtfile into file.
Diffstat (limited to 'src/fs/virtfs')
-rw-r--r-- | src/fs/virtfs/file.cpp (renamed from src/fs/virtfs/virtfile.cpp) | 14 | ||||
-rw-r--r-- | src/fs/virtfs/file.h (renamed from src/fs/virtfs/virtfile.h) | 16 | ||||
-rw-r--r-- | src/fs/virtfs/virtfs.cpp | 28 | ||||
-rw-r--r-- | src/fs/virtfs/virtfs.h | 22 | ||||
-rw-r--r-- | src/fs/virtfs/virtfs1_unittest.cc | 8 | ||||
-rw-r--r-- | src/fs/virtfs/virtfs_unittest.cc | 16 | ||||
-rw-r--r-- | src/fs/virtfs/virtfsdir.cpp | 36 | ||||
-rw-r--r-- | src/fs/virtfs/virtfsdir.h | 34 | ||||
-rw-r--r-- | src/fs/virtfs/virtfsdirrwops.cpp | 12 | ||||
-rw-r--r-- | src/fs/virtfs/virtfsfuncs.h | 26 | ||||
-rw-r--r-- | src/fs/virtfs/virtfsrwops.cpp | 4 | ||||
-rw-r--r-- | src/fs/virtfs/virtfsrwops.h | 4 | ||||
-rw-r--r-- | src/fs/virtfs/virtfszip.cpp | 30 | ||||
-rw-r--r-- | src/fs/virtfs/virtfszip.h | 30 | ||||
-rw-r--r-- | src/fs/virtfs/virtfsziprwops.cpp | 10 |
15 files changed, 145 insertions, 145 deletions
diff --git a/src/fs/virtfs/virtfile.cpp b/src/fs/virtfs/file.cpp index 2888e4557..f7b3c7796 100644 --- a/src/fs/virtfs/virtfile.cpp +++ b/src/fs/virtfs/file.cpp @@ -18,16 +18,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "fs/virtfs/virtfile.h" +#include "fs/virtfs/file.h" #include "debug.h" namespace VirtFs { -VirtFile::VirtFile(const VirtFsFuncs *restrict const funcs0, - const uint8_t *restrict const buf, - const size_t sz) : +File::File(const VirtFsFuncs *restrict const funcs0, + const uint8_t *restrict const buf, + const size_t sz) : funcs(funcs0), mBuf(buf), mPos(0U), @@ -36,8 +36,8 @@ VirtFile::VirtFile(const VirtFsFuncs *restrict const funcs0, { } -VirtFile::VirtFile(const VirtFsFuncs *restrict const funcs0, - FILEHTYPE fd) : +File::File(const VirtFsFuncs *restrict const funcs0, + FILEHTYPE fd) : funcs(funcs0), mBuf(nullptr), mPos(0U), @@ -46,7 +46,7 @@ VirtFile::VirtFile(const VirtFsFuncs *restrict const funcs0, { } -VirtFile::~VirtFile() +File::~File() { if (mFd != FILEHDEFAULT) FILECLOSE(mFd); diff --git a/src/fs/virtfs/virtfile.h b/src/fs/virtfs/file.h index b6cfca5c5..33ce959df 100644 --- a/src/fs/virtfs/virtfile.h +++ b/src/fs/virtfs/file.h @@ -30,18 +30,18 @@ namespace VirtFs struct VirtFsFuncs; -struct VirtFile final +struct File final { - VirtFile(const VirtFsFuncs *restrict const funcs0, - const uint8_t *restrict const buf, - const size_t sz); + File(const VirtFsFuncs *restrict const funcs0, + const uint8_t *restrict const buf, + const size_t sz); - VirtFile(const VirtFsFuncs *restrict const funcs0, - FILEHTYPE fd); + File(const VirtFsFuncs *restrict const funcs0, + FILEHTYPE fd); - A_DELETE_COPY(VirtFile) + A_DELETE_COPY(File) - ~VirtFile(); + ~File(); const VirtFsFuncs *funcs; diff --git a/src/fs/virtfs/virtfs.cpp b/src/fs/virtfs/virtfs.cpp index 301068233..3686b3606 100644 --- a/src/fs/virtfs/virtfs.cpp +++ b/src/fs/virtfs/virtfs.cpp @@ -24,7 +24,7 @@ #include "fs/paths.h" #include "fs/virtfs/virtdirentry.h" -#include "fs/virtfs/virtfile.h" +#include "fs/virtfs/file.h" #include "fs/virtfs/virtfsdir.h" #include "fs/virtfs/virtfsfuncs.h" #include "fs/virtfs/virtfszip.h" @@ -263,7 +263,7 @@ namespace VirtFs delete handle; } - VirtFile *openRead(std::string filename) + File *openRead(std::string filename) { prepareFsPath(filename); if (checkPath(filename) == false) @@ -275,14 +275,14 @@ namespace VirtFs FOR_EACH (std::vector<VirtFsEntry*>::const_iterator, it, mEntries) { VirtFsEntry *const entry = *it; - VirtFile *const file = entry->funcs->openRead(entry, filename); + File *const file = entry->funcs->openRead(entry, filename); if (file != nullptr) return file; } return nullptr; } - VirtFile *openWrite(std::string filename) + File *openWrite(std::string filename) { prepareFsPath(filename); if (checkPath(filename) == false) @@ -294,14 +294,14 @@ namespace VirtFs FOR_EACH (std::vector<VirtFsEntry*>::const_iterator, it, mEntries) { VirtFsEntry *const entry = *it; - VirtFile *const file = entry->funcs->openWrite(entry, filename); + File *const file = entry->funcs->openWrite(entry, filename); if (file != nullptr) return file; } return nullptr; } - VirtFile *openAppend(std::string filename) + File *openAppend(std::string filename) { prepareFsPath(filename); if (checkPath(filename) == false) @@ -313,7 +313,7 @@ namespace VirtFs FOR_EACH (std::vector<VirtFsEntry*>::const_iterator, it, mEntries) { VirtFsEntry *const entry = *it; - VirtFile *const file = entry->funcs->openAppend(entry, filename); + File *const file = entry->funcs->openAppend(entry, filename); if (file != nullptr) return file; } @@ -578,14 +578,14 @@ namespace VirtFs VirtFsDir::permitLinks(val); } - int close(VirtFile *restrict const file) + int close(File *restrict const file) { if (file == nullptr) return 0; return file->funcs->close(file); } - int64_t read(VirtFile *restrict const file, + int64_t read(File *restrict const file, void *restrict const buffer, const uint32_t objSize, const uint32_t objCount) @@ -596,7 +596,7 @@ namespace VirtFs objCount); } - int64_t write(VirtFile *restrict const file, + int64_t write(File *restrict const file, const void *restrict const buffer, const uint32_t objSize, const uint32_t objCount) @@ -607,24 +607,24 @@ namespace VirtFs objCount); } - int64_t fileLength(VirtFile *restrict const file) + int64_t fileLength(File *restrict const file) { return file->funcs->fileLength(file); } - int64_t tell(VirtFile *restrict const file) + int64_t tell(File *restrict const file) { return file->funcs->tell(file); } - int seek(VirtFile *restrict const file, + int seek(File *restrict const file, const uint64_t pos) { return file->funcs->seek(file, pos); } - int eof(VirtFile *restrict const file) + int eof(File *restrict const file) { return file->funcs->eof(file); } diff --git a/src/fs/virtfs/virtfs.h b/src/fs/virtfs/virtfs.h index b526a5f08..313017d7b 100644 --- a/src/fs/virtfs/virtfs.h +++ b/src/fs/virtfs/virtfs.h @@ -31,7 +31,7 @@ namespace VirtFs { - struct VirtFile; + struct File; struct VirtFsEntry; struct VirtList; @@ -45,9 +45,9 @@ namespace VirtFs bool isDirectory(std::string name); bool isSymbolicLink(const std::string &restrict name); void freeList(VirtList *restrict const handle); - VirtFile *openRead(std::string filename); - VirtFile *openWrite(std::string filename); - VirtFile *openAppend(std::string filename); + File *openRead(std::string filename); + File *openWrite(std::string filename); + File *openAppend(std::string filename); bool setWriteDir(const std::string &restrict newDir); bool mountDir(std::string newDir, const Append append); @@ -63,20 +63,20 @@ namespace VirtFs bool remove(const std::string &restrict filename); bool deinit(); void permitLinks(const bool val); - int64_t read(VirtFile *restrict const handle, + int64_t read(File *restrict const handle, void *restrict const buffer, const uint32_t objSize, const uint32_t objCount); - int64_t write(VirtFile *restrict const file, + int64_t write(File *restrict const file, const void *restrict const buffer, const uint32_t objSize, const uint32_t objCount); - int close(VirtFile *restrict const file); - int64_t fileLength(VirtFile *restrict const file); - int64_t tell(VirtFile *restrict const file); - int seek(VirtFile *restrict const file, + int close(File *restrict const file); + int64_t fileLength(File *restrict const file); + int64_t tell(File *restrict const file); + int seek(File *restrict const file, const uint64_t pos); - int eof(VirtFile *restrict const file); + int eof(File *restrict const file); bool mountDirInternal(const std::string &restrict newDir, const Append append); diff --git a/src/fs/virtfs/virtfs1_unittest.cc b/src/fs/virtfs/virtfs1_unittest.cc index d22336f44..882cda31a 100644 --- a/src/fs/virtfs/virtfs1_unittest.cc +++ b/src/fs/virtfs/virtfs1_unittest.cc @@ -1135,7 +1135,7 @@ TEST_CASE("VirtFs1 openRead1") VirtFs::mountDir(prefix + "data", Append_false); - VirtFs::VirtFile *file = nullptr; + VirtFs::File *file = nullptr; file = VirtFs::openRead("test/units.xml"); REQUIRE(file != nullptr); @@ -1199,7 +1199,7 @@ TEST_CASE("VirtFs1 openRead2") VirtFs::mountZip(prefix + "test2.zip", Append_false); - VirtFs::VirtFile *file = nullptr; + VirtFs::File *file = nullptr; file = VirtFs::openRead("dir2/units.xml"); REQUIRE(file != nullptr); @@ -1317,7 +1317,7 @@ TEST_CASE("VirtFs1 read1") VirtFs::mountDir(prefix + "data", Append_false); - VirtFs::VirtFile *file = VirtFs::openRead("test/test.txt"); + VirtFs::File *file = VirtFs::openRead("test/test.txt"); REQUIRE(file != nullptr); REQUIRE(VirtFs::fileLength(file) == 23); const int fileSize = VirtFs::fileLength(file); @@ -1358,7 +1358,7 @@ TEST_CASE("VirtFs1 read2") VirtFs::mountZip(prefix + "test2.zip", Append_false); - VirtFs::VirtFile *file = nullptr; + VirtFs::File *file = nullptr; void *restrict buffer = nullptr; SECTION("test 1") diff --git a/src/fs/virtfs/virtfs_unittest.cc b/src/fs/virtfs/virtfs_unittest.cc index cb9a7d4ad..2734e9ab2 100644 --- a/src/fs/virtfs/virtfs_unittest.cc +++ b/src/fs/virtfs/virtfs_unittest.cc @@ -476,7 +476,7 @@ TEST_CASE("VirtFs openRead1") VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); - VirtFs::VirtFile *file = nullptr; + VirtFs::File *file = nullptr; file = VirtFs::openRead("test/units.xml"); REQUIRE(file != nullptr); @@ -542,7 +542,7 @@ TEST_CASE("VirtFs openRead2") VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); - VirtFs::VirtFile *file = nullptr; + VirtFs::File *file = nullptr; file = VirtFs::openRead("test/units.xml"); REQUIRE(file == nullptr); @@ -571,7 +571,7 @@ TEST_CASE("VirtFs openRead3") VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); VirtFs::mountDir(prefix + "data/test", Append_false); - VirtFs::VirtFile *file = nullptr; + VirtFs::File *file = nullptr; file = VirtFs::openRead("test/units.xml"); REQUIRE(file == nullptr); @@ -755,7 +755,7 @@ TEST_CASE("VirtFs read1") VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); - VirtFs::VirtFile *file = VirtFs::openRead("test/test.txt"); + VirtFs::File *file = VirtFs::openRead("test/test.txt"); REQUIRE(file != nullptr); REQUIRE(VirtFs::fileLength(file) == 23); const int fileSize = VirtFs::fileLength(file); @@ -795,7 +795,7 @@ TEST_CASE("VirtFs read2") VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); - VirtFs::VirtFile *file = VirtFs::openRead("dir2/test.txt"); + VirtFs::File *file = VirtFs::openRead("dir2/test.txt"); REQUIRE(file != nullptr); REQUIRE(VirtFs::fileLength(file) == 23); const int fileSize = VirtFs::fileLength(file); @@ -835,7 +835,7 @@ TEST_CASE("VirtFs read3") VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); VirtFs::mountDir(prefix + "data", Append_false); - VirtFs::VirtFile *file = VirtFs::openRead("dir2/test.txt"); + VirtFs::File *file = VirtFs::openRead("dir2/test.txt"); REQUIRE(file != nullptr); REQUIRE(VirtFs::fileLength(file) == 23); const int fileSize = VirtFs::fileLength(file); @@ -876,7 +876,7 @@ TEST_CASE("VirtFs read4") VirtFs::mountDir(prefix + "data/test", Append_true); VirtFs::mountZip(prefix + "data/test/test5.zip", Append_true); - VirtFs::VirtFile *file = VirtFs::openRead("dir1/file1.txt"); + VirtFs::File *file = VirtFs::openRead("dir1/file1.txt"); REQUIRE(file != nullptr); REQUIRE(VirtFs::fileLength(file) == 23); const int fileSize = VirtFs::fileLength(file); @@ -917,7 +917,7 @@ TEST_CASE("VirtFs read5") VirtFs::mountZip(prefix + "data/test/test5.zip", Append_true); VirtFs::mountDir(prefix + "data/test", Append_true); - VirtFs::VirtFile *file = VirtFs::openRead("dir1/file1.txt"); + VirtFs::File *file = VirtFs::openRead("dir1/file1.txt"); REQUIRE(file != nullptr); REQUIRE(VirtFs::fileLength(file) == 23); const int fileSize = VirtFs::fileLength(file); diff --git a/src/fs/virtfs/virtfsdir.cpp b/src/fs/virtfs/virtfsdir.cpp index fce38b023..df0afbd05 100644 --- a/src/fs/virtfs/virtfsdir.cpp +++ b/src/fs/virtfs/virtfsdir.cpp @@ -25,7 +25,7 @@ #include "fs/paths.h" #include "fs/virtfs/virtdirentry.h" -#include "fs/virtfs/virtfile.h" +#include "fs/virtfs/file.h" #include "fs/virtfs/virtfsdirrwops.h" #include "fs/virtfs/virtfsfuncs.h" #include "fs/virtfs/virtlist.h" @@ -61,9 +61,9 @@ namespace namespace VirtFsDir { - VirtFile *openInternal(VirtFsEntry *restrict const entry, - const std::string &filename, - const FILEMTYPE mode) + File *openInternal(VirtFsEntry *restrict const entry, + const std::string &filename, + const FILEMTYPE mode) { const std::string path = entry->root + filename; if (Files::existsLocal(path) == false) @@ -76,24 +76,24 @@ namespace VirtFsDir filename.c_str()); return nullptr; } - VirtFile *restrict const file = new VirtFile(&funcs, fd); + File *restrict const file = new File(&funcs, fd); return file; } - VirtFile *openRead(VirtFsEntry *restrict const entry, - const std::string &filename) + File *openRead(VirtFsEntry *restrict const entry, + const std::string &filename) { return openInternal(entry, filename, FILEOPEN_FLAG_READ); } - VirtFile *openWrite(VirtFsEntry *restrict const entry, - const std::string &filename) + File *openWrite(VirtFsEntry *restrict const entry, + const std::string &filename) { return openInternal(entry, filename, FILEOPEN_FLAG_WRITE); } - VirtFile *openAppend(VirtFsEntry *restrict const entry, - const std::string &filename) + File *openAppend(VirtFsEntry *restrict const entry, + const std::string &filename) { return openInternal(entry, filename, FILEOPEN_FLAG_APPEND); } @@ -307,7 +307,7 @@ namespace VirtFsDir mPermitLinks = val; } - int close(VirtFile *restrict const file) + int close(File *restrict const file) { if (file == nullptr) return 0; @@ -315,7 +315,7 @@ namespace VirtFsDir return 1; } - int64_t read(VirtFile *restrict const file, + int64_t read(File *restrict const file, void *restrict const buffer, const uint32_t objSize, const uint32_t objCount) @@ -339,7 +339,7 @@ namespace VirtFsDir #endif // USE_FILE_FOPEN } - int64_t write(VirtFile *restrict const file, + int64_t write(File *restrict const file, const void *restrict const buffer, const uint32_t objSize, const uint32_t objCount) @@ -363,7 +363,7 @@ namespace VirtFsDir #endif // USE_FILE_FOPEN } - int64_t fileLength(VirtFile *restrict const file) + int64_t fileLength(File *restrict const file) { if (file == nullptr) return -1; @@ -390,7 +390,7 @@ namespace VirtFsDir #endif // USE_FILE_FOPEN } - int64_t tell(VirtFile *restrict const file) + int64_t tell(File *restrict const file) { if (file == nullptr) return -1; @@ -409,7 +409,7 @@ namespace VirtFsDir return pos; } - int seek(VirtFile *restrict const file, + int seek(File *restrict const file, const uint64_t pos) { if (file == nullptr) @@ -427,7 +427,7 @@ namespace VirtFsDir return 1; } - int eof(VirtFile *restrict const file) + int eof(File *restrict const file) { if (file == nullptr) return -1; diff --git a/src/fs/virtfs/virtfsdir.h b/src/fs/virtfs/virtfsdir.h index ec525d719..33736a7f0 100644 --- a/src/fs/virtfs/virtfsdir.h +++ b/src/fs/virtfs/virtfsdir.h @@ -30,22 +30,22 @@ namespace VirtFs { -struct VirtFile; +struct File; struct VirtFsEntry; struct VirtFsFuncs; struct VirtList; namespace VirtFsDir { - VirtFile *openInternal(VirtFsEntry *restrict const entry, - const std::string &filename, - const FILEMTYPE mode); - VirtFile *openRead(VirtFsEntry *restrict const entry, - const std::string &filename); - VirtFile *openWrite(VirtFsEntry *restrict const entry, - const std::string &filename); - VirtFile *openAppend(VirtFsEntry *restrict const entry, - const std::string &filename); + File *openInternal(VirtFsEntry *restrict const entry, + const std::string &filename, + const FILEMTYPE mode); + File *openRead(VirtFsEntry *restrict const entry, + const std::string &filename); + File *openWrite(VirtFsEntry *restrict const entry, + const std::string &filename); + File *openAppend(VirtFsEntry *restrict const entry, + const std::string &filename); const char *getBaseDir(); const char *getUserDir(); VirtFsFuncs *getFuncs(); @@ -80,20 +80,20 @@ namespace VirtFsDir bool mkdir(std::string dirName); bool remove(std::string filename); void permitLinks(const bool val); - int64_t read(VirtFile *restrict const handle, + int64_t read(File *restrict const handle, void *restrict const buffer, const uint32_t objSize, const uint32_t objCount); - int64_t write(VirtFile *restrict const file, + int64_t write(File *restrict const file, const void *restrict const buffer, const uint32_t objSize, const uint32_t objCount); - int close(VirtFile *restrict const file); - int64_t fileLength(VirtFile *restrict const file); - int64_t tell(VirtFile *restrict const file); - int seek(VirtFile *restrict const file, + int close(File *restrict const file); + int64_t fileLength(File *restrict const file); + int64_t tell(File *restrict const file); + int seek(File *restrict const file, const uint64_t pos); - int eof(VirtFile *restrict const file); + int eof(File *restrict const file); const char *loadFile(VirtFsEntry *restrict const entry, const std::string &restrict fileName, int &restrict fileSize); diff --git a/src/fs/virtfs/virtfsdirrwops.cpp b/src/fs/virtfs/virtfsdirrwops.cpp index 14cc69db8..692d107cd 100644 --- a/src/fs/virtfs/virtfsdirrwops.cpp +++ b/src/fs/virtfs/virtfsdirrwops.cpp @@ -22,7 +22,7 @@ #include "logger.h" -#include "fs/virtfs/virtfile.h" +#include "fs/virtfs/file.h" #include <SDL_rwops.h> @@ -39,7 +39,7 @@ namespace VirtFsDir { if (!rw) return -1; - VirtFile *const handle = static_cast<VirtFile *const>( + File *const handle = static_cast<File *const>( rw->hidden.unknown.data1); FILEHTYPE fd = handle->mFd; RWOPSINT pos = 0; @@ -151,7 +151,7 @@ namespace VirtFsDir { if (!rw) return 0; - VirtFile *const handle = static_cast<VirtFile *const>( + File *const handle = static_cast<File *const>( rw->hidden.unknown.data1); FILEHTYPE fd = handle->mFd; @@ -187,7 +187,7 @@ namespace VirtFsDir { if (!rw) return 0; - VirtFile *const handle = static_cast<VirtFile *const>( + File *const handle = static_cast<File *const>( rw->hidden.unknown.data1); FILEHTYPE fd = handle->mFd; @@ -220,7 +220,7 @@ namespace VirtFsDir { if (!rw) return 0; - VirtFile *const handle = static_cast<VirtFile*>( + File *const handle = static_cast<File*>( rw->hidden.unknown.data1); delete handle; SDL_FreeRW(rw); @@ -230,7 +230,7 @@ namespace VirtFsDir #ifdef USE_SDL2 RWOPSINT rwops_size(SDL_RWops *const rw) { - VirtFile *const handle = static_cast<VirtFile *const>( + File *const handle = static_cast<File *const>( rw->hidden.unknown.data1); FILEHTYPE fd = handle->mFd; #ifdef USE_FILE_FOPEN diff --git a/src/fs/virtfs/virtfsfuncs.h b/src/fs/virtfs/virtfsfuncs.h index e6213a6ce..bc74fa785 100644 --- a/src/fs/virtfs/virtfsfuncs.h +++ b/src/fs/virtfs/virtfsfuncs.h @@ -32,7 +32,7 @@ struct SDL_RWops; namespace VirtFs { -struct VirtFile; +struct File; struct VirtFsEntry; struct VirtFsFuncs final @@ -68,18 +68,18 @@ struct VirtFsFuncs final A_DELETE_COPY(VirtFsFuncs) - int (*close) (VirtFile *restrict const file); - int64_t (*read) (VirtFile *restrict const file, + int (*close) (File *restrict const file); + int64_t (*read) (File *restrict const file, void *restrict const buffer, const uint32_t objSize, const uint32_t objCount); - int64_t (*write) (VirtFile *restrict const file, + int64_t (*write) (File *restrict const file, const void *restrict const buffer, const uint32_t objSize, const uint32_t objCount); - int64_t (*fileLength) (VirtFile *restrict const file); - int64_t (*tell) (VirtFile *restrict const file); - int (*seek) (VirtFile *restrict const file, + int64_t (*fileLength) (File *restrict const file); + int64_t (*tell) (File *restrict const file); + int (*seek) (File *restrict const file, const uint64_t pos); bool (*exists) (VirtFsEntry *restrict const entry, const std::string &filename, @@ -103,13 +103,13 @@ struct VirtFsFuncs final bool (*isDirectory) (VirtFsEntry *restrict const entry, const std::string &dirName, bool &isDirFlag); - VirtFile *(*openRead) (VirtFsEntry *restrict const entry, + File *(*openRead) (VirtFsEntry *restrict const entry, + const std::string &filename); + File *(*openWrite) (VirtFsEntry *restrict const entry, + const std::string &filename); + File *(*openAppend) (VirtFsEntry *restrict const entry, const std::string &filename); - VirtFile *(*openWrite) (VirtFsEntry *restrict const entry, - const std::string &filename); - VirtFile *(*openAppend) (VirtFsEntry *restrict const entry, - const std::string &filename); - int (*eof) (VirtFile *restrict const file); + int (*eof) (File *restrict const file); const char *(*loadFile) (VirtFsEntry *restrict const entry, const std::string &restrict fileName, int &restrict fileSize); diff --git a/src/fs/virtfs/virtfsrwops.cpp b/src/fs/virtfs/virtfsrwops.cpp index ab13c3f4e..dfa6699bd 100644 --- a/src/fs/virtfs/virtfsrwops.cpp +++ b/src/fs/virtfs/virtfsrwops.cpp @@ -46,7 +46,7 @@ #include "logger.h" -#include "fs/virtfs/virtfile.h" +#include "fs/virtfs/file.h" #include "fs/virtfs/virtfs.h" #include "fs/virtfs/virtfsfuncs.h" @@ -59,7 +59,7 @@ namespace VirtFs { -SDL_RWops *create_rwops(VirtFile *const file) +SDL_RWops *create_rwops(File *const file) { SDL_RWops *retval = nullptr; diff --git a/src/fs/virtfs/virtfsrwops.h b/src/fs/virtfs/virtfsrwops.h index 7182a08c5..7be265ad2 100644 --- a/src/fs/virtfs/virtfsrwops.h +++ b/src/fs/virtfs/virtfsrwops.h @@ -53,9 +53,9 @@ struct SDL_RWops; namespace VirtFs { - struct VirtFile; + struct File; - SDL_RWops *create_rwops(VirtFile *const file); + SDL_RWops *create_rwops(File *const file); SDL_RWops *rwopsOpenRead(const std::string &restrict fname); SDL_RWops *rwopsOpenWrite(const std::string &restrict fname) A_WARN_UNUSED; diff --git a/src/fs/virtfs/virtfszip.cpp b/src/fs/virtfs/virtfszip.cpp index a3b477844..c1c8da676 100644 --- a/src/fs/virtfs/virtfszip.cpp +++ b/src/fs/virtfs/virtfszip.cpp @@ -20,7 +20,7 @@ #include "fs/virtfs/virtfszip.h" -#include "fs/virtfs/virtfile.h" +#include "fs/virtfs/file.h" #include "fs/virtfs/virtfsfuncs.h" #include "fs/virtfs/virtfsziprwops.h" #include "fs/virtfs/virtlist.h" @@ -507,8 +507,8 @@ namespace VirtFsZip delete handle; } - VirtFile *openRead(VirtFsEntry *restrict const entry, - const std::string &filename) + File *openRead(VirtFsEntry *restrict const entry, + const std::string &filename) { VirtZipEntry *const zipEntry = static_cast<VirtZipEntry*>(entry); FOR_EACH (std::vector<ZipLocalHeader*>::const_iterator, @@ -521,7 +521,7 @@ namespace VirtFsZip const uint8_t *restrict const buf = Zip::readFile(header); if (buf == nullptr) return nullptr; - VirtFile *restrict const file = new VirtFile(&funcs, + File *restrict const file = new File(&funcs, buf, header->uncompressSize); return file; @@ -530,21 +530,21 @@ namespace VirtFsZip return nullptr; } - VirtFile *openWrite(VirtFsEntry *restrict const entry A_UNUSED, - const std::string &filename A_UNUSED) + File *openWrite(VirtFsEntry *restrict const entry A_UNUSED, + const std::string &filename A_UNUSED) { reportAlways("VirtFs::openWrite for zip not implemented."); return nullptr; } - VirtFile *openAppend(VirtFsEntry *restrict const entry A_UNUSED, - const std::string &filename A_UNUSED) + File *openAppend(VirtFsEntry *restrict const entry A_UNUSED, + const std::string &filename A_UNUSED) { reportAlways("VirtFs::openAppend for zip not implemented."); return nullptr; } - int close(VirtFile *restrict const file) + int close(File *restrict const file) { if (file == nullptr) return 0; @@ -552,7 +552,7 @@ namespace VirtFsZip return 1; } - int64_t read(VirtFile *restrict const file, + int64_t read(File *restrict const file, void *restrict const buffer, const uint32_t objSize, const uint32_t objCount) @@ -591,7 +591,7 @@ namespace VirtFsZip return memCount; } - int64_t write(VirtFile *restrict const file A_UNUSED, + int64_t write(File *restrict const file A_UNUSED, const void *restrict const buffer A_UNUSED, const uint32_t objSize A_UNUSED, const uint32_t objCount A_UNUSED) @@ -599,7 +599,7 @@ namespace VirtFsZip return 0; } - int64_t fileLength(VirtFile *restrict const file) + int64_t fileLength(File *restrict const file) { if (file == nullptr) return -1; @@ -607,7 +607,7 @@ namespace VirtFsZip return file->mSize; } - int64_t tell(VirtFile *restrict const file) + int64_t tell(File *restrict const file) { if (file == nullptr) return -1; @@ -615,7 +615,7 @@ namespace VirtFsZip return file->mPos; } - int seek(VirtFile *restrict const file, + int seek(File *restrict const file, const uint64_t pos) { if (file == nullptr) @@ -627,7 +627,7 @@ namespace VirtFsZip return 1; } - int eof(VirtFile *restrict const file) + int eof(File *restrict const file) { if (file == nullptr) return -1; diff --git a/src/fs/virtfs/virtfszip.h b/src/fs/virtfs/virtfszip.h index 0dd8d1f82..fbae5a54e 100644 --- a/src/fs/virtfs/virtfszip.h +++ b/src/fs/virtfs/virtfszip.h @@ -28,7 +28,7 @@ namespace VirtFs { -struct VirtFile; +struct File; struct VirtList; struct VirtFsFuncs; struct VirtFsEntry; @@ -58,31 +58,31 @@ namespace VirtFsZip const std::string &dirName, bool &isDirFlag); void freeList(VirtList *restrict const handle); - VirtFile *openRead(VirtFsEntry *restrict const entry, - const std::string &filename); - VirtFile *openWrite(VirtFsEntry *restrict const entry, - const std::string &filename); - VirtFile *openAppend(VirtFsEntry *restrict const entry, - const std::string &filename); - VirtFile *openReadInternal(const std::string &filename); + File *openRead(VirtFsEntry *restrict const entry, + const std::string &filename); + File *openWrite(VirtFsEntry *restrict const entry, + const std::string &filename); + File *openAppend(VirtFsEntry *restrict const entry, + const std::string &filename); + File *openReadInternal(const std::string &filename); bool getRealDir(VirtFsEntry *restrict const entry, const std::string &filename, const std::string &dirName, std::string &realDir); - int64_t read(VirtFile *restrict const handle, + int64_t read(File *restrict const handle, void *restrict const buffer, const uint32_t objSize, const uint32_t objCount); - int64_t write(VirtFile *restrict const file, + int64_t write(File *restrict const file, const void *restrict const buffer, const uint32_t objSize, const uint32_t objCount); - int close(VirtFile *restrict const file); - int64_t fileLength(VirtFile *restrict const file); - int64_t tell(VirtFile *restrict const file); - int seek(VirtFile *restrict const file, + int close(File *restrict const file); + int64_t fileLength(File *restrict const file); + int64_t tell(File *restrict const file); + int seek(File *restrict const file, const uint64_t pos); - int eof(VirtFile *restrict const file); + int eof(File *restrict const file); const char *loadFile(VirtFsEntry *restrict const entry, const std::string &restrict fileName, int &restrict fileSize); diff --git a/src/fs/virtfs/virtfsziprwops.cpp b/src/fs/virtfs/virtfsziprwops.cpp index aecd3c5f5..5d21d70b0 100644 --- a/src/fs/virtfs/virtfsziprwops.cpp +++ b/src/fs/virtfs/virtfsziprwops.cpp @@ -22,7 +22,7 @@ #include "logger.h" -#include "fs/virtfs/virtfile.h" +#include "fs/virtfs/file.h" #include "fs/virtfs/virtfs.h" #include <SDL_rwops.h> @@ -40,7 +40,7 @@ namespace VirtFsZip { if (!rw) return -1; - VirtFile *const handle = static_cast<VirtFile *const>( + File *const handle = static_cast<File *const>( rw->hidden.unknown.data1); size_t mPos = handle->mPos; size_t mSize = handle->mSize; @@ -110,7 +110,7 @@ namespace VirtFsZip { if (!rw) return 0; - VirtFile *const handle = static_cast<VirtFile *const>( + File *const handle = static_cast<File *const>( rw->hidden.unknown.data1); const int64_t rc = VirtFs::read(handle, ptr, CAST_U32(size), @@ -130,7 +130,7 @@ namespace VirtFsZip { if (!rw) return 0; - VirtFile *const handle = static_cast<VirtFile*>( + File *const handle = static_cast<File*>( rw->hidden.unknown.data1); delete handle; SDL_FreeRW(rw); @@ -142,7 +142,7 @@ namespace VirtFsZip { if (!rw) return 0; - VirtFile *const handle = static_cast<VirtFile *const>( + File *const handle = static_cast<File *const>( rw->hidden.unknown.data1); return handle->mSize; } |