aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-05-19 10:38:28 -0700
committerChris Robinson <[email protected]>2010-05-19 10:38:28 -0700
commitc5c83882b33b7b32c82d666c77f8f605be4167b3 (patch)
tree5e2c535c69cf952f33deda243005f18f43d17119 /OpenAL32
parentea3bc0518cd79fa2858eb4deb654153e87f4571d (diff)
Use unsigned types when finding the source offsets
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alSource.c14
1 files changed, 5 insertions, 9 deletions
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;
}