diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-03-29 17:16:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-03-29 17:16:27 +0300 |
commit | d9c0d1c3b2800b0c995393426b65a031203ca2f0 (patch) | |
tree | ae5a5bab4a7a2ef5fbb9229fa5ce153f0178d011 /src/fs/virtfs/virtfszip.cpp | |
parent | d1fb04c1d91596706ebf402acfdab24dabad19f4 (diff) | |
download | plus-d9c0d1c3b2800b0c995393426b65a031203ca2f0.tar.gz plus-d9c0d1c3b2800b0c995393426b65a031203ca2f0.tar.bz2 plus-d9c0d1c3b2800b0c995393426b65a031203ca2f0.tar.xz plus-d9c0d1c3b2800b0c995393426b65a031203ca2f0.zip |
Merge virtfileprivate with virtfile.
Because now physfs is gone and nothing to hide from other code.
Diffstat (limited to 'src/fs/virtfs/virtfszip.cpp')
-rw-r--r-- | src/fs/virtfs/virtfszip.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/fs/virtfs/virtfszip.cpp b/src/fs/virtfs/virtfszip.cpp index 8490cb981..62ad591ae 100644 --- a/src/fs/virtfs/virtfszip.cpp +++ b/src/fs/virtfs/virtfszip.cpp @@ -21,7 +21,6 @@ #include "fs/virtfs/virtfszip.h" #include "fs/virtfs/virtfile.h" -#include "fs/virtfs/virtfileprivate.h" #include "fs/virtfs/virtfsfuncs.h" #include "fs/virtfs/virtlist.h" #include "fs/virtfs/virtzipentry.h" @@ -223,8 +222,8 @@ namespace VirtFsZip const uint8_t *restrict const buf = Zip::readFile(header); if (buf == nullptr) return nullptr; - VirtFile *restrict const file = new VirtFile(&funcs); - file->mPrivate = new VirtFilePrivate(buf, + VirtFile *restrict const file = new VirtFile(&funcs, + buf, header->uncompressSize); return file; } @@ -270,14 +269,13 @@ namespace VirtFsZip reportAlways("VirtFsZip::read buffer is null"); return 0; } - VirtFilePrivate *restrict const priv = file->mPrivate; - const uint32_t pos = priv->mPos; - const uint32_t sz = priv->mSize; + const uint32_t pos = file->mPos; + const uint32_t sz = file->mSize; // if outside of buffer, return if (pos >= sz) return 0; // pointer to start for buffer ready to read - const uint8_t *restrict const memPtr = priv->mBuf + pos; + const uint8_t *restrict const memPtr = file->mBuf + pos; // left buffer size from pos to end const uint32_t memSize = sz - pos; // number of objects possible to read @@ -290,7 +288,7 @@ namespace VirtFsZip // number of bytes to read from buffer const uint32_t memEnd = memCount * objSize; memcpy(buffer, memPtr, memEnd); - priv->mPos += memEnd; + file->mPos += memEnd; return memCount; } @@ -307,7 +305,7 @@ namespace VirtFsZip if (file == nullptr) return -1; - return file->mPrivate->mSize; + return file->mSize; } int64_t tell(VirtFile *restrict const file) @@ -315,7 +313,7 @@ namespace VirtFsZip if (file == nullptr) return -1; - return file->mPrivate->mPos; + return file->mPos; } int seek(VirtFile *restrict const file, @@ -324,9 +322,9 @@ namespace VirtFsZip if (file == nullptr) return 0; - if (pos > file->mPrivate->mSize) + if (pos > file->mSize) return 0; - file->mPrivate->mPos = pos; + file->mPos = pos; return 1; } @@ -335,7 +333,7 @@ namespace VirtFsZip if (file == nullptr) return -1; - return file->mPrivate->mPos >= file->mPrivate->mSize; + return file->mPos >= file->mSize; } char *loadFile(VirtFsEntry *restrict const entry, |