summaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/virtfs/virtfs.cpp4
-rw-r--r--src/fs/virtfs/virtfszip.cpp8
-rw-r--r--src/fs/virtfs/zip_unittest.cc32
-rw-r--r--src/fs/virtfs/zipreader.cpp (renamed from src/fs/virtfs/zip.cpp)8
-rw-r--r--src/fs/virtfs/zipreader.h (renamed from src/fs/virtfs/zip.h)4
5 files changed, 29 insertions, 27 deletions
diff --git a/src/fs/virtfs/virtfs.cpp b/src/fs/virtfs/virtfs.cpp
index 67b01ff3a..58dec670e 100644
--- a/src/fs/virtfs/virtfs.cpp
+++ b/src/fs/virtfs/virtfs.cpp
@@ -30,7 +30,7 @@
#include "fs/virtfs/virtfszip.h"
#include "fs/virtfs/virtlist.h"
#include "fs/virtfs/virtzipentry.h"
-#include "fs/virtfs/zip.h"
+#include "fs/virtfs/zipreader.h"
#include "utils/checkutils.h"
#include "utils/stringutils.h"
@@ -477,7 +477,7 @@ namespace VirtFs
}
VirtZipEntry *const entry = new VirtZipEntry(newDir,
VirtFsZip::getFuncs());
- if (Zip::readArchiveInfo(entry) == false)
+ if (ZipReader::readArchiveInfo(entry) == false)
{
delete entry;
return false;
diff --git a/src/fs/virtfs/virtfszip.cpp b/src/fs/virtfs/virtfszip.cpp
index 5b3d60185..0f58dd5f5 100644
--- a/src/fs/virtfs/virtfszip.cpp
+++ b/src/fs/virtfs/virtfszip.cpp
@@ -25,7 +25,7 @@
#include "fs/virtfs/virtfsziprwops.h"
#include "fs/virtfs/virtlist.h"
#include "fs/virtfs/virtzipentry.h"
-#include "fs/virtfs/zip.h"
+#include "fs/virtfs/zipreader.h"
#include "fs/virtfs/ziplocalheader.h"
#include "utils/checkutils.h"
@@ -518,7 +518,8 @@ namespace VirtFsZip
const ZipLocalHeader *restrict const header = *it2;
if (header->fileName == filename)
{
- const uint8_t *restrict const buf = Zip::readFile(header);
+ const uint8_t *restrict const buf =
+ ZipReader::readFile(header);
if (buf == nullptr)
return nullptr;
File *restrict const file = new File(&funcs,
@@ -647,7 +648,8 @@ namespace VirtFsZip
const ZipLocalHeader *restrict const header = *it2;
if (header->fileName == filename)
{
- const uint8_t *restrict const buf = Zip::readFile(header);
+ const uint8_t *restrict const buf =
+ ZipReader::readFile(header);
if (buf == nullptr)
return nullptr;
diff --git a/src/fs/virtfs/zip_unittest.cc b/src/fs/virtfs/zip_unittest.cc
index ad42f6a4a..3853bee79 100644
--- a/src/fs/virtfs/zip_unittest.cc
+++ b/src/fs/virtfs/zip_unittest.cc
@@ -26,7 +26,7 @@
#include "fs/virtfs/virtfszip.h"
#include "fs/virtfs/virtzipentry.h"
-#include "fs/virtfs/zip.h"
+#include "fs/virtfs/zipreader.h"
#include "fs/virtfs/ziplocalheader.h"
#include "utils/delete2.h"
@@ -52,7 +52,7 @@ TEST_CASE("Zip readArchiveInfo")
VirtFs::VirtFsZip::getFuncs());
std::vector<VirtFs::ZipLocalHeader*> &headers = entry->mHeaders;
- REQUIRE(VirtFs::Zip::readArchiveInfo(entry));
+ REQUIRE(VirtFs::ZipReader::readArchiveInfo(entry));
REQUIRE(headers.size() == 2);
REQUIRE(entry->root == name);
REQUIRE(headers[0]->fileName == "dir" + sep + "hide.png");
@@ -73,7 +73,7 @@ TEST_CASE("Zip readArchiveInfo")
VirtFs::VirtFsZip::getFuncs());
std::vector<VirtFs::ZipLocalHeader*> &headers = entry->mHeaders;
- REQUIRE(VirtFs::Zip::readArchiveInfo(entry));
+ REQUIRE(VirtFs::ZipReader::readArchiveInfo(entry));
REQUIRE(headers.size() == 11);
REQUIRE(entry->root == name);
REQUIRE(headers[0]->fileName == "test.txt");
@@ -135,7 +135,7 @@ TEST_CASE("Zip readArchiveInfo")
VirtFs::VirtFsZip::getFuncs());
std::vector<VirtFs::ZipLocalHeader*> &headers = entry->mHeaders;
- REQUIRE(VirtFs::Zip::readArchiveInfo(entry));
+ REQUIRE(VirtFs::ZipReader::readArchiveInfo(entry));
REQUIRE(headers.size() == 2);
REQUIRE(entry->root == name);
REQUIRE(headers[0]->fileName == "test.txt");
@@ -156,7 +156,7 @@ TEST_CASE("Zip readArchiveInfo")
VirtFs::VirtFsZip::getFuncs());
std::vector<VirtFs::ZipLocalHeader*> &headers = entry->mHeaders;
- REQUIRE(VirtFs::Zip::readArchiveInfo(entry));
+ REQUIRE(VirtFs::ZipReader::readArchiveInfo(entry));
REQUIRE(entry->root == name);
REQUIRE(headers.size() == 0);
@@ -176,7 +176,7 @@ TEST_CASE("Zip readCompressedFile")
SECTION("empty")
{
- REQUIRE_THROWS(VirtFs::Zip::readCompressedFile(nullptr));
+ REQUIRE_THROWS(VirtFs::ZipReader::readCompressedFile(nullptr));
}
SECTION("test2.zip")
@@ -187,11 +187,11 @@ TEST_CASE("Zip readCompressedFile")
VirtFs::VirtFsZip::getFuncs());
std::vector<VirtFs::ZipLocalHeader*> &headers = entry->mHeaders;
- REQUIRE(VirtFs::Zip::readArchiveInfo(entry));
+ REQUIRE(VirtFs::ZipReader::readArchiveInfo(entry));
REQUIRE(headers.size() == 11);
REQUIRE(entry->root == name);
// test.txt
- uint8_t *const buf = VirtFs::Zip::readCompressedFile(headers[0]);
+ uint8_t *const buf = VirtFs::ZipReader::readCompressedFile(headers[0]);
REQUIRE(buf != nullptr);
delete [] buf;
delete entry;
@@ -210,7 +210,7 @@ TEST_CASE("Zip readFile")
SECTION("empty")
{
- REQUIRE_THROWS(VirtFs::Zip::readFile(nullptr));
+ REQUIRE_THROWS(VirtFs::ZipReader::readFile(nullptr));
}
SECTION("test.zip")
@@ -221,7 +221,7 @@ TEST_CASE("Zip readFile")
VirtFs::VirtFsZip::getFuncs());
std::vector<VirtFs::ZipLocalHeader*> &headers = entry->mHeaders;
- REQUIRE(VirtFs::Zip::readArchiveInfo(entry));
+ REQUIRE(VirtFs::ZipReader::readArchiveInfo(entry));
REQUIRE(headers.size() == 2);
REQUIRE(entry->root == name);
for (int f = 0; f < 2; f ++)
@@ -230,7 +230,7 @@ TEST_CASE("Zip readFile")
headers[f]->fileName.c_str(),
headers[f]->compressSize,
headers[f]->uncompressSize);
- const uint8_t *const buf = VirtFs::Zip::readFile(headers[f]);
+ const uint8_t *const buf = VirtFs::ZipReader::readFile(headers[f]);
REQUIRE(buf != nullptr);
delete [] buf;
}
@@ -245,11 +245,11 @@ TEST_CASE("Zip readFile")
VirtFs::VirtFsZip::getFuncs());
std::vector<VirtFs::ZipLocalHeader*> &headers = entry->mHeaders;
- REQUIRE(VirtFs::Zip::readArchiveInfo(entry));
+ REQUIRE(VirtFs::ZipReader::readArchiveInfo(entry));
REQUIRE(headers.size() == 11);
REQUIRE(entry->root == name);
// test.txt
- const uint8_t *buf = VirtFs::Zip::readFile(headers[0]);
+ const uint8_t *buf = VirtFs::ZipReader::readFile(headers[0]);
REQUIRE(buf != nullptr);
const std::string str = std::string(reinterpret_cast<const char*>(buf),
headers[0]->uncompressSize);
@@ -261,7 +261,7 @@ TEST_CASE("Zip readFile")
headers[f]->fileName.c_str(),
headers[f]->compressSize,
headers[f]->uncompressSize);
- buf = VirtFs::Zip::readFile(headers[f]);
+ buf = VirtFs::ZipReader::readFile(headers[f]);
REQUIRE(buf != nullptr);
delete [] buf;
}
@@ -276,7 +276,7 @@ TEST_CASE("Zip readFile")
VirtFs::VirtFsZip::getFuncs());
std::vector<VirtFs::ZipLocalHeader*> &headers = entry->mHeaders;
- REQUIRE(VirtFs::Zip::readArchiveInfo(entry));
+ REQUIRE(VirtFs::ZipReader::readArchiveInfo(entry));
REQUIRE(headers.size() == 2);
REQUIRE(entry->root == name);
for (int f = 0; f < 2; f ++)
@@ -285,7 +285,7 @@ TEST_CASE("Zip readFile")
headers[f]->fileName.c_str(),
headers[f]->compressSize,
headers[f]->uncompressSize);
- const uint8_t *const buf = VirtFs::Zip::readFile(headers[f]);
+ const uint8_t *const buf = VirtFs::ZipReader::readFile(headers[f]);
REQUIRE(buf != nullptr);
delete [] buf;
}
diff --git a/src/fs/virtfs/zip.cpp b/src/fs/virtfs/zipreader.cpp
index 63cfb59b9..0c8bb9247 100644
--- a/src/fs/virtfs/zip.cpp
+++ b/src/fs/virtfs/zipreader.cpp
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "fs/virtfs/zip.h"
+#include "fs/virtfs/zipreader.h"
#include "fs/paths.h"
@@ -68,7 +68,7 @@ extern const char *dirSeparator;
namespace VirtFs
{
-namespace Zip
+namespace ZipReader
{
bool readArchiveInfo(VirtZipEntry *const entry)
{
@@ -242,7 +242,7 @@ namespace Zip
{
if (header == nullptr)
{
- reportAlways("Zip::readCompressedFile: header is null");
+ reportAlways("ZipReader::readCompressedFile: header is null");
return nullptr;
}
FILE *restrict const arcFile = fopen(
@@ -321,6 +321,6 @@ namespace Zip
delete [] in;
return out;
}
-} // namespace Zip
+} // namespace ZipReader
} // namespace VirtFs
diff --git a/src/fs/virtfs/zip.h b/src/fs/virtfs/zipreader.h
index e74ff09aa..d227315f1 100644
--- a/src/fs/virtfs/zip.h
+++ b/src/fs/virtfs/zipreader.h
@@ -31,7 +31,7 @@ namespace VirtFs
struct VirtZipEntry;
struct ZipLocalHeader;
-namespace Zip
+namespace ZipReader
{
bool readArchiveInfo(VirtZipEntry *const entry);
std::string getZlibError(const int err);
@@ -39,7 +39,7 @@ namespace Zip
const int err);
uint8_t *readCompressedFile(const ZipLocalHeader *restrict const header);
const uint8_t *readFile(const ZipLocalHeader *restrict const header);
-} // namespace Zip
+} // namespace ZipReader
} // namespace VirtFs