[Scummvm-cvs-logs] scummvm master -> d7ba69ca274b59365d06ad162670bddd2a3faae6

lordhoto lordhoto at gmail.com
Sun Mar 11 00:55:05 CET 2012


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
48efab4e5a COMMON: Rename SafeSubReadStream to SafeSeekableSubReadStream.
d7ba69ca27 COMMON: Mention that SafeSeekableSubReadStream is not threading safe.


Commit: 48efab4e5abd8954b7167074b46ff078f6e0d7f4
    https://github.com/scummvm/scummvm/commit/48efab4e5abd8954b7167074b46ff078f6e0d7f4
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-03-10T15:51:20-08:00

Commit Message:
COMMON: Rename SafeSubReadStream to SafeSeekableSubReadStream.

It actually inherits from SeekableSubReadStream, so it should be named
accordingly.

Changed paths:
    common/stream.cpp
    common/substream.h
    engines/gob/dataio.cpp
    engines/sword2/music.cpp



diff --git a/common/stream.cpp b/common/stream.cpp
index 30b3bca..85647bf 100644
--- a/common/stream.cpp
+++ b/common/stream.cpp
@@ -240,7 +240,7 @@ bool SeekableSubReadStream::seek(int32 offset, int whence) {
 	return ret;
 }
 
-uint32 SafeSubReadStream::read(void *dataPtr, uint32 dataSize) {
+uint32 SafeSeekableSubReadStream::read(void *dataPtr, uint32 dataSize) {
 	// Make sure the parent stream is at the right position
 	seek(0, SEEK_CUR);
 
diff --git a/common/substream.h b/common/substream.h
index 6475b7a..1ad588a 100644
--- a/common/substream.h
+++ b/common/substream.h
@@ -99,14 +99,14 @@ public:
  * normal SeekableSubReadStream, at the cost of seek()ing the parent stream
  * before each read().
  *
- * More than one SafeSubReadStream to the same parent stream can be used
+ * More than one SafeSeekableSubReadStream to the same parent stream can be used
  * at the same time; they won't mess up each other. They will, however,
  * reposition the parent stream, so don't depend on its position to be
- * the same after a read() or seek() on one of its SafeSubReadStream.
+ * the same after a read() or seek() on one of its SafeSeekableSubReadStream.
  */
-class SafeSubReadStream : public SeekableSubReadStream {
+class SafeSeekableSubReadStream : public SeekableSubReadStream {
 public:
-	SafeSubReadStream(SeekableReadStream *parentStream, uint32 begin, uint32 end, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO)
+	SafeSeekableSubReadStream(SeekableReadStream *parentStream, uint32 begin, uint32 end, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO)
 		: SeekableSubReadStream(parentStream, begin, end, disposeParentStream) {
 	}
 
diff --git a/engines/gob/dataio.cpp b/engines/gob/dataio.cpp
index 1633a1e..2071c0f 100644
--- a/engines/gob/dataio.cpp
+++ b/engines/gob/dataio.cpp
@@ -414,7 +414,7 @@ Common::SeekableReadStream *DataIO::getFile(File &file) {
 		return 0;
 
 	Common::SeekableReadStream *rawData =
-		new Common::SafeSubReadStream(&file.archive->file, file.offset, file.offset + file.size);
+		new Common::SafeSeekableSubReadStream(&file.archive->file, file.offset, file.offset + file.size);
 
 	if (file.compression == 0)
 		return rawData;
diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp
index 40a4021..62fb3d2 100644
--- a/engines/sword2/music.cpp
+++ b/engines/sword2/music.cpp
@@ -160,19 +160,19 @@ static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base,
 			return makeCLUStream(&fh->file, enc_len);
 #ifdef USE_MAD
 	case kMP3Mode: {
-		Common::SafeSubReadStream *tmp = new Common::SafeSubReadStream(&fh->file, pos, pos + enc_len);
+		Common::SafeSeekableSubReadStream *tmp = new Common::SafeSeekableSubReadStream(&fh->file, pos, pos + enc_len);
 		return Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
 		}
 #endif
 #ifdef USE_VORBIS
 	case kVorbisMode: {
-		Common::SafeSubReadStream *tmp = new Common::SafeSubReadStream(&fh->file, pos, pos + enc_len);
+		Common::SafeSeekableSubReadStream *tmp = new Common::SafeSeekableSubReadStream(&fh->file, pos, pos + enc_len);
 		return Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
 		}
 #endif
 #ifdef USE_FLAC
 	case kFLACMode: {
-		Common::SafeSubReadStream *tmp = new Common::SafeSubReadStream(&fh->file, pos, pos + enc_len);
+		Common::SafeSeekableSubReadStream *tmp = new Common::SafeSeekableSubReadStream(&fh->file, pos, pos + enc_len);
 		return Audio::makeFLACStream(tmp, DisposeAfterUse::YES);
 		}
 #endif


Commit: d7ba69ca274b59365d06ad162670bddd2a3faae6
    https://github.com/scummvm/scummvm/commit/d7ba69ca274b59365d06ad162670bddd2a3faae6
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-03-10T15:53:23-08:00

Commit Message:
COMMON: Mention that SafeSeekableSubReadStream is not threading safe.

Changed paths:
    common/substream.h



diff --git a/common/substream.h b/common/substream.h
index 1ad588a..0168652 100644
--- a/common/substream.h
+++ b/common/substream.h
@@ -103,6 +103,9 @@ public:
  * at the same time; they won't mess up each other. They will, however,
  * reposition the parent stream, so don't depend on its position to be
  * the same after a read() or seek() on one of its SafeSeekableSubReadStream.
+ *
+ * Note that this stream is *not* threading safe. Calling read from the audio
+ * thread and from the main thread might mess up the data retrieved.
  */
 class SafeSeekableSubReadStream : public SeekableSubReadStream {
 public:






More information about the Scummvm-git-logs mailing list