diff options
Diffstat (limited to 'engines/sci/sfx/timer')
-rw-r--r-- | engines/sci/sfx/timer/pthread.cpp | 12 | ||||
-rw-r--r-- | engines/sci/sfx/timer/sigalrm.cpp | 23 | ||||
-rw-r--r-- | engines/sci/sfx/timer/timer_scummvm.cpp | 8 | ||||
-rw-r--r-- | engines/sci/sfx/timer/timers.cpp | 5 |
4 files changed, 18 insertions, 30 deletions
diff --git a/engines/sci/sfx/timer/pthread.cpp b/engines/sci/sfx/timer/pthread.cpp index 074adbe08f..bcef9639c4 100644 --- a/engines/sci/sfx/timer/pthread.cpp +++ b/engines/sci/sfx/timer/pthread.cpp @@ -41,8 +41,7 @@ pthread_t thread; volatile static int thread_run; static void * -timer_thread(void *arg) -{ +timer_thread(void *arg) { while (thread_run) { if (callback) callback(callback_data); @@ -54,14 +53,12 @@ timer_thread(void *arg) } static int -set_option(char *name, char *value) -{ +set_option(char *name, char *value) { return SFX_ERROR; } static int -init(void (*func)(void *), void *data) -{ +init(void (*func)(void *), void *data) { if (callback) { fprintf(stderr, "Error: Attempt to initialize pthread timer more than once\n"); return SFX_ERROR; @@ -85,8 +82,7 @@ init(void (*func)(void *), void *data) } static int -stop(void) -{ +stop(void) { thread_run = 0; pthread_join(thread, NULL); diff --git a/engines/sci/sfx/timer/sigalrm.cpp b/engines/sci/sfx/timer/sigalrm.cpp index 40cc2872e1..2bab402d14 100644 --- a/engines/sci/sfx/timer/sigalrm.cpp +++ b/engines/sci/sfx/timer/sigalrm.cpp @@ -43,26 +43,23 @@ static void *sig_callback_data = NULL; static sigset_t current_sigset; static void -timer_handler(int i) -{ +timer_handler(int i) { if (sig_callback) sig_callback(sig_callback_data); } static int -sigalrm_set_option(char *name, char *value) -{ +sigalrm_set_option(char *name, char *value) { return SFX_ERROR; } static int -sigalrm_start(void) -{ +sigalrm_start(void) { struct itimerval itimer; itimer.it_value.tv_sec = 0; - itimer.it_value.tv_usec = 1000000/60; + itimer.it_value.tv_usec = 1000000 / 60; itimer.it_interval = itimer.it_value; signal(SIGALRM, timer_handler); /* Re-instate timer handler, to make sure */ @@ -73,8 +70,7 @@ sigalrm_start(void) static int -sigalrm_init(void (*callback)(void *), void *data) -{ +sigalrm_init(void (*callback)(void *), void *data) { if (sig_callback) { fprintf(stderr, "Error: Attempt to initialize sigalrm timer more than once\n"); return SFX_ERROR; @@ -98,8 +94,7 @@ sigalrm_init(void (*callback)(void *), void *data) static int -sigalrm_stop(void) -{ +sigalrm_stop(void) { struct itimerval itimer; if (!sig_callback) { @@ -119,8 +114,7 @@ sigalrm_stop(void) static int -sigalrm_block(void) -{ +sigalrm_block(void) { if (sigprocmask(SIG_BLOCK, ¤t_sigset, NULL) != 0) { fprintf(stderr, "Error: Failed to block sigalrm\n"); return SFX_ERROR; @@ -131,8 +125,7 @@ sigalrm_block(void) static int -sigalrm_unblock(void) -{ +sigalrm_unblock(void) { if (sigprocmask(SIG_UNBLOCK, ¤t_sigset, NULL) != 0) { fprintf(stderr, "Error: Failed to unblock sigalrm\n"); return SFX_ERROR; diff --git a/engines/sci/sfx/timer/timer_scummvm.cpp b/engines/sci/sfx/timer/timer_scummvm.cpp index 80fc309d1d..beb57aef6b 100644 --- a/engines/sci/sfx/timer/timer_scummvm.cpp +++ b/engines/sci/sfx/timer/timer_scummvm.cpp @@ -19,13 +19,13 @@ void scummvm_timer_update_internal(void *ptr) { int scummvm_timer_start(void (*func)(void *), void *data) { if (scummvm_timer_callback) { fprintf(stderr, - "Error: Attempt to initialize gametick timer more than once\n"); + "Error: Attempt to initialize gametick timer more than once\n"); return SFX_ERROR; } if (!func) { fprintf(stderr, - "Error: Attempt to initialize gametick timer w/o callback\n"); + "Error: Attempt to initialize gametick timer w/o callback\n"); return SFX_ERROR; } @@ -45,10 +45,10 @@ int scummvm_timer_stop() { sfx_timer_t sfx_timer_scummvm = { "ScummVM", "0.1", - DELAY/1000, 0, + DELAY / 1000, 0, NULL, &scummvm_timer_start, &scummvm_timer_stop, 0, 0 - }; +}; diff --git a/engines/sci/sfx/timer/timers.cpp b/engines/sci/sfx/timer/timers.cpp index 71e6e75c96..bdcd9dad34 100644 --- a/engines/sci/sfx/timer/timers.cpp +++ b/engines/sci/sfx/timer/timers.cpp @@ -57,15 +57,14 @@ sfx_timer_t *sfx_timers[] = { sfx_timer_t * -sfx_find_timer(char *name) -{ +sfx_find_timer(char *name) { if (!name) { /* Policies go here */ return sfx_timers[0]; } else { int n = 0; while (sfx_timers[n] - && strcasecmp(sfx_timers[n]->name, name)) + && strcasecmp(sfx_timers[n]->name, name)) ++n; return sfx_timers[n]; |