summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-05 17:22:43 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-05 17:44:33 +0300
commit5aca48c5a15041a85af0709cdf1496c61c34b1dd (patch)
tree6f8c3dcf263fb20d89d51b0631d7fb06dbdff9a6 /src
parent979f9089199512d32dcc2de1f1e00a96aa9b0bf4 (diff)
downloadmv-5aca48c5a15041a85af0709cdf1496c61c34b1dd.tar.gz
mv-5aca48c5a15041a85af0709cdf1496c61c34b1dd.tar.bz2
mv-5aca48c5a15041a85af0709cdf1496c61c34b1dd.tar.xz
mv-5aca48c5a15041a85af0709cdf1496c61c34b1dd.zip
Rename zip into zipreader.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/Makefile.am4
-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
7 files changed, 35 insertions, 33 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 71ca2aa29..331b10c7a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -914,8 +914,8 @@ SET(SRCS
fs/virtfs/virtfsziprwops.h
fs/virtfs/virtzipentry.cpp
fs/virtfs/virtzipentry.h
- fs/virtfs/zip.cpp
- fs/virtfs/zip.h
+ fs/virtfs/zipreader.cpp
+ fs/virtfs/zipreader.h
fs/virtfs/ziplocalheader.cpp
fs/virtfs/ziplocalheader.h
utils/process.cpp
@@ -1823,8 +1823,8 @@ SET(DYE_CMD_SRCS
fs/virtfs/virtfsziprwops.h
fs/virtfs/virtzipentry.cpp
fs/virtfs/virtzipentry.h
- fs/virtfs/zip.cpp
- fs/virtfs/zip.h
+ fs/virtfs/zipreader.cpp
+ fs/virtfs/zipreader.h
fs/virtfs/ziplocalheader.cpp
fs/virtfs/ziplocalheader.h
utils/sdl2helper.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index b4c8e3e21..94414f868 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -862,8 +862,8 @@ BASE_SRC += events/actionevent.h \
fs/virtfs/virtfsziprwops.h \
fs/virtfs/virtzipentry.cpp \
fs/virtfs/virtzipentry.h \
- fs/virtfs/zip.cpp \
- fs/virtfs/zip.h \
+ fs/virtfs/zipreader.cpp \
+ fs/virtfs/zipreader.h \
fs/virtfs/ziplocalheader.cpp \
fs/virtfs/ziplocalheader.h
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