diff options
author | 2016-03-18 22:41:17 +0100 | |
---|---|---|
committer | 2016-03-18 22:41:17 +0100 | |
commit | e39daaf5bdcf21d64abf239e1133963643dc6df1 (patch) | |
tree | 1f1b5f333e84bf056ce82c27bebdbad933f26c0d /src/tools/imgtool/stream.cpp | |
parent | 421656e108e7091ee9e1b14c84f0a3f6efc2ad2e (diff) | |
parent | b79020559ea3617b2d6bd4c92041d314045e2938 (diff) |
Merge remote-tracking branch 'refs/remotes/mamedev/master'
Diffstat (limited to 'src/tools/imgtool/stream.cpp')
-rw-r--r-- | src/tools/imgtool/stream.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/tools/imgtool/stream.cpp b/src/tools/imgtool/stream.cpp index d96cf325a7a..b11e7a5e4be 100644 --- a/src/tools/imgtool/stream.cpp +++ b/src/tools/imgtool/stream.cpp @@ -104,24 +104,23 @@ static imgtool_stream *stream_open_zip(const char *zipname, const char *subname, imgfile->imgtype = IMG_MEM; - zip_file::ptr z; - const zip_file::file_header *zipent = nullptr; - zip_file::open(zipname, z); + util::archive_file::ptr z; + util::archive_file::open_zip(zipname, z); if (!z) return nullptr; - zipent = z->first_file(); - while (zipent && subname && strcmp(subname, zipent->filename)) + int zipent = z->first_file(); + while ((zipent >= 0) && subname && strcmp(subname, z->current_name().c_str())) zipent = z->next_file(); - if (!zipent) + if (zipent < 0) return nullptr; - imgfile->filesize = zipent->uncompressed_length; - imgfile->buffer = reinterpret_cast<std::uint8_t *>(malloc(zipent->uncompressed_length)); + imgfile->filesize = z->current_uncompressed_length(); + imgfile->buffer = reinterpret_cast<std::uint8_t *>(malloc(z->current_uncompressed_length())); if (!imgfile->buffer) return nullptr; - if (z->decompress(imgfile->buffer, zipent->uncompressed_length) != zip_file::error::NONE) + if (z->decompress(imgfile->buffer, z->current_uncompressed_length()) != util::archive_file::error::NONE) return nullptr; return imgfile.release(); |