From 4c37700df953b84f1d6533e7be5a798869b64a57 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 5 May 2017 20:18:28 +0300 Subject: Rename virtzipentry into zipentry. --- src/CMakeLists.txt | 8 +++---- src/Makefile.am | 4 ++-- src/fs/virtfs/fs.cpp | 8 +++---- src/fs/virtfs/fszip.cpp | 20 ++++++++--------- src/fs/virtfs/virtzipentry.cpp | 46 -------------------------------------- src/fs/virtfs/virtzipentry.h | 50 ------------------------------------------ src/fs/virtfs/zip_unittest.cc | 18 +++++++-------- src/fs/virtfs/zipentry.cpp | 46 ++++++++++++++++++++++++++++++++++++++ src/fs/virtfs/zipentry.h | 50 ++++++++++++++++++++++++++++++++++++++++++ src/fs/virtfs/ziplocalheader.h | 4 ++-- src/fs/virtfs/zipreader.cpp | 4 ++-- src/fs/virtfs/zipreader.h | 4 ++-- 12 files changed, 131 insertions(+), 131 deletions(-) delete mode 100644 src/fs/virtfs/virtzipentry.cpp delete mode 100644 src/fs/virtfs/virtzipentry.h create mode 100644 src/fs/virtfs/zipentry.cpp create mode 100644 src/fs/virtfs/zipentry.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8ce7e9462..8f6c5f58a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -912,8 +912,8 @@ SET(SRCS fs/virtfs/fszip.h fs/virtfs/fsziprwops.cpp fs/virtfs/fsziprwops.h - fs/virtfs/virtzipentry.cpp - fs/virtfs/virtzipentry.h + fs/virtfs/zipentry.cpp + fs/virtfs/zipentry.h fs/virtfs/zipreader.cpp fs/virtfs/zipreader.h fs/virtfs/ziplocalheader.cpp @@ -1821,8 +1821,8 @@ SET(DYE_CMD_SRCS fs/virtfs/fszip.h fs/virtfs/fsziprwops.cpp fs/virtfs/fsziprwops.h - fs/virtfs/virtzipentry.cpp - fs/virtfs/virtzipentry.h + fs/virtfs/zipentry.cpp + fs/virtfs/zipentry.h fs/virtfs/zipreader.cpp fs/virtfs/zipreader.h fs/virtfs/ziplocalheader.cpp diff --git a/src/Makefile.am b/src/Makefile.am index e3ce6bc45..3165918dd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -860,8 +860,8 @@ BASE_SRC += events/actionevent.h \ fs/virtfs/fszip.h \ fs/virtfs/fsziprwops.cpp \ fs/virtfs/fsziprwops.h \ - fs/virtfs/virtzipentry.cpp \ - fs/virtfs/virtzipentry.h \ + fs/virtfs/zipentry.cpp \ + fs/virtfs/zipentry.h \ fs/virtfs/zipreader.cpp \ fs/virtfs/zipreader.h \ fs/virtfs/ziplocalheader.cpp \ diff --git a/src/fs/virtfs/fs.cpp b/src/fs/virtfs/fs.cpp index 4d73784dd..20c245dd9 100644 --- a/src/fs/virtfs/fs.cpp +++ b/src/fs/virtfs/fs.cpp @@ -29,7 +29,7 @@ #include "fs/virtfs/fsfuncs.h" #include "fs/virtfs/fszip.h" #include "fs/virtfs/list.h" -#include "fs/virtfs/virtzipentry.h" +#include "fs/virtfs/zipentry.h" #include "fs/virtfs/zipreader.h" #include "utils/checkutils.h" @@ -475,7 +475,7 @@ namespace VirtFs newDir.c_str()); return false; } - VirtZipEntry *const entry = new VirtZipEntry(newDir, + ZipEntry *const entry = new ZipEntry(newDir, FsZip::getFuncs()); if (ZipReader::readArchiveInfo(entry) == false) { @@ -502,7 +502,7 @@ namespace VirtFs if (entry->root == oldDir && entry->type == FsEntryType::Zip) { - VirtZipEntry *const zipEntry = static_cast( + ZipEntry *const zipEntry = static_cast( entry); logger->log("Remove virtual zip: " + oldDir); mEntries.erase(it); @@ -565,7 +565,7 @@ namespace VirtFs if (entry->type == FsEntryType::Dir) delete static_cast(entry); else if (entry->type == FsEntryType::Zip) - delete static_cast(entry); + delete static_cast(entry); else delete entry; } diff --git a/src/fs/virtfs/fszip.cpp b/src/fs/virtfs/fszip.cpp index c3e51cf45..eda5dd078 100644 --- a/src/fs/virtfs/fszip.cpp +++ b/src/fs/virtfs/fszip.cpp @@ -24,7 +24,7 @@ #include "fs/virtfs/fsfuncs.h" #include "fs/virtfs/fsziprwops.h" #include "fs/virtfs/list.h" -#include "fs/virtfs/virtzipentry.h" +#include "fs/virtfs/zipentry.h" #include "fs/virtfs/zipreader.h" #include "fs/virtfs/ziplocalheader.h" @@ -93,7 +93,7 @@ namespace FsZip const std::string &dirName, std::string &realDir) { - VirtZipEntry *const zipEntry = static_cast(entry); + ZipEntry *const zipEntry = static_cast(entry); FOR_EACH (std::vector::const_iterator, it2, zipEntry->mHeaders) @@ -121,7 +121,7 @@ namespace FsZip const std::string &filename, const std::string &dirName) { - VirtZipEntry *const zipEntry = static_cast(entry); + ZipEntry *const zipEntry = static_cast(entry); FOR_EACH (std::vector::const_iterator, it2, zipEntry->mHeaders) @@ -143,7 +143,7 @@ namespace FsZip const std::string &dirName, StringVect &names) { - VirtZipEntry *const zipEntry = static_cast(entry); + ZipEntry *const zipEntry = static_cast(entry); if (dirName == dirSeparator) { FOR_EACH (std::vector::const_iterator, @@ -203,7 +203,7 @@ namespace FsZip const std::string &dirName, StringVect &names) { - VirtZipEntry *const zipEntry = static_cast(entry); + ZipEntry *const zipEntry = static_cast(entry); if (dirName == dirSeparator) { FOR_EACH (std::vector::const_iterator, @@ -298,7 +298,7 @@ namespace FsZip const std::string &dirName, StringVect &names) { - VirtZipEntry *const zipEntry = static_cast(entry); + ZipEntry *const zipEntry = static_cast(entry); if (dirName == dirSeparator) { FOR_EACH (std::vector::const_iterator, @@ -393,7 +393,7 @@ namespace FsZip const std::string &dirName, StringVect &names) { - VirtZipEntry *const zipEntry = static_cast(entry); + ZipEntry *const zipEntry = static_cast(entry); if (dirName == dirSeparator) { FOR_EACH (std::vector::const_iterator, @@ -488,7 +488,7 @@ namespace FsZip const std::string &dirName, bool &isDirFlag) { - VirtZipEntry *const zipEntry = static_cast(entry); + ZipEntry *const zipEntry = static_cast(entry); FOR_EACH (std::vector::const_iterator, it2, zipEntry->mDirs) @@ -510,7 +510,7 @@ namespace FsZip File *openRead(FsEntry *restrict const entry, const std::string &filename) { - VirtZipEntry *const zipEntry = static_cast(entry); + ZipEntry *const zipEntry = static_cast(entry); FOR_EACH (std::vector::const_iterator, it2, zipEntry->mHeaders) @@ -640,7 +640,7 @@ namespace FsZip const std::string &restrict filename, int &restrict fileSize) { - VirtZipEntry *const zipEntry = static_cast(entry); + ZipEntry *const zipEntry = static_cast(entry); FOR_EACH (std::vector::const_iterator, it2, zipEntry->mHeaders) diff --git a/src/fs/virtfs/virtzipentry.cpp b/src/fs/virtfs/virtzipentry.cpp deleted file mode 100644 index 938059c5d..000000000 --- a/src/fs/virtfs/virtzipentry.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 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 . - */ - -#include "fs/virtfs/virtzipentry.h" - -#include "fs/virtfs/ziplocalheader.h" - -#include "utils/dtor.h" - -#include "debug.h" - -namespace VirtFs -{ - -VirtZipEntry::VirtZipEntry(const std::string &restrict archiveName, - FsFuncs *restrict const funcs0) : - FsEntry(FsEntryType::Zip, funcs0), - mHeaders(), - mDirs() -{ - root = archiveName; -} - -VirtZipEntry::~VirtZipEntry() -{ - delete_all(mHeaders); -} - -} // namespace VirtFs diff --git a/src/fs/virtfs/virtzipentry.h b/src/fs/virtfs/virtzipentry.h deleted file mode 100644 index 792434b45..000000000 --- a/src/fs/virtfs/virtzipentry.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 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_VIRTZIPENTRY_H -#define UTILS_VIRTZIPENTRY_H - -#include "fs/virtfs/fsentry.h" - -#include - -#include "localconsts.h" - -namespace VirtFs -{ - -struct ZipLocalHeader; - -struct VirtZipEntry final : public FsEntry -{ - VirtZipEntry(const std::string &restrict archiveName, - FsFuncs *restrict const funcs); - - A_DELETE_COPY(VirtZipEntry) - - ~VirtZipEntry(); - - std::vector mHeaders; - std::vector mDirs; -}; - -} // namespace VirtFs - -#endif // UTILS_VIRTZIPENTRY_H diff --git a/src/fs/virtfs/zip_unittest.cc b/src/fs/virtfs/zip_unittest.cc index 39aa17ae2..e0d468941 100644 --- a/src/fs/virtfs/zip_unittest.cc +++ b/src/fs/virtfs/zip_unittest.cc @@ -25,7 +25,7 @@ #include "fs/files.h" #include "fs/virtfs/fszip.h" -#include "fs/virtfs/virtzipentry.h" +#include "fs/virtfs/zipentry.h" #include "fs/virtfs/zipreader.h" #include "fs/virtfs/ziplocalheader.h" @@ -48,7 +48,7 @@ TEST_CASE("Zip readArchiveInfo") { name = prefix + "data/test/test.zip"; - VirtFs::VirtZipEntry *const entry = new VirtFs::VirtZipEntry(name, + VirtFs::ZipEntry *const entry = new VirtFs::ZipEntry(name, VirtFs::FsZip::getFuncs()); std::vector &headers = entry->mHeaders; @@ -69,7 +69,7 @@ TEST_CASE("Zip readArchiveInfo") { name = prefix + "data/test/test2.zip"; - VirtFs::VirtZipEntry *const entry = new VirtFs::VirtZipEntry(name, + VirtFs::ZipEntry *const entry = new VirtFs::ZipEntry(name, VirtFs::FsZip::getFuncs()); std::vector &headers = entry->mHeaders; @@ -131,7 +131,7 @@ TEST_CASE("Zip readArchiveInfo") { name = prefix + "data/test/test3.zip"; - VirtFs::VirtZipEntry *const entry = new VirtFs::VirtZipEntry(name, + VirtFs::ZipEntry *const entry = new VirtFs::ZipEntry(name, VirtFs::FsZip::getFuncs()); std::vector &headers = entry->mHeaders; @@ -152,7 +152,7 @@ TEST_CASE("Zip readArchiveInfo") { name = prefix + "data/test/test4.zip"; - VirtFs::VirtZipEntry *const entry = new VirtFs::VirtZipEntry(name, + VirtFs::ZipEntry *const entry = new VirtFs::ZipEntry(name, VirtFs::FsZip::getFuncs()); std::vector &headers = entry->mHeaders; @@ -183,7 +183,7 @@ TEST_CASE("Zip readCompressedFile") { name = prefix + "data/test/test2.zip"; - VirtFs::VirtZipEntry *const entry = new VirtFs::VirtZipEntry(name, + VirtFs::ZipEntry *const entry = new VirtFs::ZipEntry(name, VirtFs::FsZip::getFuncs()); std::vector &headers = entry->mHeaders; @@ -217,7 +217,7 @@ TEST_CASE("Zip readFile") { name = prefix + "data/test/test.zip"; - VirtFs::VirtZipEntry *const entry = new VirtFs::VirtZipEntry(name, + VirtFs::ZipEntry *const entry = new VirtFs::ZipEntry(name, VirtFs::FsZip::getFuncs()); std::vector &headers = entry->mHeaders; @@ -241,7 +241,7 @@ TEST_CASE("Zip readFile") { name = prefix + "data/test/test2.zip"; - VirtFs::VirtZipEntry *const entry = new VirtFs::VirtZipEntry(name, + VirtFs::ZipEntry *const entry = new VirtFs::ZipEntry(name, VirtFs::FsZip::getFuncs()); std::vector &headers = entry->mHeaders; @@ -272,7 +272,7 @@ TEST_CASE("Zip readFile") { name = prefix + "data/test/test3.zip"; - VirtFs::VirtZipEntry *const entry = new VirtFs::VirtZipEntry(name, + VirtFs::ZipEntry *const entry = new VirtFs::ZipEntry(name, VirtFs::FsZip::getFuncs()); std::vector &headers = entry->mHeaders; diff --git a/src/fs/virtfs/zipentry.cpp b/src/fs/virtfs/zipentry.cpp new file mode 100644 index 000000000..e23055db9 --- /dev/null +++ b/src/fs/virtfs/zipentry.cpp @@ -0,0 +1,46 @@ +/* + * The ManaPlus Client + * Copyright (C) 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 . + */ + +#include "fs/virtfs/zipentry.h" + +#include "fs/virtfs/ziplocalheader.h" + +#include "utils/dtor.h" + +#include "debug.h" + +namespace VirtFs +{ + +ZipEntry::ZipEntry(const std::string &restrict archiveName, + FsFuncs *restrict const funcs0) : + FsEntry(FsEntryType::Zip, funcs0), + mHeaders(), + mDirs() +{ + root = archiveName; +} + +ZipEntry::~ZipEntry() +{ + delete_all(mHeaders); +} + +} // namespace VirtFs diff --git a/src/fs/virtfs/zipentry.h b/src/fs/virtfs/zipentry.h new file mode 100644 index 000000000..b8e2632b1 --- /dev/null +++ b/src/fs/virtfs/zipentry.h @@ -0,0 +1,50 @@ +/* + * The ManaPlus Client + * Copyright (C) 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_VIRTZIPENTRY_H +#define UTILS_VIRTZIPENTRY_H + +#include "fs/virtfs/fsentry.h" + +#include + +#include "localconsts.h" + +namespace VirtFs +{ + +struct ZipLocalHeader; + +struct ZipEntry final : public FsEntry +{ + ZipEntry(const std::string &restrict archiveName, + FsFuncs *restrict const funcs); + + A_DELETE_COPY(ZipEntry) + + ~ZipEntry(); + + std::vector mHeaders; + std::vector mDirs; +}; + +} // namespace VirtFs + +#endif // UTILS_VIRTZIPENTRY_H diff --git a/src/fs/virtfs/ziplocalheader.h b/src/fs/virtfs/ziplocalheader.h index c81d414bf..88bfc2458 100644 --- a/src/fs/virtfs/ziplocalheader.h +++ b/src/fs/virtfs/ziplocalheader.h @@ -28,7 +28,7 @@ namespace VirtFs { -struct VirtZipEntry; +struct ZipEntry; struct ZipLocalHeader final { @@ -37,7 +37,7 @@ struct ZipLocalHeader final A_DELETE_COPY(ZipLocalHeader) std::string fileName; - VirtZipEntry *zipEntry; + ZipEntry *zipEntry; uint32_t dataOffset; uint32_t compressSize; uint32_t uncompressSize; diff --git a/src/fs/virtfs/zipreader.cpp b/src/fs/virtfs/zipreader.cpp index 0c8bb9247..319528277 100644 --- a/src/fs/virtfs/zipreader.cpp +++ b/src/fs/virtfs/zipreader.cpp @@ -22,7 +22,7 @@ #include "fs/paths.h" -#include "fs/virtfs/virtzipentry.h" +#include "fs/virtfs/zipentry.h" #include "fs/virtfs/ziplocalheader.h" #include "utils/checkutils.h" @@ -70,7 +70,7 @@ namespace VirtFs namespace ZipReader { - bool readArchiveInfo(VirtZipEntry *const entry) + bool readArchiveInfo(ZipEntry *const entry) { if (entry == nullptr) { diff --git a/src/fs/virtfs/zipreader.h b/src/fs/virtfs/zipreader.h index d227315f1..cf7a85033 100644 --- a/src/fs/virtfs/zipreader.h +++ b/src/fs/virtfs/zipreader.h @@ -28,12 +28,12 @@ namespace VirtFs { -struct VirtZipEntry; +struct ZipEntry; struct ZipLocalHeader; namespace ZipReader { - bool readArchiveInfo(VirtZipEntry *const entry); + bool readArchiveInfo(ZipEntry *const entry); std::string getZlibError(const int err); void reportZlibError(const std::string &text, const int err); -- cgit v1.2.3-70-g09d2