aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/error.h10
-rw-r--r--common/macresman.cpp10
-rw-r--r--common/str.h6
-rw-r--r--common/stream.h2
-rw-r--r--common/unzip.cpp4
5 files changed, 5 insertions, 27 deletions
diff --git a/common/error.h b/common/error.h
index 58343114a2..e79b8d0e91 100644
--- a/common/error.h
+++ b/common/error.h
@@ -59,16 +59,10 @@ enum Error {
kPathNotDirectory, ///< The specified path does not point to a directory
kPathNotFile, ///< The specified path does not point to a file
- kCreatingFileFailed, ///< Failed creating a (savestate) file
- kReadingFailed, ///< Failed to read a file (permission denied?)
+ kCreatingFileFailed,
+ kReadingFailed, ///< Failed creating a (savestate) file
kWritingFailed, ///< Failure to write data -- disk full?
- // The following are used by --list-saves
- kPluginNotFound, ///< Failed to find plugin to handle tager
- kPluginNotSupportSaves, ///< Failed if plugin does not support saves
- kNoSavesError, ///< There are no saves to show
-
- kArgumentNotProcessed, ///< Used in command line parsing
kUnknownError ///< Catch-all error, used if no other error code matches
};
diff --git a/common/macresman.cpp b/common/macresman.cpp
index df7351d55a..4b726a183d 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -439,11 +439,6 @@ Common::SeekableReadStream *MacResManager::getResource(uint32 typeID, uint16 res
_stream->seek(_dataOffset + _resLists[typeNum][resNum].dataOffset);
uint32 len = _stream->readUint32BE();
-
- // Ignore resources with 0 length
- if (!len)
- return 0;
-
return _stream->readStream(len);
}
@@ -453,11 +448,6 @@ Common::SeekableReadStream *MacResManager::getResource(const Common::String &fil
if (_resLists[i][j].nameOffset != -1 && filename.equalsIgnoreCase(_resLists[i][j].name)) {
_stream->seek(_dataOffset + _resLists[i][j].dataOffset);
uint32 len = _stream->readUint32BE();
-
- // Ignore resources with 0 length
- if (!len)
- return 0;
-
return _stream->readStream(len);
}
}
diff --git a/common/str.h b/common/str.h
index e3dec6cdc2..46e721a746 100644
--- a/common/str.h
+++ b/common/str.h
@@ -225,12 +225,6 @@ public:
typedef const char * const_iterator;
iterator begin() {
- // Since the user could potentially
- // change the string via the returned
- // iterator we have to assure we are
- // pointing to a unique storage.
- makeUnique();
-
return _str;
}
diff --git a/common/stream.h b/common/stream.h
index 5e0d7149b0..5c81063a7e 100644
--- a/common/stream.h
+++ b/common/stream.h
@@ -156,7 +156,7 @@ public:
class ReadStream : virtual public Stream {
public:
/**
- * Returns true if a read failed because the stream end has been reached.
+ * Returns true if a read failed because the stream has been reached.
* This flag is cleared by clearErr().
* For a SeekableReadStream, it is also cleared by a successful seek.
*/
diff --git a/common/unzip.cpp b/common/unzip.cpp
index a29518a796..eda42fd107 100644
--- a/common/unzip.cpp
+++ b/common/unzip.cpp
@@ -1472,11 +1472,11 @@ Common::SeekableReadStream *ZipArchive::createReadStreamForMember(const Common::
unz_file_info fileInfo;
unzOpenCurrentFile(_zipFile);
unzGetCurrentFileInfo(_zipFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0);
- byte *buffer = (byte *)malloc(fileInfo.uncompressed_size);
+ byte *buffer = (byte *)calloc(fileInfo.uncompressed_size+1, 1);
assert(buffer);
unzReadCurrentFile(_zipFile, buffer, fileInfo.uncompressed_size);
unzCloseCurrentFile(_zipFile);
- return new Common::MemoryReadStream(buffer, fileInfo.uncompressed_size, DisposeAfterUse::YES);
+ return new Common::MemoryReadStream(buffer, fileInfo.uncompressed_size+1, DisposeAfterUse::YES);
// FIXME: instead of reading all into a memory stream, we could
// instead create a new ZipStream class. But then we have to be