From 6aea4b84618e6f6c75c547779365e3421ba37976 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 5 May 2017 02:49:42 +0300 Subject: Rename virtfsfunc int fsfunc. --- src/CMakeLists.txt | 4 +- src/Makefile.am | 2 +- src/fs/virtfs/direntry.cpp | 2 +- src/fs/virtfs/direntry.h | 2 +- src/fs/virtfs/file.cpp | 4 +- src/fs/virtfs/file.h | 8 +-- src/fs/virtfs/fsentry.cpp | 2 +- src/fs/virtfs/fsentry.h | 6 +- src/fs/virtfs/fsfuncs.h | 136 +++++++++++++++++++++++++++++++++++++++++ src/fs/virtfs/virtfs.cpp | 2 +- src/fs/virtfs/virtfsdir.cpp | 8 +-- src/fs/virtfs/virtfsdir.h | 6 +- src/fs/virtfs/virtfsfuncs.h | 136 ----------------------------------------- src/fs/virtfs/virtfsrwops.cpp | 2 +- src/fs/virtfs/virtfszip.cpp | 8 +-- src/fs/virtfs/virtfszip.h | 6 +- src/fs/virtfs/virtzipentry.cpp | 2 +- src/fs/virtfs/virtzipentry.h | 2 +- 18 files changed, 169 insertions(+), 169 deletions(-) create mode 100644 src/fs/virtfs/fsfuncs.h delete mode 100644 src/fs/virtfs/virtfsfuncs.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fdd390b5f..def79d5a9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -890,7 +890,7 @@ SET(SRCS fs/paths.h utils/perfomance.cpp utils/perfomance.h - fs/virtfs/virtfsfuncs.h + fs/virtfs/fsfuncs.h fs/virtfs/virtfsrwops.cpp fs/virtfs/virtfsrwops.h fs/virtfs/virtfstools.cpp @@ -1799,7 +1799,7 @@ SET(DYE_CMD_SRCS fs/paths.h utils/perfomance.cpp utils/perfomance.h - fs/virtfs/virtfsfuncs.h + fs/virtfs/fsfuncs.h fs/virtfs/virtfsrwops.cpp fs/virtfs/virtfsrwops.h fs/virtfs/virtfstools.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 5f5f1ce80..706bee1b0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -578,7 +578,7 @@ BASE_SRC += events/actionevent.h \ fs/paths.h \ utils/perfomance.cpp \ utils/perfomance.h \ - fs/virtfs/virtfsfuncs.h \ + fs/virtfs/fsfuncs.h \ fs/virtfs/virtfsrwops.cpp \ fs/virtfs/virtfsrwops.h \ fs/virtfs/virtfstools.cpp \ diff --git a/src/fs/virtfs/direntry.cpp b/src/fs/virtfs/direntry.cpp index 618d3675d..2e82182ce 100644 --- a/src/fs/virtfs/direntry.cpp +++ b/src/fs/virtfs/direntry.cpp @@ -27,7 +27,7 @@ namespace VirtFs DirEntry::DirEntry(const std::string &userDir0, const std::string &rootDir, - VirtFsFuncs *restrict const funcs0) : + FsFuncs *restrict const funcs0) : FsEntry(FsEntryType::Dir, funcs0), userDir(userDir0) { diff --git a/src/fs/virtfs/direntry.h b/src/fs/virtfs/direntry.h index c803093c1..7eac95a0a 100644 --- a/src/fs/virtfs/direntry.h +++ b/src/fs/virtfs/direntry.h @@ -32,7 +32,7 @@ struct DirEntry final : public FsEntry { DirEntry(const std::string &userDir, const std::string &rootDir, - VirtFsFuncs *restrict const funcs); + FsFuncs *restrict const funcs); A_DELETE_COPY(DirEntry) diff --git a/src/fs/virtfs/file.cpp b/src/fs/virtfs/file.cpp index f7b3c7796..fb7fcee11 100644 --- a/src/fs/virtfs/file.cpp +++ b/src/fs/virtfs/file.cpp @@ -25,7 +25,7 @@ namespace VirtFs { -File::File(const VirtFsFuncs *restrict const funcs0, +File::File(const FsFuncs *restrict const funcs0, const uint8_t *restrict const buf, const size_t sz) : funcs(funcs0), @@ -36,7 +36,7 @@ File::File(const VirtFsFuncs *restrict const funcs0, { } -File::File(const VirtFsFuncs *restrict const funcs0, +File::File(const FsFuncs *restrict const funcs0, FILEHTYPE fd) : funcs(funcs0), mBuf(nullptr), diff --git a/src/fs/virtfs/file.h b/src/fs/virtfs/file.h index 33ce959df..c564bade4 100644 --- a/src/fs/virtfs/file.h +++ b/src/fs/virtfs/file.h @@ -28,22 +28,22 @@ namespace VirtFs { -struct VirtFsFuncs; +struct FsFuncs; struct File final { - File(const VirtFsFuncs *restrict const funcs0, + File(const FsFuncs *restrict const funcs0, const uint8_t *restrict const buf, const size_t sz); - File(const VirtFsFuncs *restrict const funcs0, + File(const FsFuncs *restrict const funcs0, FILEHTYPE fd); A_DELETE_COPY(File) ~File(); - const VirtFsFuncs *funcs; + const FsFuncs *funcs; // zipfs fields const uint8_t *mBuf; diff --git a/src/fs/virtfs/fsentry.cpp b/src/fs/virtfs/fsentry.cpp index 10d84415b..b1e9ebdc3 100644 --- a/src/fs/virtfs/fsentry.cpp +++ b/src/fs/virtfs/fsentry.cpp @@ -26,7 +26,7 @@ namespace VirtFs { FsEntry::FsEntry(const FsEntryTypeT &type0, - VirtFsFuncs *restrict const funcs0) : + FsFuncs *restrict const funcs0) : root(), type(type0), funcs(funcs0) diff --git a/src/fs/virtfs/fsentry.h b/src/fs/virtfs/fsentry.h index 4cadd92e5..9f6baa239 100644 --- a/src/fs/virtfs/fsentry.h +++ b/src/fs/virtfs/fsentry.h @@ -30,12 +30,12 @@ namespace VirtFs { -struct VirtFsFuncs; +struct FsFuncs; struct FsEntry notfinal { FsEntry(const FsEntryTypeT &type0, - VirtFsFuncs *restrict const funcs); + FsFuncs *restrict const funcs); A_DELETE_COPY(FsEntry) @@ -45,7 +45,7 @@ struct FsEntry notfinal FsEntryTypeT type; - VirtFsFuncs *funcs; + FsFuncs *funcs; }; } // namespace VirtFs diff --git a/src/fs/virtfs/fsfuncs.h b/src/fs/virtfs/fsfuncs.h new file mode 100644 index 000000000..e9a79562c --- /dev/null +++ b/src/fs/virtfs/fsfuncs.h @@ -0,0 +1,136 @@ +/* + * The ManaPlus Client + * Copyright (C) 2013-2017 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef UTILS_VIRTFSFUNCS_H +#define UTILS_VIRTFSFUNCS_H + +#include "fs/virtfs/rwopstypes.h" + +#include "utils/stringvector.h" + +#include "localconsts.h" + +struct SDL_RWops; + +namespace VirtFs +{ + +struct File; +struct FsEntry; + +struct FsFuncs final +{ + FsFuncs() : + close(nullptr), + read(nullptr), + write(nullptr), + fileLength(nullptr), + tell(nullptr), + seek(nullptr), + exists(nullptr), + getRealDir(nullptr), + enumerate(nullptr), + getFiles(nullptr), + getFilesWithDir(nullptr), + getDirs(nullptr), + isDirectory(nullptr), + openRead(nullptr), + openWrite(nullptr), + openAppend(nullptr), + eof(nullptr), + loadFile(nullptr), + rwops_seek(nullptr), + rwops_read(nullptr), + rwops_write(nullptr), +#ifdef USE_SDL2 + rwops_size(nullptr), +#endif // USE_SDL2 + rwops_close(nullptr) + { + } + + A_DELETE_COPY(FsFuncs) + + 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) (File *restrict const file, + const void *restrict const buffer, + const uint32_t objSize, + const uint32_t objCount); + 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) (FsEntry *restrict const entry, + const std::string &filename, + const std::string &dirName); + bool (*getRealDir) (FsEntry *restrict const entry, + const std::string &filename, + const std::string &dirName, + std::string &realDir); + void (*enumerate) (FsEntry *restrict const entry, + const std::string &dirName, + StringVect &names); + void (*getFiles) (FsEntry *restrict const entry, + const std::string &dirName, + StringVect &names); + void (*getFilesWithDir) (FsEntry *restrict const entry, + const std::string &dirName, + StringVect &names); + void (*getDirs) (FsEntry *restrict const entry, + const std::string &dirName, + StringVect &names); + bool (*isDirectory) (FsEntry *restrict const entry, + const std::string &dirName, + bool &isDirFlag); + File *(*openRead) (FsEntry *restrict const entry, + const std::string &filename); + File *(*openWrite) (FsEntry *restrict const entry, + const std::string &filename); + File *(*openAppend) (FsEntry *restrict const entry, + const std::string &filename); + int (*eof) (File *restrict const file); + const char *(*loadFile) (FsEntry *restrict const entry, + const std::string &restrict fileName, + int &restrict fileSize); + + RWOPSINT (*rwops_seek) (SDL_RWops *const rw, + const RWOPSINT offset, + const int whence); + RWOPSSIZE (*rwops_read) (SDL_RWops *const rw, + void *const ptr, + const RWOPSSIZE size, + const RWOPSSIZE maxnum); + RWOPSSIZE (*rwops_write) (SDL_RWops *const rw, + const void *const ptr, + const RWOPSSIZE size, + const RWOPSSIZE num); +#ifdef USE_SDL2 + RWOPSINT (*rwops_size) (SDL_RWops *const rw); +#endif // USE_SDL2 + int (*rwops_close) (SDL_RWops *const rw); +}; + +} // namespace VirtFs + +#endif // UTILS_VIRTFSFUNCS_H diff --git a/src/fs/virtfs/virtfs.cpp b/src/fs/virtfs/virtfs.cpp index fae3bc908..67b01ff3a 100644 --- a/src/fs/virtfs/virtfs.cpp +++ b/src/fs/virtfs/virtfs.cpp @@ -26,7 +26,7 @@ #include "fs/virtfs/direntry.h" #include "fs/virtfs/file.h" #include "fs/virtfs/virtfsdir.h" -#include "fs/virtfs/virtfsfuncs.h" +#include "fs/virtfs/fsfuncs.h" #include "fs/virtfs/virtfszip.h" #include "fs/virtfs/virtlist.h" #include "fs/virtfs/virtzipentry.h" diff --git a/src/fs/virtfs/virtfsdir.cpp b/src/fs/virtfs/virtfsdir.cpp index 0f94e3fa0..f3ef04b9c 100644 --- a/src/fs/virtfs/virtfsdir.cpp +++ b/src/fs/virtfs/virtfsdir.cpp @@ -27,7 +27,7 @@ #include "fs/virtfs/direntry.h" #include "fs/virtfs/file.h" #include "fs/virtfs/virtfsdirrwops.h" -#include "fs/virtfs/virtfsfuncs.h" +#include "fs/virtfs/fsfuncs.h" #include "fs/virtfs/virtlist.h" #include "utils/checkutils.h" @@ -56,7 +56,7 @@ namespace std::string mBaseDir; std::string mUserDir; bool mPermitLinks = false; - VirtFsFuncs funcs; + FsFuncs funcs; } // namespace namespace VirtFsDir @@ -123,7 +123,7 @@ namespace VirtFsDir initFuncs(&funcs); } - void initFuncs(VirtFsFuncs *restrict const ptr) + void initFuncs(FsFuncs *restrict const ptr) { ptr->close = &VirtFsDir::close; ptr->read = &VirtFsDir::read; @@ -152,7 +152,7 @@ namespace VirtFsDir #endif // USE_SDL2 } - VirtFsFuncs *getFuncs() + FsFuncs *getFuncs() { return &funcs; } diff --git a/src/fs/virtfs/virtfsdir.h b/src/fs/virtfs/virtfsdir.h index e0379e06d..509b843d4 100644 --- a/src/fs/virtfs/virtfsdir.h +++ b/src/fs/virtfs/virtfsdir.h @@ -32,7 +32,7 @@ namespace VirtFs struct File; struct FsEntry; -struct VirtFsFuncs; +struct FsFuncs; struct VirtList; namespace VirtFsDir @@ -48,9 +48,9 @@ namespace VirtFsDir const std::string &filename); const char *getBaseDir(); const char *getUserDir(); - VirtFsFuncs *getFuncs(); + FsFuncs *getFuncs(); void init(const std::string &restrict name); - void initFuncs(VirtFsFuncs *restrict const ptr); + void initFuncs(FsFuncs *restrict const ptr); void deinit(); bool exists(FsEntry *restrict const entry, const std::string &fileName, diff --git a/src/fs/virtfs/virtfsfuncs.h b/src/fs/virtfs/virtfsfuncs.h deleted file mode 100644 index 70f9882ab..000000000 --- a/src/fs/virtfs/virtfsfuncs.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef UTILS_VIRTFSFUNCS_H -#define UTILS_VIRTFSFUNCS_H - -#include "fs/virtfs/rwopstypes.h" - -#include "utils/stringvector.h" - -#include "localconsts.h" - -struct SDL_RWops; - -namespace VirtFs -{ - -struct File; -struct FsEntry; - -struct VirtFsFuncs final -{ - VirtFsFuncs() : - close(nullptr), - read(nullptr), - write(nullptr), - fileLength(nullptr), - tell(nullptr), - seek(nullptr), - exists(nullptr), - getRealDir(nullptr), - enumerate(nullptr), - getFiles(nullptr), - getFilesWithDir(nullptr), - getDirs(nullptr), - isDirectory(nullptr), - openRead(nullptr), - openWrite(nullptr), - openAppend(nullptr), - eof(nullptr), - loadFile(nullptr), - rwops_seek(nullptr), - rwops_read(nullptr), - rwops_write(nullptr), -#ifdef USE_SDL2 - rwops_size(nullptr), -#endif // USE_SDL2 - rwops_close(nullptr) - { - } - - A_DELETE_COPY(VirtFsFuncs) - - 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) (File *restrict const file, - const void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount); - 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) (FsEntry *restrict const entry, - const std::string &filename, - const std::string &dirName); - bool (*getRealDir) (FsEntry *restrict const entry, - const std::string &filename, - const std::string &dirName, - std::string &realDir); - void (*enumerate) (FsEntry *restrict const entry, - const std::string &dirName, - StringVect &names); - void (*getFiles) (FsEntry *restrict const entry, - const std::string &dirName, - StringVect &names); - void (*getFilesWithDir) (FsEntry *restrict const entry, - const std::string &dirName, - StringVect &names); - void (*getDirs) (FsEntry *restrict const entry, - const std::string &dirName, - StringVect &names); - bool (*isDirectory) (FsEntry *restrict const entry, - const std::string &dirName, - bool &isDirFlag); - File *(*openRead) (FsEntry *restrict const entry, - const std::string &filename); - File *(*openWrite) (FsEntry *restrict const entry, - const std::string &filename); - File *(*openAppend) (FsEntry *restrict const entry, - const std::string &filename); - int (*eof) (File *restrict const file); - const char *(*loadFile) (FsEntry *restrict const entry, - const std::string &restrict fileName, - int &restrict fileSize); - - RWOPSINT (*rwops_seek) (SDL_RWops *const rw, - const RWOPSINT offset, - const int whence); - RWOPSSIZE (*rwops_read) (SDL_RWops *const rw, - void *const ptr, - const RWOPSSIZE size, - const RWOPSSIZE maxnum); - RWOPSSIZE (*rwops_write) (SDL_RWops *const rw, - const void *const ptr, - const RWOPSSIZE size, - const RWOPSSIZE num); -#ifdef USE_SDL2 - RWOPSINT (*rwops_size) (SDL_RWops *const rw); -#endif // USE_SDL2 - int (*rwops_close) (SDL_RWops *const rw); -}; - -} // namespace VirtFs - -#endif // UTILS_VIRTFSFUNCS_H diff --git a/src/fs/virtfs/virtfsrwops.cpp b/src/fs/virtfs/virtfsrwops.cpp index dfa6699bd..48a446928 100644 --- a/src/fs/virtfs/virtfsrwops.cpp +++ b/src/fs/virtfs/virtfsrwops.cpp @@ -48,7 +48,7 @@ #include "fs/virtfs/file.h" #include "fs/virtfs/virtfs.h" -#include "fs/virtfs/virtfsfuncs.h" +#include "fs/virtfs/fsfuncs.h" #include "utils/fuzzer.h" diff --git a/src/fs/virtfs/virtfszip.cpp b/src/fs/virtfs/virtfszip.cpp index fc7cbbd6b..5b3d60185 100644 --- a/src/fs/virtfs/virtfszip.cpp +++ b/src/fs/virtfs/virtfszip.cpp @@ -21,7 +21,7 @@ #include "fs/virtfs/virtfszip.h" #include "fs/virtfs/file.h" -#include "fs/virtfs/virtfsfuncs.h" +#include "fs/virtfs/fsfuncs.h" #include "fs/virtfs/virtfsziprwops.h" #include "fs/virtfs/virtlist.h" #include "fs/virtfs/virtzipentry.h" @@ -37,7 +37,7 @@ extern const char *dirSeparator; namespace { - VirtFs::VirtFsFuncs funcs; + VirtFs::FsFuncs funcs; } // namespace namespace VirtFs @@ -45,7 +45,7 @@ namespace VirtFs namespace VirtFsZip { - VirtFsFuncs *getFuncs() + FsFuncs *getFuncs() { return &funcs; } @@ -59,7 +59,7 @@ namespace VirtFsZip initFuncs(&funcs); } - void initFuncs(VirtFsFuncs *restrict const ptr) + void initFuncs(FsFuncs *restrict const ptr) { ptr->close = &VirtFsZip::close; ptr->read = &VirtFsZip::read; diff --git a/src/fs/virtfs/virtfszip.h b/src/fs/virtfs/virtfszip.h index bcf7a3697..60ecb3a8f 100644 --- a/src/fs/virtfs/virtfszip.h +++ b/src/fs/virtfs/virtfszip.h @@ -30,14 +30,14 @@ namespace VirtFs struct File; struct VirtList; -struct VirtFsFuncs; +struct FsFuncs; struct FsEntry; namespace VirtFsZip { - VirtFsFuncs *getFuncs(); + FsFuncs *getFuncs(); void init(); - void initFuncs(VirtFsFuncs *restrict const ptr); + void initFuncs(FsFuncs *restrict const ptr); void deinit(); bool exists(FsEntry *restrict const entry, const std::string &filename, diff --git a/src/fs/virtfs/virtzipentry.cpp b/src/fs/virtfs/virtzipentry.cpp index f84b3083e..938059c5d 100644 --- a/src/fs/virtfs/virtzipentry.cpp +++ b/src/fs/virtfs/virtzipentry.cpp @@ -30,7 +30,7 @@ namespace VirtFs { VirtZipEntry::VirtZipEntry(const std::string &restrict archiveName, - VirtFsFuncs *restrict const funcs0) : + FsFuncs *restrict const funcs0) : FsEntry(FsEntryType::Zip, funcs0), mHeaders(), mDirs() diff --git a/src/fs/virtfs/virtzipentry.h b/src/fs/virtfs/virtzipentry.h index 841fd7775..792434b45 100644 --- a/src/fs/virtfs/virtzipentry.h +++ b/src/fs/virtfs/virtzipentry.h @@ -35,7 +35,7 @@ struct ZipLocalHeader; struct VirtZipEntry final : public FsEntry { VirtZipEntry(const std::string &restrict archiveName, - VirtFsFuncs *restrict const funcs); + FsFuncs *restrict const funcs); A_DELETE_COPY(VirtZipEntry) -- cgit v1.2.3-70-g09d2