Skip to content

Commit

Permalink
Refactor|FileSys: Derive ZipFile from de::File1
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Oct 20, 2012
1 parent c673c83 commit c1fedd2
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions doomsday/engine/portable/src/zip.cpp
Expand Up @@ -138,18 +138,12 @@ typedef struct centralend_s {

static void ApplyPathMappings(ddstring_t* dest, const ddstring_t* src);

class ZipFile
class ZipFile : public File1
{
public:
explicit ZipFile(FileInfo const& _info) : info_(_info)
ZipFile::ZipFile(FileHandle& hndl, char const* path, FileInfo const& info)
: File1(FT_ZIPFILE, path, hndl, info)
{}

FileInfo const& info() const {
return info_;
}

private:
FileInfo info_;
};

struct Zip::Instance
Expand Down Expand Up @@ -395,11 +389,15 @@ struct Zip::Instance
F_PrependBasePath(&entryPath, &entryPath);

ZipFile* record =
new ZipFile(FileInfo(self->lastModified(), // Inherited from the file (note recursion).
lumpIdx++, baseOffset, ULONG(header->size),
compressedSize, self));
new ZipFile(*FileHandleBuilder::fromFileLump(*self, lumpIdx, true/*don't buffer*/),
Str_Text(&entryPath),
FileInfo(self->lastModified(), // Inherited from the file (note recursion).
lumpIdx, baseOffset, ULONG(header->size),
compressedSize, self));
PathDirectoryNode* node = lumpDirectory->insert(Str_Text(&entryPath));
node->setUserData(record);

lumpIdx++;
}
}

Expand Down

0 comments on commit c1fedd2

Please sign in to comment.