[Scummvm-git-logs] scummvm master -> 13e5042dee93ce3d190cf5e5e9e374afadc1d935
bluegr
bluegr at gmail.com
Sun Feb 9 21:26:49 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
13e5042dee COMMON: Add WriteStream::writeStream()
Commit: 13e5042dee93ce3d190cf5e5e9e374afadc1d935
https://github.com/scummvm/scummvm/commit/13e5042dee93ce3d190cf5e5e9e374afadc1d935
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-02-09T23:26:45+02:00
Commit Message:
COMMON: Add WriteStream::writeStream()
Changed paths:
common/stream.cpp
common/stream.h
diff --git a/common/stream.cpp b/common/stream.cpp
index 8411019..988c1ab 100644
--- a/common/stream.cpp
+++ b/common/stream.cpp
@@ -28,6 +28,19 @@
namespace Common {
+uint32 WriteStream::writeStream(ReadStream *stream, uint32 dataSize) {
+ void *buf = malloc(dataSize);
+ dataSize = stream->read(buf, dataSize);
+ assert(dataSize > 0);
+ dataSize = write(buf, dataSize);
+ free(buf);
+ return dataSize;
+}
+
+uint32 WriteStream::writeStream(SeekableReadStream *stream) {
+ return writeStream(stream, stream->size());
+}
+
void WriteStream::writeString(const String &str) {
write(str.c_str(), str.size());
}
diff --git a/common/stream.h b/common/stream.h
index 16264a7..aa2f6e3 100644
--- a/common/stream.h
+++ b/common/stream.h
@@ -29,6 +29,7 @@
namespace Common {
+class ReadStream;
class SeekableReadStream;
/**
@@ -229,6 +230,13 @@ public:
}
/**
+ * Write data from another stream to this one.
+ */
+ uint32 writeStream(ReadStream *stream, uint32 dataSize);
+
+ uint32 writeStream(SeekableReadStream *stream);
+
+ /**
* Write the given string to the stream.
* This writes str.size() characters, but no terminating zero byte.
*/
More information about the Scummvm-git-logs
mailing list