[Scummvm-cvs-logs] SF.net SVN: scummvm:[47998] scummvm/trunk/common/unarj.cpp
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Mon Feb 8 17:56:04 CET 2010
Revision: 47998
http://scummvm.svn.sourceforge.net/scummvm/?rev=47998&view=rev
Author: peres001
Date: 2010-02-08 16:56:04 +0000 (Mon, 08 Feb 2010)
Log Message:
-----------
Fix trunk after fscking up.
Modified Paths:
--------------
scummvm/trunk/common/unarj.cpp
Modified: scummvm/trunk/common/unarj.cpp
===================================================================
--- scummvm/trunk/common/unarj.cpp 2010-02-08 16:15:05 UTC (rev 47997)
+++ scummvm/trunk/common/unarj.cpp 2010-02-08 16:56:04 UTC (rev 47998)
@@ -62,6 +62,7 @@
#define ARJ_PTABLESIZE 256
+// these struct represents a file inside an Arj archive
struct ArjHeader {
int32 pos;
uint16 id;
@@ -317,51 +318,14 @@
}
-<<<<<<< HEAD:common/unarj.cpp
-SeekableReadStream *ArjFile::open(const Common::String &filename) {
- if (_fallBack && SearchMan.hasFile(filename)) {
- return SearchMan.createReadStreamForMember(filename);
- }
- if (!_fileMap.contains(filename))
- return 0;
- ArjHeader *hdr = _headers[_fileMap[filename]];
- // TODO: It would be good if ArjFile could decompress files in a streaming
- // mode, so it would not need to pre-allocate the entire output.
- byte *uncompressedData = (byte *)malloc(hdr->origSize);
- File archiveFile;
- archiveFile.open(_archMap[filename]);
- archiveFile.seek(hdr->pos, SEEK_SET);
- if (hdr->method == 0) { // store
- int32 len = archiveFile.read(uncompressedData, hdr->origSize);
- assert(len == hdr->origSize);
- } else {
- ArjDecoder *decoder = new ArjDecoder(hdr);
- // TODO: It might not be appropriate to use this wrapper inside ArjFile.
- // If reading from archiveFile directly is too slow to be usable,
- // maybe the filesystem code should instead wrap its files
- // in a BufferedReadStream.
- decoder->_compressed = new BufferedReadStream(&archiveFile, 4096);
- decoder->_outstream = new MemoryWriteStream(uncompressedData, hdr->origSize);
- if (hdr->method == 1 || hdr->method == 2 || hdr->method == 3)
- decoder->decode(hdr->origSize);
- else if (hdr->method == 4)
- decoder->decode_f(hdr->origSize);
-
- delete decoder;
- }
-
- return new MemoryReadStream(uncompressedData, hdr->origSize, true);
-}
-
-
//
// Source for init_getbits: arj_file.c (decode_start_stub)
//
@@ -841,7 +805,7 @@
// If reading from archiveFile directly is too slow to be usable,
// maybe the filesystem code should instead wrap its files
// in a BufferedReadStream.
- decoder->_compressed = new Common::BufferedReadStream(&archiveFile, 4096, false);
+ decoder->_compressed = new Common::BufferedReadStream(&archiveFile, 4096, DisposeAfterUse::NO);
decoder->_outstream = new Common::MemoryWriteStream(uncompressedData, hdr->origSize);
if (hdr->method == 1 || hdr->method == 2 || hdr->method == 3)
@@ -852,7 +816,7 @@
delete decoder;
}
- return new Common::MemoryReadStream(uncompressedData, hdr->origSize, true);
+ return new Common::MemoryReadStream(uncompressedData, hdr->origSize, DisposeAfterUse::YES);
}
#pragma mark ArjFile implementation
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list