Use unsigned types when finding the source offsets

This commit is contained in:
Chris Robinson
2010-05-19 10:38:28 -07:00
parent ea3bc0518c
commit c5c83882b3
+5 -9
View File
@@ -1770,9 +1770,9 @@ static ALvoid GetSourceOffset(ALsource *Source, ALenum name, ALdouble *offset, A
ALbuffer *Buffer = NULL;
ALfloat BufferFreq;
ALint Channels, Bytes;
ALint readPos, writePos;
ALuint readPos, writePos;
ALenum OriginalFormat;
ALint TotalBufferDataSize;
ALuint TotalBufferDataSize;
ALuint i;
// Find the first non-NULL Buffer in the Queue
@@ -1827,14 +1827,10 @@ static ALvoid GetSourceOffset(ALsource *Source, ALenum name, ALdouble *offset, A
}
else
{
// Clamp BytesPlayed to within 0 and lTotalBufferDataSize
if(readPos < 0)
readPos = 0;
else if(readPos > TotalBufferDataSize)
// Clamp positions to TotalBufferDataSize
if(readPos > TotalBufferDataSize)
readPos = TotalBufferDataSize;
if(writePos < 0)
writePos = 0;
else if(writePos > TotalBufferDataSize)
if(writePos > TotalBufferDataSize)
writePos = TotalBufferDataSize;
}