Clean up whitespace in src/hostapi/{asihpi, jack, oss, skeleton} in preparation for .editorconfig. (#414)

* Clean up whitespace in src/hostapi/{asihpi, jack, oss, skeleton} in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure EOL at EOF.

* Additional formatting cleanups.
This commit is contained in:
Ross Bencina 2021-01-21 21:58:54 +11:00 committed by GitHub
commit 20a971df57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 128 additions and 129 deletions

View file

@ -199,27 +199,27 @@
/* If HPI error occurred */ \
if( UNLIKELY( hpiError ) ) \
{ \
char szError[256]; \
HPI_GetErrorText( hpiError, szError ); \
PA_DEBUG(( "HPI error %d occurred: %s\n", hpiError, szError )); \
/* This message will always be displayed, even if debug info is disabled */ \
char szError[256]; \
HPI_GetErrorText( hpiError, szError ); \
PA_DEBUG(( "HPI error %d occurred: %s\n", hpiError, szError )); \
/* This message will always be displayed, even if debug info is disabled */ \
PA_DEBUG(( "Expression '" #expr "' failed in '" __FILE__ "', line: " STRINGIZE( __LINE__ ) "\n" )); \
if( (paError) == paUnanticipatedHostError ) \
{ \
PA_DEBUG(( "Host error description: %s\n", szError )); \
/* PaUtil_SetLastHostErrorInfo should only be used in the main thread */ \
if( pthread_equal( pthread_self(), paUnixMainThread ) ) \
{ \
PA_DEBUG(( "Host error description: %s\n", szError )); \
/* PaUtil_SetLastHostErrorInfo should only be used in the main thread */ \
if( pthread_equal( pthread_self(), paUnixMainThread ) ) \
{ \
PaUtil_SetLastHostErrorInfo( paInDevelopment, hpiError, szError ); \
PaUtil_SetLastHostErrorInfo( paInDevelopment, hpiError, szError ); \
} \
} \
/* If paNoError is specified, continue as usual */ \
} \
/* If paNoError is specified, continue as usual */ \
/* (useful if you only want to print out the debug messages above) */ \
if( (paError) < 0 ) \
{ \
result = (paError); \
goto error; \
} \
if( (paError) < 0 ) \
{ \
result = (paError); \
goto error; \
} \
} \
} while( 0 );
@ -231,9 +231,9 @@
PA_DEBUG(( "HPI error %d occurred: %s\n", hpiError, szError )); \
/* PaUtil_SetLastHostErrorInfo should only be used in the main thread */ \
if( pthread_equal( pthread_self(), paUnixMainThread ) ) \
{ \
PaUtil_SetLastHostErrorInfo( paInDevelopment, (hpiErrorCode), szError ); \
} \
{ \
PaUtil_SetLastHostErrorInfo( paInDevelopment, (hpiErrorCode), szError ); \
} \
} while( 0 );
/* Defaults */
@ -556,7 +556,7 @@ static PaError PaAsiHpi_BuildDeviceList( PaAsiHpiHostApiRepresentation *hpiHostA
continue;
}
hpiError = HPI_AdapterGetInfo( NULL, idx, &outStreams, &inStreams,
&version, &serial, &type );
&version, &serial, &type );
/* Skip to next device on failure */
if( hpiError )
{
@ -738,7 +738,7 @@ PaError PaAsiHpi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
* interface and paNoError */
PA_DEBUG(( "Could not open HPI interface\n" ));
*hostApi = NULL;
*hostApi = NULL;
return paNoError;
}
else
@ -1584,7 +1584,7 @@ static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, uint3
/* If BBM not supported, foreground transfers will be used, but not a show-stopper */
/* Anything else is an error */
else if (( hpiError != HPI_ERROR_INVALID_OPERATION ) &&
( hpiError != HPI_ERROR_INVALID_FUNC ))
( hpiError != HPI_ERROR_INVALID_FUNC ))
{
PA_ASIHPI_REPORT_ERROR_( hpiError );
result = paUnanticipatedHostError;

View file

@ -277,10 +277,10 @@ static PaError BlockingTermFIFO( PaUtilRingBuffer *rbuf )
static int
BlockingCallback( const void *inputBuffer,
void *outputBuffer,
unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags,
void *userData )
unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags,
void *userData )
{
struct PaJackStream *stream = (PaJackStream *)userData;
long numBytes = stream->bytesPerFrame * framesPerBuffer;
@ -918,7 +918,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
#define ABS(x) ( (x) > 0 ? (x) : -(x) )
if( ABS(sampleRate - jack_get_sample_rate(((PaJackHostApiRepresentation *) hostApi)->jack_client )) > 1 )
return paInvalidSampleRate;
return paInvalidSampleRate;
#undef ABS
return paFormatIsSupported;
@ -1161,7 +1161,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
#define ABS(x) ( (x) > 0 ? (x) : -(x) )
if( ABS(sampleRate - jackSr) > 1 )
return paInvalidSampleRate;
return paInvalidSampleRate;
#undef ABS
UNLESS( stream = (PaJackStream*)PaUtil_AllocateMemory( sizeof(PaJackStream) ), paInsufficientMemory );
@ -1610,7 +1610,7 @@ static PaError StartStream( PaStream *s )
{
int r = jack_connect( stream->jack_client, jack_port_name( stream->remote_output_ports[i] ),
jack_port_name( stream->local_input_ports[i] ) );
UNLESS( 0 == r || EEXIST == r, paUnanticipatedHostError );
UNLESS( 0 == r || EEXIST == r, paUnanticipatedHostError );
}
}
@ -1620,7 +1620,7 @@ static PaError StartStream( PaStream *s )
{
int r = jack_connect( stream->jack_client, jack_port_name( stream->local_output_ports[i] ),
jack_port_name( stream->remote_input_ports[i] ) );
UNLESS( 0 == r || EEXIST == r, paUnanticipatedHostError );
UNLESS( 0 == r || EEXIST == r, paUnanticipatedHostError );
}
}

View file

@ -537,40 +537,40 @@ static PaError BuildDeviceList( PaOSSHostApiRepresentation *ossApi )
for( i = -1; i < 100; i++ )
{
char deviceName[32];
PaDeviceInfo *deviceInfo;
int testResult;
char deviceName[32];
PaDeviceInfo *deviceInfo;
int testResult;
if( i == -1 )
snprintf(deviceName, sizeof (deviceName), "%s", DEVICE_NAME_BASE);
else
snprintf(deviceName, sizeof (deviceName), "%s%d", DEVICE_NAME_BASE, i);
if( i == -1 )
snprintf(deviceName, sizeof (deviceName), "%s", DEVICE_NAME_BASE);
else
snprintf(deviceName, sizeof (deviceName), "%s%d", DEVICE_NAME_BASE, i);
/* PA_DEBUG(("%s: trying device %s\n", __FUNCTION__, deviceName )); */
if( (testResult = QueryDevice( deviceName, ossApi, &deviceInfo )) != paNoError )
{
if( testResult != paDeviceUnavailable )
PA_ENSURE( testResult );
/* PA_DEBUG(("%s: trying device %s\n", __FUNCTION__, deviceName )); */
if( (testResult = QueryDevice( deviceName, ossApi, &deviceInfo )) != paNoError )
{
if( testResult != paDeviceUnavailable )
PA_ENSURE( testResult );
continue;
}
continue;
}
++numDevices;
if( !deviceInfos || numDevices > maxDeviceInfos )
{
maxDeviceInfos *= 2;
PA_UNLESS( deviceInfos = (PaDeviceInfo **) realloc( deviceInfos, maxDeviceInfos * sizeof (PaDeviceInfo *) ),
paInsufficientMemory );
}
{
int devIdx = numDevices - 1;
deviceInfos[devIdx] = deviceInfo;
++numDevices;
if( !deviceInfos || numDevices > maxDeviceInfos )
{
maxDeviceInfos *= 2;
PA_UNLESS( deviceInfos = (PaDeviceInfo **) realloc( deviceInfos, maxDeviceInfos * sizeof (PaDeviceInfo *) ),
paInsufficientMemory );
}
{
int devIdx = numDevices - 1;
deviceInfos[devIdx] = deviceInfo;
if( commonApi->info.defaultInputDevice == paNoDevice && deviceInfo->maxInputChannels > 0 )
commonApi->info.defaultInputDevice = devIdx;
if( commonApi->info.defaultOutputDevice == paNoDevice && deviceInfo->maxOutputChannels > 0 )
commonApi->info.defaultOutputDevice = devIdx;
}
if( commonApi->info.defaultInputDevice == paNoDevice && deviceInfo->maxInputChannels > 0 )
commonApi->info.defaultInputDevice = devIdx;
if( commonApi->info.defaultOutputDevice == paNoDevice && deviceInfo->maxOutputChannels > 0 )
commonApi->info.defaultOutputDevice = devIdx;
}
}
/* Make an array of PaDeviceInfo pointers out of the linked list */
@ -670,14 +670,14 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
/* if full duplex, make sure that they're the same device */
if (inputChannelCount > 0 && outputChannelCount > 0 &&
inputParameters->device != outputParameters->device)
inputParameters->device != outputParameters->device)
return paInvalidDevice;
/* if full duplex, also make sure that they're the same number of channels */
if (inputChannelCount > 0 && outputChannelCount > 0 &&
inputChannelCount != outputChannelCount)
return paInvalidChannelCount;
inputChannelCount != outputChannelCount)
return paInvalidChannelCount;
/* open the device so we can do more tests */
@ -699,11 +699,11 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
flags = O_NONBLOCK;
if (inputChannelCount > 0 && outputChannelCount > 0)
flags |= O_RDWR;
flags |= O_RDWR;
else if (inputChannelCount > 0)
flags |= O_RDONLY;
flags |= O_RDONLY;
else
flags |= O_WRONLY;
flags |= O_WRONLY;
ENSURE_( tempDevHandle = open( deviceInfo->name, flags ), paDeviceUnavailable );
@ -712,7 +712,7 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
/* everything succeeded! */
error:
error:
if( tempDevHandle >= 0 )
close( tempDevHandle );
@ -734,8 +734,7 @@ static PaError ValidateParameters( const PaStreamParameters *parameters, const P
return paInvalidDevice;
}
maxChans = (mode == StreamMode_In ? deviceInfo->maxInputChannels :
deviceInfo->maxOutputChannels);
maxChans = (mode == StreamMode_In ? deviceInfo->maxInputChannels : deviceInfo->maxOutputChannels);
if( parameters->channelCount > maxChans )
{
return paInvalidChannelCount;
@ -1617,7 +1616,7 @@ static void *PaOSS_AudioThreadProc( void *userData )
assert( stream );
pthread_cleanup_push( &OnExit, stream ); /* Execute OnExit when exiting */
pthread_cleanup_push( &OnExit, stream ); /* Execute OnExit when exiting */
/* The first time the stream is started we use SNDCTL_DSP_TRIGGER to accurately start capture and
* playback in sync, when the stream is restarted after being stopped we simply start by reading/
@ -1948,19 +1947,19 @@ static PaError ReadStream( PaStream* s,
{
framesRequested = PA_MIN( frames, stream->capture->hostFrames );
bytesRequested = framesRequested * PaOssStreamComponent_FrameSize( stream->capture );
ENSURE_( (bytesRead = read( stream->capture->fd, stream->capture->buffer, bytesRequested )),
paUnanticipatedHostError );
if ( bytesRequested != bytesRead )
{
PA_DEBUG(( "Requested %d bytes, read %d\n", bytesRequested, bytesRead ));
return paUnanticipatedHostError;
}
bytesRequested = framesRequested * PaOssStreamComponent_FrameSize( stream->capture );
ENSURE_( (bytesRead = read( stream->capture->fd, stream->capture->buffer, bytesRequested )),
paUnanticipatedHostError );
if ( bytesRequested != bytesRead )
{
PA_DEBUG(( "Requested %d bytes, read %d\n", bytesRequested, bytesRead ));
return paUnanticipatedHostError;
}
PaUtil_SetInputFrameCount( &stream->bufferProcessor, stream->capture->hostFrames );
PaUtil_SetInterleavedInputChannels( &stream->bufferProcessor, 0, stream->capture->buffer, stream->capture->hostChannelCount );
PaUtil_SetInputFrameCount( &stream->bufferProcessor, stream->capture->hostFrames );
PaUtil_SetInterleavedInputChannels( &stream->bufferProcessor, 0, stream->capture->buffer, stream->capture->hostChannelCount );
PaUtil_CopyInput( &stream->bufferProcessor, &userBuffer, framesRequested );
frames -= framesRequested;
frames -= framesRequested;
}
error:
@ -1989,21 +1988,21 @@ static PaError WriteStream( PaStream *s, const void *buffer, unsigned long frame
while( frames )
{
PaUtil_SetOutputFrameCount( &stream->bufferProcessor, stream->playback->hostFrames );
PaUtil_SetInterleavedOutputChannels( &stream->bufferProcessor, 0, stream->playback->buffer, stream->playback->hostChannelCount );
PaUtil_SetOutputFrameCount( &stream->bufferProcessor, stream->playback->hostFrames );
PaUtil_SetInterleavedOutputChannels( &stream->bufferProcessor, 0, stream->playback->buffer, stream->playback->hostChannelCount );
framesConverted = PaUtil_CopyOutput( &stream->bufferProcessor, &userBuffer, frames );
frames -= framesConverted;
framesConverted = PaUtil_CopyOutput( &stream->bufferProcessor, &userBuffer, frames );
frames -= framesConverted;
bytesRequested = framesConverted * PaOssStreamComponent_FrameSize( stream->playback );
ENSURE_( (bytesWritten = write( stream->playback->fd, stream->playback->buffer, bytesRequested )),
paUnanticipatedHostError );
bytesRequested = framesConverted * PaOssStreamComponent_FrameSize( stream->playback );
ENSURE_( (bytesWritten = write( stream->playback->fd, stream->playback->buffer, bytesRequested )),
paUnanticipatedHostError );
if ( bytesRequested != bytesWritten )
{
PA_DEBUG(( "Requested %d bytes, wrote %d\n", bytesRequested, bytesWritten ));
return paUnanticipatedHostError;
}
if ( bytesRequested != bytesWritten )
{
PA_DEBUG(( "Requested %d bytes, wrote %d\n", bytesRequested, bytesWritten ));
return paUnanticipatedHostError;
}
}
error: