summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-10-20 21:54:44 +0000
committerThomas Martitz <kugel@rockbox.org>2009-10-20 21:54:44 +0000
commit774bacc692b4d5c7b769bb88d24e182db9e4656f (patch)
tree07c5ed05c9d46145c783bd1de5062731e6babb32 /apps
parent872852639fc52bcdb2cc8199fed60f81c7cad1f9 (diff)
downloadrockbox-774bacc692b4d5c7b769bb88d24e182db9e4656f.zip
rockbox-774bacc692b4d5c7b769bb88d24e182db9e4656f.tar.gz
rockbox-774bacc692b4d5c7b769bb88d24e182db9e4656f.tar.bz2
rockbox-774bacc692b4d5c7b769bb88d24e182db9e4656f.tar.xz
Correct wrong usage of event callbacks all over the place. It's not supposed to return anything, and should take a data parameter.
Fixing it because correcting the event api prototypes causes many warnings. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23301 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/playback.c11
-rw-r--r--apps/playlist.c4
-rw-r--r--apps/plugin.h4
-rw-r--r--apps/plugins/battery_bench.c14
-rw-r--r--apps/scrobbler.c7
-rw-r--r--apps/scrobbler.h8
-rw-r--r--apps/settings.c14
-rw-r--r--apps/tagcache.c11
-rw-r--r--apps/tagtree.c6
9 files changed, 41 insertions, 38 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 3fa42b9..7b614cd 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1562,11 +1562,12 @@ static void buffering_handle_rebuffer_callback(void *data)
queue_post(&audio_queue, Q_AUDIO_FLUSH, 0);
}
-static void buffering_handle_finished_callback(int *data)
+static void buffering_handle_finished_callback(void *data)
{
logf("handle %d finished buffering", *data);
+ int hid = (*(int*)data);
- if (*data == tracks[track_widx].id3_hid)
+ if (hid == tracks[track_widx].id3_hid)
{
int offset = ci.new_track + wps_offset;
int next_idx = (track_ridx + offset + 1) & MAX_TRACK_MASK;
@@ -1574,16 +1575,16 @@ static void buffering_handle_finished_callback(int *data)
We can ask the audio thread to load the rest of the track's data. */
LOGFQUEUE("audio >| audio Q_AUDIO_FINISH_LOAD");
queue_post(&audio_queue, Q_AUDIO_FINISH_LOAD, 0);
- if (tracks[next_idx].id3_hid == *data)
+ if (tracks[next_idx].id3_hid == hid)
send_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, NULL);
}
else
{
/* This is most likely an audio handle, so we strip the useless
trailing tags that are left. */
- strip_tags(*data);
+ strip_tags(hid);
- if (*data == tracks[track_widx-1].audio_hid
+ if (hid == tracks[track_widx-1].audio_hid
&& filling == STATE_END_OF_PLAYLIST)
{
/* This was the last track in the playlist.
diff --git a/apps/playlist.c b/apps/playlist.c
index b70fdc8..1e96ebf 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -1214,8 +1214,9 @@ static int compare(const void* p1, const void* p2)
* without affecting playlist load up performance. This thread also flushes
* any pending control commands when the disk spins up.
*/
-static bool playlist_flush_callback(void)
+static void playlist_flush_callback(void *param)
{
+ (void)param;
struct playlist_info *playlist;
playlist = &current_playlist;
if (playlist->control_fd >= 0)
@@ -1228,7 +1229,6 @@ static bool playlist_flush_callback(void)
}
sync_control(playlist, true);
}
- return true;
}
static void playlist_thread(void)
diff --git a/apps/plugin.h b/apps/plugin.h
index 41375a6..6ff7e7e 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -403,8 +403,8 @@ struct plugin_api {
void (*storage_spin)(void);
void (*storage_spindown)(int seconds);
#if USING_STORAGE_CALLBACK
- void (*register_storage_idle_func)(storage_idle_notify function);
- void (*unregister_storage_idle_func)(storage_idle_notify function, bool run);
+ void (*register_storage_idle_func)(void (*function)(void *data));
+ void (*unregister_storage_idle_func)(void (*function)(void *data), bool run);
#endif /* USING_STORAGE_CALLBACK */
void (*reload_directory)(void);
char *(*create_numbered_filename)(char *buffer, const char *path,
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index 909de03..c0b6d44 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -306,22 +306,19 @@ static unsigned int charge_state(void)
#endif
-static bool flush_buffer(void)
+static void flush_buffer(void* data)
{
+ (void)data;
int fd, secs;
unsigned int i;
/* don't access the disk when in usb mode, or when no data is available */
if (in_usb_mode || (buf_idx == 0))
- {
- return false;
- }
+ return;
fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND);
if (fd < 0)
- {
- return false;
- }
+ return;
for (i = 0; i < buf_idx; i++)
{
@@ -357,7 +354,6 @@ static bool flush_buffer(void)
rb->close(fd);
buf_idx = 0;
- return true;
}
@@ -395,7 +391,7 @@ void thread(void)
for this to occur because it requires > 16 hours of no disk activity.
*/
if (buf_idx == BUF_ELEMENTS) {
- flush_buffer();
+ flush_buffer(NULL);
}
/* sleep some time until next measurement */
diff --git a/apps/scrobbler.c b/apps/scrobbler.c
index b0f6515..83f546b 100644
--- a/apps/scrobbler.c
+++ b/apps/scrobbler.c
@@ -128,11 +128,11 @@ static void write_cache(void)
cache_pos = 0;
}
-static bool scrobbler_flush_callback(void)
+static void scrobbler_flush_callback(void *data)
{
+ (void)data;
if (scrobbler_initialised && cache_pos)
write_cache();
- return true;
}
static void add_to_cache(unsigned long play_length)
@@ -185,8 +185,9 @@ static void add_to_cache(unsigned long play_length)
}
-void scrobbler_change_event(struct mp3entry *id)
+static void scrobbler_change_event(void *data)
{
+ struct mp3entry *id = (struct mp3entry*)data;
/* add entry using the previous scrobbler_entry and timestamp */
if (pending)
add_to_cache(audio_prev_elapsed());
diff --git a/apps/scrobbler.h b/apps/scrobbler.h
index d7a9b25..050522e 100644
--- a/apps/scrobbler.h
+++ b/apps/scrobbler.h
@@ -18,10 +18,14 @@
* KIND, either express or implied.
*
****************************************************************************/
-
-void scrobbler_change_event(struct mp3entry *id);
+
+#ifndef __SCROBBLER_H__
+#define __SCROBBLER_H__
+
int scrobbler_init(void);
void scrobbler_flush_cache(void);
void scrobbler_shutdown(void);
void scrobbler_poweroff(void);
bool scrobbler_is_enabled(void);
+
+#endif /* __SCROBBLER_H__ */
diff --git a/apps/settings.c b/apps/settings.c
index 7a36a0e..f12bd92 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -568,17 +568,17 @@ static bool settings_write_config(const char* filename, int options)
return true;
}
#ifndef HAVE_RTC_RAM
-static bool flush_global_status_callback(void)
+static void flush_global_status_callback(void *data)
{
- return write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
+ (void)data;
+ write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
}
#endif
-static bool flush_config_block_callback(void)
+static void flush_config_block_callback(void *data)
{
- bool r1, r2;
- r1 = write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
- r2 = settings_write_config(CONFIGFILE, SETTINGS_SAVE_CHANGED);
- return r1 || r2;
+ (void)data;
+ write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
+ settings_write_config(CONFIGFILE, SETTINGS_SAVE_CHANGED);
}
/*
diff --git a/apps/tagcache.c b/apps/tagcache.c
index a5df2f0..14d88bb 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -3068,16 +3068,16 @@ static bool command_queue_is_full(void)
return (next == command_queue_ridx);
}
-static bool command_queue_sync_callback(void)
+static void command_queue_sync_callback(void *data)
{
-
+ (void)data;
struct master_header myhdr;
int masterfd;
mutex_lock(&command_queue_mutex);
if ( (masterfd = open_master_fd(&myhdr, true)) < 0)
- return false;
+ return;
while (command_queue_ridx != command_queue_widx)
{
@@ -3092,7 +3092,7 @@ static bool command_queue_sync_callback(void)
/* Re-open the masterfd. */
if ( (masterfd = open_master_fd(&myhdr, true)) < 0)
- return true;
+ return;
break;
}
@@ -3111,7 +3111,6 @@ static bool command_queue_sync_callback(void)
tc_stat.queue_length = 0;
mutex_unlock(&command_queue_mutex);
- return true;
}
static void run_command_queue(bool force)
@@ -3120,7 +3119,7 @@ static void run_command_queue(bool force)
return;
if (force || command_queue_is_full())
- command_queue_sync_callback();
+ command_queue_sync_callback(NULL);
else
register_storage_idle_func(command_queue_sync_callback);
}
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 2962d57..832a49e 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -642,9 +642,10 @@ static int compare(const void *p1, const void *p2)
return strncasecmp(e1->name, e2->name, MAX_PATH);
}
-static void tagtree_buffer_event(struct mp3entry *id3)
+static void tagtree_buffer_event(void *data)
{
struct tagcache_search tcs;
+ struct mp3entry *id3 = (struct mp3entry*)data;
/* Do not gather data unless proper setting has been enabled. */
if (!global_settings.runtimedb)
@@ -671,12 +672,13 @@ static void tagtree_buffer_event(struct mp3entry *id3)
tagcache_search_finish(&tcs);
}
-static void tagtree_track_finish_event(struct mp3entry *id3)
+static void tagtree_track_finish_event(void *data)
{
long playcount;
long playtime;
long lastplayed;
long tagcache_idx;
+ struct mp3entry *id3 = (struct mp3entry*)data;
/* Do not gather data unless proper setting has been enabled. */
if (!global_settings.runtimedb)