diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-02-27 18:16:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-02-27 18:16:39 +0300 |
commit | 6388446b85e1fa5deccc6d5c1683fba88ef53d99 (patch) | |
tree | daaa6c764a34aece74de45dddc5b1e276d61774d /src/fs/virtfszip.cpp | |
parent | 757069bdedabbd904e56d153e2e858db2a2cf2f1 (diff) | |
download | plus-6388446b85e1fa5deccc6d5c1683fba88ef53d99.tar.gz plus-6388446b85e1fa5deccc6d5c1683fba88ef53d99.tar.bz2 plus-6388446b85e1fa5deccc6d5c1683fba88ef53d99.tar.xz plus-6388446b85e1fa5deccc6d5c1683fba88ef53d99.zip |
Add functions pointers into VirtFile.
From VirtFs call if possible pointer from VirtFile.
Diffstat (limited to 'src/fs/virtfszip.cpp')
-rw-r--r-- | src/fs/virtfszip.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/fs/virtfszip.cpp b/src/fs/virtfszip.cpp index fe75c0192..fa47892b5 100644 --- a/src/fs/virtfszip.cpp +++ b/src/fs/virtfszip.cpp @@ -24,6 +24,7 @@ #include "fs/paths.h" #include "fs/virtfile.h" #include "fs/virtfileprivate.h" +#include "fs/virtfsfuncs.h" #include "fs/virtlist.h" #include "fs/virtzipentry.h" #include "fs/zip.h" @@ -40,6 +41,7 @@ extern const char *dirSeparator; namespace { std::vector<VirtZipEntry*> mEntries; + VirtFsFuncs funcs; } // namespace namespace VirtFsZip @@ -209,6 +211,22 @@ namespace VirtFsZip mEntries.clear(); } + void init() + { + initFuncs(&funcs); + } + + void initFuncs(VirtFsFuncs *restrict const ptr) + { + ptr->close = &VirtFsZip::close; + ptr->read = &VirtFsZip::read; + ptr->write = &VirtFsZip::write; + ptr->fileLength = &VirtFsZip::fileLength; + ptr->tell = &VirtFsZip::tell; + ptr->seek = &VirtFsZip::seek; + ptr->eof = &VirtFsZip::eof; + } + std::string getRealDir(const std::string &restrict filename) { if (checkPath(filename) == false) @@ -337,7 +355,7 @@ namespace VirtFsZip uint8_t *restrict const buf = Zip::readFile(header); if (buf == nullptr) return nullptr; - VirtFile *restrict const file = new VirtFile; + VirtFile *restrict const file = new VirtFile(&funcs); file->mPrivate = new VirtFilePrivate(buf, header->uncompressSize); return file; |