some refactoring

This commit is contained in:
Eduardo Bart
2012-06-21 20:58:18 -03:00
parent a7c17cec2e
commit c5674d10ba
23 changed files with 278 additions and 367 deletions

View File

@@ -87,17 +87,14 @@ int OggSoundFile::cb_seek(void* source, ogg_int64_t offset, int whence)
FileStream *file = static_cast<FileStream*>(source);
switch(whence) {
case SEEK_SET:
if(file->seek(offset))
return 0;
break;
file->seek(offset);
return 0;
case SEEK_CUR:
if(file->seek(file->tell() + offset))
return 0;
break;
file->seek(file->tell() + offset);
return 0;
case SEEK_END:
if(file->seek(file->size() + offset))
return 0;
break;
file->seek(file->size() + offset);
return 0;
}
return -1;
}

View File

@@ -46,7 +46,7 @@ bool SoundBuffer::fillBuffer(const SoundFilePtr& soundFile)
DataBuffer<char> samples(soundFile->getSize());
int read = soundFile->read(&samples[0], soundFile->getSize());
if(read <= 0) {
if(read == 0) {
g_logger.error(stdext::format("unable to fill audio buffer data for '%s'", soundFile->getName()));
return false;
}