aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-09-07 16:33:17 -0700
committerChris Robinson <[email protected]>2010-09-07 16:33:17 -0700
commit5fa5252648c2ea68f9304a0397de84c5cd2329b2 (patch)
tree3488eead81ae2810e1ab36c4eff6b2720a7f153d /OpenAL32
parent1e82561a228de4b4f4a8b970f461c4503cd2ec13 (diff)
Watch for a few more negative sizes
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alBuffer.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index 81e17c52..983396c0 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -115,7 +115,9 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers)
if(!Context) return;
// Check that we are actually generation some Buffers
- if(n > 0)
+ if(n < 0)
+ alSetError(Context, AL_INVALID_VALUE);
+ else
{
ALCdevice *device = Context->Device;
ALenum err;
@@ -180,7 +182,7 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *puiBuffers)
ALboolean bFailed = AL_FALSE;
// Check that all the buffers are valid and can actually be deleted
- for (i = 0; i < n; i++)
+ for(i = 0;i < n;i++)
{
if(!puiBuffers[i])
continue;
@@ -206,9 +208,9 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *puiBuffers)
}
// If all the Buffers were valid (and have Reference Counts of 0), then we can delete them
- if (!bFailed)
+ if(!bFailed)
{
- for (i = 0; i < n; i++)
+ for(i = 0;i < n;i++)
{
if((ALBuf=LookupBuffer(device->BufferMap, puiBuffers[i])) != NULL)
{
@@ -286,7 +288,7 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer,ALenum format,const ALvoid
data = Context->SampleSource->data + offset;
}
- if(size < 0)
+ if(size < 0 || freq < 0)
alSetError(Context, AL_INVALID_VALUE);
else if(ALBuf->refcount != 0)
alSetError(Context, AL_INVALID_VALUE);
@@ -1070,7 +1072,7 @@ static ALenum LoadData(ALbuffer *ALBuf, const ALvoid *data, ALsizei size, ALuint
assert(NewBytes == 4);
assert(NewChannels == OrigChannels);
- if ((size%(OrigBytes*OrigChannels)) != 0)
+ if((size%(OrigBytes*OrigChannels)) != 0)
return AL_INVALID_VALUE;
// Allocate extra padding samples