Fixed the issue where trying to open a stream didin't reset the stream first.

This commit is contained in:
Lukas Dürrenberger 2015-03-12 11:29:43 +01:00
parent bbfa3d5a76
commit 9d3024e13e

View File

@ -95,7 +95,7 @@ SoundFileReader* SoundFileFactory::createReaderFromMemory(const void* data, std:
MemoryInputStream stream; MemoryInputStream stream;
stream.open(data, sizeInBytes); stream.open(data, sizeInBytes);
// Test the filename in all the registered factories // Test the stream for all the registered factories
for (ReaderFactoryArray::const_iterator it = s_readers.begin(); it != s_readers.end(); ++it) for (ReaderFactoryArray::const_iterator it = s_readers.begin(); it != s_readers.end(); ++it)
{ {
stream.seek(0); stream.seek(0);
@ -114,9 +114,10 @@ SoundFileReader* SoundFileFactory::createReaderFromStream(InputStream& stream)
// Register the built-in readers/writers on first call // Register the built-in readers/writers on first call
ensureDefaultReadersWritersRegistered(); ensureDefaultReadersWritersRegistered();
// Test the filename in all the registered factories // Test the stream for all the registered factories
for (ReaderFactoryArray::const_iterator it = s_readers.begin(); it != s_readers.end(); ++it) for (ReaderFactoryArray::const_iterator it = s_readers.begin(); it != s_readers.end(); ++it)
{ {
stream.seek(0);
if (it->check(stream)) if (it->check(stream))
return it->create(); return it->create();
} }