From 38b7547ef411eac709ff9780312be829cd6cd9f8 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Thu, 2 Mar 2006 01:08:38 +0000 Subject: Simulators: Fix pointer size vs. int size problems (64bit hosts) in plugin loader and codec loader. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8880 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs.c | 8 ++++---- apps/plugin.c | 21 ++++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'apps') diff --git a/apps/codecs.c b/apps/codecs.c index 0301a490d8..804dd2e4e5 100644 --- a/apps/codecs.c +++ b/apps/codecs.c @@ -55,8 +55,8 @@ unsigned char codecbuf[CODEC_SIZE]; #endif void *sim_codec_load_ram(char* codecptr, int size, - void* ptr2, int bufwrap, int *pd); -void sim_codec_close(int pd); + void* ptr2, int bufwrap, void **pd); +void sim_codec_close(void *pd); #else #define sim_codec_close(x) extern unsigned char codecbuf[]; @@ -249,10 +249,10 @@ int codec_load_ram(char* codecptr, int size, void* ptr2, int bufwrap, return CODEC_ERROR; } #else /* SIMULATOR */ - int pd; + void *pd; hdr = sim_codec_load_ram(codecptr, size, ptr2, bufwrap, &pd); - if (pd < 0) + if (pd == NULL) return CODEC_ERROR; if (hdr == NULL diff --git a/apps/plugin.c b/apps/plugin.c index 2bf6aa772d..4f6b6e91d7 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -70,8 +70,8 @@ #ifdef SIMULATOR static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; -void *sim_plugin_load(char *plugin, int *fd); -void sim_plugin_close(int fd); +void *sim_plugin_load(char *plugin, void **pd); +void sim_plugin_close(void *pd); void sim_lcd_ex_init(int shades, unsigned long (*getpixel)(int, int)); void sim_lcd_ex_update_rect(int x, int y, int width, int height); #else @@ -411,9 +411,12 @@ static const struct plugin_api rockbox_api = { int plugin_load(const char* plugin, void* parameter) { - int fd, rc; + int rc; struct plugin_header *hdr; -#ifndef SIMULATOR +#ifdef SIMULATOR + void *pd; +#else + int fd; ssize_t readsize; #endif #ifdef HAVE_LCD_BITMAP @@ -436,21 +439,21 @@ int plugin_load(const char* plugin, void* parameter) gui_syncsplash(0, true, str(LANG_WAIT)); #ifdef SIMULATOR - hdr = sim_plugin_load((char *)plugin, &fd); - if (!fd) { + hdr = sim_plugin_load((char *)plugin, &pd); + if (pd == NULL) { gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_CANT_OPEN), plugin); return -1; } if (hdr == NULL || hdr->magic != PLUGIN_MAGIC || hdr->target_id != TARGET_ID) { - sim_plugin_close(fd); + sim_plugin_close(pd); gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_MODEL)); return -1; } if (hdr->api_version > PLUGIN_API_VERSION || hdr->api_version < PLUGIN_MIN_API_VERSION) { - sim_plugin_close(fd); + sim_plugin_close(pd); gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_VERSION)); return -1; } @@ -549,7 +552,7 @@ int plugin_load(const char* plugin, void* parameter) if (pfn_tsr_exit == NULL) plugin_loaded = false; - sim_plugin_close(fd); + sim_plugin_close(pd); switch (rc) { case PLUGIN_OK: -- cgit v1.2.3