Reduce some more indentation
This commit is contained in:
parent
8a1d5a21c3
commit
97daaade8a
@ -104,39 +104,44 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effect
|
||||
{
|
||||
ALCcontext *Context;
|
||||
ALeffectslot *EffectSlot;
|
||||
ALboolean SlotsValid = AL_FALSE;
|
||||
ALsizei i;
|
||||
|
||||
Context = GetContextSuspended();
|
||||
if(!Context) return;
|
||||
|
||||
if (n >= 0)
|
||||
if(n < 0)
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
SlotsValid = AL_TRUE;
|
||||
// Check that all effectslots are valid
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslots[i])) == NULL)
|
||||
{
|
||||
alSetError(Context, AL_INVALID_NAME);
|
||||
SlotsValid = AL_FALSE;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(EffectSlot->refcount > 0)
|
||||
else if(EffectSlot->refcount > 0)
|
||||
{
|
||||
alSetError(Context, AL_INVALID_NAME);
|
||||
SlotsValid = AL_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i == n)
|
||||
if(SlotsValid)
|
||||
{
|
||||
// All effectslots are valid
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
// Recheck that the effectslot is valid, because there could be duplicated names
|
||||
if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslots[i])) != NULL)
|
||||
{
|
||||
if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslots[i])) == NULL)
|
||||
continue;
|
||||
|
||||
ALEffect_Destroy(EffectSlot->EffectState);
|
||||
|
||||
RemoveUIntMapKey(&Context->EffectSlotMap, EffectSlot->effectslot);
|
||||
@ -146,10 +151,6 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effect
|
||||
free(EffectSlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
|
||||
ProcessContext(Context);
|
||||
}
|
||||
|
@ -157,60 +157,62 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers)
|
||||
*
|
||||
* Deletes the n AL Buffers pointed to by puiBuffers
|
||||
*/
|
||||
AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *puiBuffers)
|
||||
AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers)
|
||||
{
|
||||
ALCcontext *Context;
|
||||
ALCdevice *device;
|
||||
ALboolean Failed;
|
||||
ALbuffer *ALBuf;
|
||||
ALsizei i;
|
||||
|
||||
Context = GetContextSuspended();
|
||||
if(!Context) return;
|
||||
|
||||
// Check we are actually Deleting some Buffers
|
||||
Failed = AL_TRUE;
|
||||
device = Context->Device;
|
||||
/* Check we are actually Deleting some Buffers */
|
||||
if(n < 0)
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
ALCdevice *device = Context->Device;
|
||||
ALboolean bFailed = AL_FALSE;
|
||||
Failed = AL_FALSE;
|
||||
|
||||
// Check that all the buffers are valid and can actually be deleted
|
||||
/* Check that all the buffers are valid and can actually be deleted */
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
if(!puiBuffers[i])
|
||||
if(!buffers[i])
|
||||
continue;
|
||||
|
||||
// Check for valid Buffer ID (can be NULL buffer)
|
||||
if((ALBuf=LookupBuffer(device->BufferMap, puiBuffers[i])) != NULL)
|
||||
{
|
||||
if(ALBuf->refcount != 0)
|
||||
{
|
||||
// Buffer still in use, cannot be deleted
|
||||
alSetError(Context, AL_INVALID_OPERATION);
|
||||
bFailed = AL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
/* Check for valid Buffer ID (can be NULL buffer) */
|
||||
if((ALBuf=LookupBuffer(device->BufferMap, buffers[i])) == NULL)
|
||||
{
|
||||
// Invalid Buffer
|
||||
alSetError(Context, AL_INVALID_NAME);
|
||||
bFailed = AL_TRUE;
|
||||
Failed = AL_TRUE;
|
||||
break;
|
||||
}
|
||||
else if(ALBuf->refcount != 0)
|
||||
{
|
||||
/* Buffer still in use, cannot be deleted */
|
||||
alSetError(Context, AL_INVALID_OPERATION);
|
||||
Failed = AL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If all the Buffers were valid (and have Reference Counts of 0), then we can delete them
|
||||
if(!bFailed)
|
||||
/* If all the Buffers were valid (and have Reference Counts of 0), then we can delete them */
|
||||
if(!Failed)
|
||||
{
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
if((ALBuf=LookupBuffer(device->BufferMap, puiBuffers[i])) != NULL)
|
||||
{
|
||||
// Release the memory used to store audio data
|
||||
if((ALBuf=LookupBuffer(device->BufferMap, buffers[i])) == NULL)
|
||||
continue;
|
||||
|
||||
/* Release the memory used to store audio data */
|
||||
free(ALBuf->data);
|
||||
|
||||
// Release buffer structure
|
||||
/* Release buffer structure */
|
||||
RemoveUIntMapKey(&device->BufferMap, ALBuf->buffer);
|
||||
ALTHUNK_REMOVEENTRY(ALBuf->buffer);
|
||||
|
||||
@ -218,8 +220,6 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *puiBuffers)
|
||||
free(ALBuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProcessContext(Context);
|
||||
}
|
||||
|
@ -93,56 +93,58 @@ AL_API ALvoid AL_APIENTRY alGenDatabuffersEXT(ALsizei n,ALuint *puiBuffers)
|
||||
*
|
||||
* Deletes the n AL Databuffers pointed to by puiBuffers
|
||||
*/
|
||||
AL_API ALvoid AL_APIENTRY alDeleteDatabuffersEXT(ALsizei n, const ALuint *puiBuffers)
|
||||
AL_API ALvoid AL_APIENTRY alDeleteDatabuffersEXT(ALsizei n, const ALuint *buffers)
|
||||
{
|
||||
ALCcontext *Context;
|
||||
ALCdevice *device;
|
||||
ALdatabuffer *ALBuf;
|
||||
ALboolean Failed;
|
||||
ALsizei i;
|
||||
ALboolean bFailed = AL_FALSE;
|
||||
|
||||
Context = GetContextSuspended();
|
||||
if(!Context) return;
|
||||
|
||||
/* Check we are actually Deleting some Databuffers */
|
||||
if(n >= 0)
|
||||
Failed = AL_TRUE;
|
||||
device = Context->Device;
|
||||
if(n < 0)
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
ALCdevice *device = Context->Device;
|
||||
|
||||
Failed = AL_FALSE;
|
||||
/* Check that all the databuffers are valid and can actually be
|
||||
* deleted */
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
if(!puiBuffers[i])
|
||||
if(!buffers[i])
|
||||
continue;
|
||||
|
||||
/* Check for valid Buffer ID */
|
||||
if((ALBuf=LookupDatabuffer(device->DatabufferMap, puiBuffers[i])) != NULL)
|
||||
{
|
||||
if(ALBuf->state != UNMAPPED)
|
||||
{
|
||||
/* Databuffer still in use, cannot be deleted */
|
||||
alSetError(Context, AL_INVALID_OPERATION);
|
||||
bFailed = AL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
if((ALBuf=LookupDatabuffer(device->DatabufferMap, buffers[i])) == NULL)
|
||||
{
|
||||
/* Invalid Databuffer */
|
||||
alSetError(Context, AL_INVALID_NAME);
|
||||
bFailed = AL_TRUE;
|
||||
Failed = AL_TRUE;
|
||||
break;
|
||||
}
|
||||
else if(ALBuf->state != UNMAPPED)
|
||||
{
|
||||
/* Databuffer still in use, cannot be deleted */
|
||||
alSetError(Context, AL_INVALID_OPERATION);
|
||||
Failed = AL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If all the Databuffers were valid (and unmapped), then we can
|
||||
* delete them */
|
||||
if(!bFailed)
|
||||
/* If all the Databuffers were valid (and unmapped), then we can delete them */
|
||||
if(!Failed)
|
||||
{
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
if((ALBuf=LookupDatabuffer(device->DatabufferMap, puiBuffers[i])) != NULL)
|
||||
{
|
||||
if((ALBuf=LookupDatabuffer(device->DatabufferMap, buffers[i])) == NULL)
|
||||
continue;
|
||||
|
||||
if(ALBuf == Context->SampleSource)
|
||||
Context->SampleSource = NULL;
|
||||
if(ALBuf == Context->SampleSink)
|
||||
@ -159,10 +161,6 @@ AL_API ALvoid AL_APIENTRY alDeleteDatabuffersEXT(ALsizei n, const ALuint *puiBuf
|
||||
free(ALBuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
|
||||
ProcessContext(Context);
|
||||
}
|
||||
|
@ -87,37 +87,45 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
|
||||
AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects)
|
||||
{
|
||||
ALCcontext *Context;
|
||||
ALCdevice *device;
|
||||
ALeffect *ALEffect;
|
||||
ALboolean Failed;
|
||||
ALsizei i;
|
||||
|
||||
Context = GetContextSuspended();
|
||||
if(!Context) return;
|
||||
|
||||
if (n >= 0)
|
||||
Failed = AL_TRUE;
|
||||
device = Context->Device;
|
||||
if(n < 0)
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
ALCdevice *device = Context->Device;
|
||||
|
||||
Failed = AL_FALSE;
|
||||
// Check that all effects are valid
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
if(!effects[i])
|
||||
continue;
|
||||
|
||||
if(!LookupEffect(device->EffectMap, effects[i]))
|
||||
if(LookupEffect(device->EffectMap, effects[i]) == NULL)
|
||||
{
|
||||
alSetError(Context, AL_INVALID_NAME);
|
||||
Failed = AL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i == n)
|
||||
if(!Failed)
|
||||
{
|
||||
// All effects are valid
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
// Recheck that the effect is valid, because there could be duplicated names
|
||||
if((ALEffect=LookupEffect(device->EffectMap, effects[i])) != NULL)
|
||||
{
|
||||
if((ALEffect=LookupEffect(device->EffectMap, effects[i])) == NULL)
|
||||
continue;
|
||||
|
||||
RemoveUIntMapKey(&device->EffectMap, ALEffect->effect);
|
||||
ALTHUNK_REMOVEENTRY(ALEffect->effect);
|
||||
|
||||
@ -125,10 +133,6 @@ AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects)
|
||||
free(ALEffect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
|
||||
ProcessContext(Context);
|
||||
}
|
||||
|
@ -83,37 +83,45 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters)
|
||||
AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters)
|
||||
{
|
||||
ALCcontext *Context;
|
||||
ALCdevice *device;
|
||||
ALfilter *ALFilter;
|
||||
ALboolean Failed;
|
||||
ALsizei i;
|
||||
|
||||
Context = GetContextSuspended();
|
||||
if(!Context) return;
|
||||
|
||||
if (n >= 0)
|
||||
Failed = AL_TRUE;
|
||||
device = Context->Device;
|
||||
if(n < 0)
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
ALCdevice *device = Context->Device;
|
||||
|
||||
Failed = AL_FALSE;
|
||||
// Check that all filters are valid
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
if(!filters[i])
|
||||
continue;
|
||||
|
||||
if(!LookupFilter(device->FilterMap, filters[i]))
|
||||
if(LookupFilter(device->FilterMap, filters[i]) == NULL)
|
||||
{
|
||||
alSetError(Context, AL_INVALID_NAME);
|
||||
Failed = AL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i == n)
|
||||
if(!Failed)
|
||||
{
|
||||
// All filters are valid
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
// Recheck that the filter is valid, because there could be duplicated names
|
||||
if((ALFilter=LookupFilter(device->FilterMap, filters[i])) != NULL)
|
||||
{
|
||||
if((ALFilter=LookupFilter(device->FilterMap, filters[i])) == NULL)
|
||||
continue;
|
||||
|
||||
RemoveUIntMapKey(&device->FilterMap, ALFilter->filter);
|
||||
ALTHUNK_REMOVEENTRY(ALFilter->filter);
|
||||
|
||||
@ -121,10 +129,6 @@ AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters)
|
||||
free(ALFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
|
||||
ProcessContext(Context);
|
||||
}
|
||||
|
@ -99,11 +99,10 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n,ALuint *sources)
|
||||
AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources)
|
||||
{
|
||||
ALCcontext *Context;
|
||||
ALCdevice *Device;
|
||||
ALsource *Source;
|
||||
ALsizei i, j;
|
||||
ALbufferlistitem *BufferList;
|
||||
ALboolean bSourcesValid = AL_TRUE;
|
||||
ALboolean SourcesValid = AL_FALSE;
|
||||
|
||||
Context = GetContextSuspended();
|
||||
if(!Context) return;
|
||||
@ -112,27 +111,28 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources)
|
||||
alSetError(Context, AL_INVALID_VALUE);
|
||||
else
|
||||
{
|
||||
Device = Context->Device;
|
||||
|
||||
SourcesValid = AL_TRUE;
|
||||
// Check that all Sources are valid (and can therefore be deleted)
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
if(LookupSource(Context->SourceMap, sources[i]) == NULL)
|
||||
{
|
||||
alSetError(Context, AL_INVALID_NAME);
|
||||
bSourcesValid = AL_FALSE;
|
||||
SourcesValid = AL_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(bSourcesValid)
|
||||
if(SourcesValid)
|
||||
{
|
||||
// All Sources are valid, and can be deleted
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
// Recheck that the Source is valid, because there could be duplicated Source names
|
||||
if((Source=LookupSource(Context->SourceMap, sources[i])) != NULL)
|
||||
{
|
||||
if((Source=LookupSource(Context->SourceMap, sources[i])) == NULL)
|
||||
continue;
|
||||
|
||||
for(j = 0;j < Context->ActiveSourceCount;j++)
|
||||
{
|
||||
if(Context->ActiveSources[j] == Source)
|
||||
@ -143,7 +143,7 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources)
|
||||
}
|
||||
}
|
||||
|
||||
// For each buffer in the source's queue, decrement its reference counter and remove it
|
||||
// For each buffer in the source's queue...
|
||||
while(Source->queue != NULL)
|
||||
{
|
||||
BufferList = Source->queue;
|
||||
@ -171,8 +171,6 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources)
|
||||
free(Source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProcessContext(Context);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user