aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx/timer
diff options
context:
space:
mode:
authorMax Horn2009-02-15 22:34:41 +0000
committerMax Horn2009-02-15 22:34:41 +0000
commit29611bc7ead4d3d5fc9df63c04dd9e2577805557 (patch)
tree42d26aab7ab2e7e97fe5b4763281d8071d878eed /engines/sci/sfx/timer
parent921e6ff5cf3944c1a62a3ad9a91c29bb21aa9942 (diff)
downloadscummvm-rg350-29611bc7ead4d3d5fc9df63c04dd9e2577805557.tar.gz
scummvm-rg350-29611bc7ead4d3d5fc9df63c04dd9e2577805557.tar.bz2
scummvm-rg350-29611bc7ead4d3d5fc9df63c04dd9e2577805557.zip
SCI: Run astyle to make the code be more compliant with our Code Formatting Guidelines: sfx dir
svn-id: r38322
Diffstat (limited to 'engines/sci/sfx/timer')
-rw-r--r--engines/sci/sfx/timer/pthread.cpp12
-rw-r--r--engines/sci/sfx/timer/sigalrm.cpp23
-rw-r--r--engines/sci/sfx/timer/timer_scummvm.cpp8
-rw-r--r--engines/sci/sfx/timer/timers.cpp5
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, &current_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, &current_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];