aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe/ngiarchive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/fullpipe/ngiarchive.cpp')
-rw-r--r--engines/fullpipe/ngiarchive.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/engines/fullpipe/ngiarchive.cpp b/engines/fullpipe/ngiarchive.cpp
index 7d75dc2e78..e69307addd 100644
--- a/engines/fullpipe/ngiarchive.cpp
+++ b/engines/fullpipe/ngiarchive.cpp
@@ -70,7 +70,6 @@ NGIArchive::NGIArchive(const Common::String &filename) : _ngiFilename(filename)
}
NgiHeader header;
- NgiHeader *head;
for (uint i = 0; i < count; i++) {
memcpy(header.filename, &fat[i * 32], 12);
@@ -84,9 +83,7 @@ NGIArchive::NGIArchive(const Common::String &filename) : _ngiFilename(filename)
warning("File has flags: %.8x\n", header.flags & 0x1e0);
}
- head = new NgiHeader(header);
-
- _headers[header.filename] = head;
+ _headers[header.filename].reset(new NgiHeader(header));
}
free(fat);
@@ -98,19 +95,14 @@ NGIArchive::NGIArchive(const Common::String &filename) : _ngiFilename(filename)
NGIArchive::~NGIArchive() {
debugC(0, kDebugLoading, "NGIArchive Destructor Called");
- NgiHeadersMap::iterator it = _headers.begin();
- for ( ; it != _headers.end(); ++it) {
- delete it->_value;
- }
-
- g_fp->_currArchive = 0;
+ g_fp->_currArchive = nullptr;
}
bool NGIArchive::hasFile(const Common::String &name) const {
return _headers.contains(name);
}
- int NGIArchive::listMembers(Common::ArchiveMemberList &list) const {
+int NGIArchive::listMembers(Common::ArchiveMemberList &list) const {
int matches = 0;
NgiHeadersMap::const_iterator it = _headers.begin();
@@ -134,7 +126,7 @@ Common::SeekableReadStream *NGIArchive::createReadStreamForMember(const Common::
return 0;
}
- NgiHeader *hdr = _headers[name];
+ NgiHeader *hdr = _headers[name].get();
Common::File archiveFile;
archiveFile.open(_ngiFilename);
@@ -149,7 +141,7 @@ Common::SeekableReadStream *NGIArchive::createReadStreamForMember(const Common::
return new Common::MemoryReadStream(data, hdr->size, DisposeAfterUse::YES);
}
-Common::Archive *makeNGIArchive(const Common::String &name) {
+NGIArchive *makeNGIArchive(const Common::String &name) {
return new NGIArchive(name);
}