From c5c83882b33b7b32c82d666c77f8f605be4167b3 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 19 May 2010 10:38:28 -0700 Subject: Use unsigned types when finding the source offsets --- OpenAL32/alSource.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'OpenAL32/alSource.c') diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 58b163bc..5f3ba7f0 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -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; } -- cgit v1.2.3