diff --git a/base/services/audiosrv/main.c b/base/services/audiosrv/main.c index b9324b015d1..efbff7dc81e 100644 --- a/base/services/audiosrv/main.c +++ b/base/services/audiosrv/main.c @@ -14,7 +14,7 @@ SERVICE_STATUS service_status; /* This is for testing only! */ VOID -InitializeFakeDevice() +InitializeFakeDevice(VOID) { PnP_AudioDevice* list_node; @@ -30,7 +30,7 @@ ServiceControlHandler( LPVOID lpEventData, LPVOID lpContext) { - switch ( dwControl ) + switch (dwControl) { case SERVICE_CONTROL_INTERROGATE : { @@ -85,7 +85,7 @@ ServiceMain(DWORD argc, LPWSTR argv) NULL); logmsg("Service status handle %d\n", service_status_handle); - if ( ! service_status_handle ) + if (!service_status_handle) { logmsg("Failed to register service control handler\n"); /* FIXME - we should fail */ @@ -105,7 +105,7 @@ ServiceMain(DWORD argc, LPWSTR argv) logmsg("Creating audio device list\n"); /* This creates the audio device list and mutex */ - if ( ! CreateAudioDeviceList(AUDIO_LIST_MAX_SIZE) ) + if (!CreateAudioDeviceList(AUDIO_LIST_MAX_SIZE)) { logmsg("Failed to create audio device list\n"); service_status.dwCurrentState = SERVICE_STOPPED; @@ -116,7 +116,7 @@ ServiceMain(DWORD argc, LPWSTR argv) logmsg("Registering for device notifications\n"); /* We want to know when devices are added/removed */ - if ( ! RegisterForDeviceNotifications() ) + if (!RegisterForDeviceNotifications()) { /* FIXME: This is not fatal at present as ROS does not support this */ logmsg("Failed to register for device notifications\n"); @@ -132,12 +132,11 @@ ServiceMain(DWORD argc, LPWSTR argv) /* start system audio services */ StartSystemAudioServices(); - InitializeFakeDevice(); logmsg("Processing existing devices\n"); /* Now find any devices that already exist on the system */ - if ( ! ProcessExistingDevices() ) + if (!ProcessExistingDevices()) { logmsg("Could not process existing devices\n"); UnregisterDeviceNotifications(); @@ -156,7 +155,7 @@ ServiceMain(DWORD argc, LPWSTR argv) SetServiceStatus(service_status_handle, &service_status); } -int wmain() +int wmain(VOID) { SERVICE_TABLE_ENTRYW service_table[] = { diff --git a/base/services/audiosrv/pnp.c b/base/services/audiosrv/pnp.c index 764c4215baf..7db8a550569 100644 --- a/base/services/audiosrv/pnp.c +++ b/base/services/audiosrv/pnp.c @@ -23,7 +23,7 @@ static HDEVNOTIFY device_notification_handle = NULL; */ BOOL -ProcessExistingDevices() +ProcessExistingDevices(VOID) { SP_DEVICE_INTERFACE_DATA interface_data; SP_DEVINFO_DATA device_data; @@ -124,7 +124,7 @@ ProcessDeviceArrival(DEV_BROADCAST_DEVICEINTERFACE* device) */ BOOL -RegisterForDeviceNotifications() +RegisterForDeviceNotifications(VOID) { DEV_BROADCAST_DEVICEINTERFACE notification_filter; @@ -141,8 +141,7 @@ RegisterForDeviceNotifications() DEVICE_NOTIFY_SERVICE_HANDLE /* | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES*/); - - if ( ! device_notification_handle ) + if (!device_notification_handle) { logmsg("RegisterDeviceNotification() failed with error %d\n", GetLastError()); } @@ -156,11 +155,12 @@ RegisterForDeviceNotifications() called. */ -VOID UnregisterDeviceNotifications() +VOID +UnregisterDeviceNotifications(VOID) { /* TODO -- NOT IMPLEMENTED! */ - if ( device_notification_handle ) + if (device_notification_handle) { /* TODO */ device_notification_handle = NULL; @@ -177,12 +177,12 @@ HandleDeviceEvent( DWORD dwEventType, LPVOID lpEventData) { - switch ( dwEventType ) + switch (dwEventType) { - case DBT_DEVICEARRIVAL : + case DBT_DEVICEARRIVAL: { DEV_BROADCAST_DEVICEINTERFACE* incoming_device = - (DEV_BROADCAST_DEVICEINTERFACE*) lpEventData; + (DEV_BROADCAST_DEVICEINTERFACE*)lpEventData; return ProcessDeviceArrival(incoming_device); } diff --git a/base/services/audiosrv/pnp_list_lock.c b/base/services/audiosrv/pnp_list_lock.c index eef85d32f3d..ea6224a6ed3 100644 --- a/base/services/audiosrv/pnp_list_lock.c +++ b/base/services/audiosrv/pnp_list_lock.c @@ -13,7 +13,7 @@ static HANDLE audio_device_list_lock = NULL; BOOL -InitializeAudioDeviceListLock() +InitializeAudioDeviceListLock(VOID) { /* The security stuff is to make sure the mutex can be grabbed by other processes - is this the best idea though ??? */ @@ -32,27 +32,26 @@ InitializeAudioDeviceListLock() FALSE, AUDIO_LIST_LOCK_NAME); - return ( audio_device_list_lock != NULL ); + return (audio_device_list_lock != NULL); } VOID -KillAudioDeviceListLock() +KillAudioDeviceListLock(VOID) { CloseHandle(audio_device_list_lock); audio_device_list_lock = NULL; } VOID -LockAudioDeviceList() +LockAudioDeviceList(VOID) { - assert( audio_device_list_lock != NULL ); + assert(audio_device_list_lock != NULL); WaitForSingleObject(audio_device_list_lock, INFINITE); } VOID -UnlockAudioDeviceList() +UnlockAudioDeviceList(VOID) { - assert( audio_device_list_lock != NULL ); + assert(audio_device_list_lock != NULL); ReleaseMutex(audio_device_list_lock); } - diff --git a/base/services/audiosrv/pnp_list_manager.c b/base/services/audiosrv/pnp_list_manager.c index 428a4bfde14..46d09eb0376 100644 --- a/base/services/audiosrv/pnp_list_manager.c +++ b/base/services/audiosrv/pnp_list_manager.c @@ -23,8 +23,7 @@ CreateDeviceDescriptor(WCHAR* path, BOOL is_enabled) /* printf("path_length %d, total %d\n", path_length, size);*/ device = malloc(size); - - if ( ! device ) + if (! device) { logmsg("Failed to create a device descriptor (malloc fail)\n"); return NULL; @@ -71,7 +70,7 @@ AppendAudioDeviceToList(PnP_AudioDevice* device) */ /* We DON'T want to overshoot the end of the buffer! */ - if ( audio_device_list->size + device_info_size > audio_device_list->max_size ) + if (audio_device_list->size + device_info_size > audio_device_list->max_size) { /*printf("max_size would be exceeded! Failing...\n");*/ @@ -101,7 +100,7 @@ CreateAudioDeviceList(DWORD max_size) { /* printf("Initializing memory device list lock\n");*/ - if ( ! InitializeAudioDeviceListLock() ) + if (!InitializeAudioDeviceListLock()) { /*printf("Failed!\n");*/ return FALSE; @@ -120,8 +119,7 @@ CreateAudioDeviceList(DWORD max_size) 0, max_size, AUDIO_LIST_NAME); - - if ( ! device_list_file ) + if (!device_list_file) { logmsg("Creation of audio device list failed (err %d)\n", GetLastError()); @@ -138,8 +136,7 @@ CreateAudioDeviceList(DWORD max_size) 0, 0, max_size); - - if ( ! audio_device_list ) + if (!audio_device_list) { logmsg("MapViewOfFile FAILED (err %d)\n", GetLastError()); @@ -168,7 +165,7 @@ CreateAudioDeviceList(DWORD max_size) } VOID -DestroyAudioDeviceList() +DestroyAudioDeviceList(VOID) { logmsg("Destroying device list\n"); diff --git a/base/services/audiosrv/services.c b/base/services/audiosrv/services.c index dee6431629a..68c14835e06 100644 --- a/base/services/audiosrv/services.c +++ b/base/services/audiosrv/services.c @@ -30,7 +30,7 @@ WaitForService( Sleep(1000); - }while(Index++ < RetryCount); + } while (Index++ < RetryCount); logmsg("Timeout while waiting for service to become ready %p\n", hService); @@ -47,7 +47,6 @@ StartAudioService( BOOL ret; hService = OpenService(hSCManager, ServiceName, SERVICE_ALL_ACCESS); - if (!hService) { logmsg("Failed to open service %S %x\n", ServiceName, GetLastError()); @@ -67,11 +66,8 @@ StartAudioService( return ret; } - - - BOOL -StartSystemAudioServices() +StartSystemAudioServices(VOID) { SC_HANDLE hSCManager; @@ -92,14 +88,3 @@ StartSystemAudioServices() CloseServiceHandle(hSCManager); return TRUE; } - - - - - - - - - - -