Reduce some indentation
This commit is contained in:
parent
301a8ba3a4
commit
8a1d5a21c3
@ -40,24 +40,22 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, AL
|
||||
AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots)
|
||||
{
|
||||
ALCcontext *Context;
|
||||
ALsizei i=0, j;
|
||||
ALCdevice *Device;
|
||||
|
||||
Context = GetContextSuspended();
|
||||
if(!Context) return;
|
||||
|
||||
if(n < 0)
|
||||
Device = Context->Device;
|
||||
if(n < 0 || IsBadWritePtr((void*)effectslots, n * sizeof(ALuint)))
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else if((ALuint)n > Device->AuxiliaryEffectSlotMax - Context->EffectSlotMap.size)
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
ALCdevice *Device = Context->Device;
|
||||
|
||||
if((ALuint)n <= Device->AuxiliaryEffectSlotMax - Context->EffectSlotMap.size)
|
||||
{
|
||||
// Check that enough memory has been allocted in the 'effectslots' array for n Effect Slots
|
||||
if(!IsBadWritePtr((void*)effectslots, n * sizeof(ALuint)))
|
||||
{
|
||||
ALenum err;
|
||||
ALsizei i, j;
|
||||
|
||||
i = 0;
|
||||
while(i < n)
|
||||
{
|
||||
ALeffectslot *slot = calloc(1, sizeof(ALeffectslot));
|
||||
@ -98,10 +96,6 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo
|
||||
slot->refcount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
alSetError(Context, AL_INVALID_OPERATION);
|
||||
}
|
||||
|
||||
ProcessContext(Context);
|
||||
}
|
||||
|
@ -114,19 +114,14 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers)
|
||||
Context = GetContextSuspended();
|
||||
if(!Context) return;
|
||||
|
||||
// Check that we are actually generation some Buffers
|
||||
if(n < 0)
|
||||
// Check that we are actually generating some Buffers
|
||||
if(n < 0 || IsBadWritePtr((void*)buffers, n * sizeof(ALuint)))
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
ALCdevice *device = Context->Device;
|
||||
ALenum err;
|
||||
|
||||
// Check the pointer is valid (and points to enough memory to store Buffer Names)
|
||||
if(IsBadWritePtr((void*)buffers, n * sizeof(ALuint)))
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
// Create all the new Buffers
|
||||
while(i < n)
|
||||
{
|
||||
@ -139,8 +134,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers)
|
||||
}
|
||||
|
||||
buffer->buffer = (ALuint)ALTHUNK_ADDENTRY(buffer);
|
||||
err = InsertUIntMapEntry(&device->BufferMap, buffer->buffer,
|
||||
buffer);
|
||||
err = InsertUIntMapEntry(&device->BufferMap, buffer->buffer, buffer);
|
||||
if(err != AL_NO_ERROR)
|
||||
{
|
||||
ALTHUNK_REMOVEENTRY(buffer->buffer);
|
||||
@ -154,7 +148,6 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers)
|
||||
buffers[i++] = buffer->buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProcessContext(Context);
|
||||
}
|
||||
|
@ -48,14 +48,11 @@ AL_API ALvoid AL_APIENTRY alGenDatabuffersEXT(ALsizei n,ALuint *puiBuffers)
|
||||
if(!Context) return;
|
||||
|
||||
/* Check that we are actually generation some Databuffers */
|
||||
if(n > 0)
|
||||
if(n < 0 || IsBadWritePtr((void*)puiBuffers, n * sizeof(ALuint)))
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
ALCdevice *device = Context->Device;
|
||||
|
||||
/* Check the pointer is valid (and points to enough memory to store
|
||||
* Databuffer Names) */
|
||||
if(!IsBadWritePtr((void*)puiBuffers, n * sizeof(ALuint)))
|
||||
{
|
||||
ALenum err;
|
||||
|
||||
/* Create all the new Databuffers */
|
||||
@ -87,9 +84,6 @@ AL_API ALvoid AL_APIENTRY alGenDatabuffersEXT(ALsizei n,ALuint *puiBuffers)
|
||||
buffer->state = UNMAPPED;
|
||||
}
|
||||
}
|
||||
else
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
}
|
||||
|
||||
ProcessContext(Context);
|
||||
}
|
||||
|
@ -46,13 +46,11 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
|
||||
Context = GetContextSuspended();
|
||||
if(!Context) return;
|
||||
|
||||
if (n > 0)
|
||||
if(n < 0 || IsBadWritePtr((void*)effects, n * sizeof(ALuint)))
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
ALCdevice *device = Context->Device;
|
||||
|
||||
// Check that enough memory has been allocted in the 'effects' array for n Effects
|
||||
if (!IsBadWritePtr((void*)effects, n * sizeof(ALuint)))
|
||||
{
|
||||
ALenum err;
|
||||
|
||||
while(i < n)
|
||||
@ -66,8 +64,7 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
|
||||
}
|
||||
|
||||
effect->effect = ALTHUNK_ADDENTRY(effect);
|
||||
err = InsertUIntMapEntry(&device->EffectMap, effect->effect,
|
||||
effect);
|
||||
err = InsertUIntMapEntry(&device->EffectMap, effect->effect, effect);
|
||||
if(err != AL_NO_ERROR)
|
||||
{
|
||||
ALTHUNK_REMOVEENTRY(effect->effect);
|
||||
@ -83,7 +80,6 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
|
||||
InitEffectParams(effect, AL_EFFECT_NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProcessContext(Context);
|
||||
}
|
||||
|
@ -42,13 +42,11 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters)
|
||||
Context = GetContextSuspended();
|
||||
if(!Context) return;
|
||||
|
||||
if (n > 0)
|
||||
if(n < 0 || IsBadWritePtr((void*)filters, n * sizeof(ALuint)))
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
ALCdevice *device = Context->Device;
|
||||
|
||||
// Check that enough memory has been allocted in the 'filters' array for n Filters
|
||||
if (!IsBadWritePtr((void*)filters, n * sizeof(ALuint)))
|
||||
{
|
||||
ALenum err;
|
||||
|
||||
while(i < n)
|
||||
@ -62,8 +60,7 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters)
|
||||
}
|
||||
|
||||
filter->filter = ALTHUNK_ADDENTRY(filter);
|
||||
err = InsertUIntMapEntry(&device->FilterMap, filter->filter,
|
||||
filter);
|
||||
err = InsertUIntMapEntry(&device->FilterMap, filter->filter, filter);
|
||||
if(err != AL_NO_ERROR)
|
||||
{
|
||||
ALTHUNK_REMOVEENTRY(filter->filter);
|
||||
@ -79,7 +76,6 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters)
|
||||
InitFilterParams(filter, AL_FILTER_NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProcessContext(Context);
|
||||
}
|
||||
|
@ -47,26 +47,22 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n,ALuint *sources)
|
||||
{
|
||||
ALCcontext *Context;
|
||||
ALCdevice *Device;
|
||||
ALsizei i=0;
|
||||
|
||||
Context = GetContextSuspended();
|
||||
if(!Context) return;
|
||||
|
||||
if(n < 0)
|
||||
Device = Context->Device;
|
||||
if(n < 0 || IsBadWritePtr((void*)sources, n * sizeof(ALuint)))
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else if((ALuint)n > Device->MaxNoOfSources - Context->SourceMap.size)
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
Device = Context->Device;
|
||||
|
||||
// Check that enough memory has been allocted in the 'sources' array for n Sources
|
||||
if(!IsBadWritePtr((void*)sources, n * sizeof(ALuint)))
|
||||
{
|
||||
// Check that the requested number of sources can be generated
|
||||
if((ALuint)n <= Device->MaxNoOfSources - Context->SourceMap.size)
|
||||
{
|
||||
ALenum err;
|
||||
ALsizei i;
|
||||
|
||||
// Add additional sources to the list
|
||||
i = 0;
|
||||
while(i < n)
|
||||
{
|
||||
ALsource *source = calloc(1, sizeof(ALsource));
|
||||
@ -95,18 +91,6 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n,ALuint *sources)
|
||||
InitSourceParams(source);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not enough resources to create the Sources
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Bad pointer
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
ProcessContext(Context);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user