summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-03-02 01:08:38 +0000
committerJens Arnold <amiconn@rockbox.org>2006-03-02 01:08:38 +0000
commit38b7547ef411eac709ff9780312be829cd6cd9f8 (patch)
tree3a7ad8cb650b13c8c98bcf20fc1a7e2549cbd74e /apps
parente3f155dce2258c07153cf7be35e0947ca24a6e4d (diff)
downloadrockbox-38b7547ef411eac709ff9780312be829cd6cd9f8.tar.gz
rockbox-38b7547ef411eac709ff9780312be829cd6cd9f8.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs.c8
-rw-r--r--apps/plugin.c21
2 files changed, 16 insertions, 13 deletions
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 @@
55unsigned char codecbuf[CODEC_SIZE]; 55unsigned char codecbuf[CODEC_SIZE];
56#endif 56#endif
57void *sim_codec_load_ram(char* codecptr, int size, 57void *sim_codec_load_ram(char* codecptr, int size,
58 void* ptr2, int bufwrap, int *pd); 58 void* ptr2, int bufwrap, void **pd);
59void sim_codec_close(int pd); 59void sim_codec_close(void *pd);
60#else 60#else
61#define sim_codec_close(x) 61#define sim_codec_close(x)
62extern unsigned char codecbuf[]; 62extern unsigned char codecbuf[];
@@ -249,10 +249,10 @@ int codec_load_ram(char* codecptr, int size, void* ptr2, int bufwrap,
249 return CODEC_ERROR; 249 return CODEC_ERROR;
250 } 250 }
251#else /* SIMULATOR */ 251#else /* SIMULATOR */
252 int pd; 252 void *pd;
253 253
254 hdr = sim_codec_load_ram(codecptr, size, ptr2, bufwrap, &pd); 254 hdr = sim_codec_load_ram(codecptr, size, ptr2, bufwrap, &pd);
255 if (pd < 0) 255 if (pd == NULL)
256 return CODEC_ERROR; 256 return CODEC_ERROR;
257 257
258 if (hdr == NULL 258 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 @@
70 70
71#ifdef SIMULATOR 71#ifdef SIMULATOR
72static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; 72static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE];
73void *sim_plugin_load(char *plugin, int *fd); 73void *sim_plugin_load(char *plugin, void **pd);
74void sim_plugin_close(int fd); 74void sim_plugin_close(void *pd);
75void sim_lcd_ex_init(int shades, unsigned long (*getpixel)(int, int)); 75void sim_lcd_ex_init(int shades, unsigned long (*getpixel)(int, int));
76void sim_lcd_ex_update_rect(int x, int y, int width, int height); 76void sim_lcd_ex_update_rect(int x, int y, int width, int height);
77#else 77#else
@@ -411,9 +411,12 @@ static const struct plugin_api rockbox_api = {
411 411
412int plugin_load(const char* plugin, void* parameter) 412int plugin_load(const char* plugin, void* parameter)
413{ 413{
414 int fd, rc; 414 int rc;
415 struct plugin_header *hdr; 415 struct plugin_header *hdr;
416#ifndef SIMULATOR 416#ifdef SIMULATOR
417 void *pd;
418#else
419 int fd;
417 ssize_t readsize; 420 ssize_t readsize;
418#endif 421#endif
419#ifdef HAVE_LCD_BITMAP 422#ifdef HAVE_LCD_BITMAP
@@ -436,21 +439,21 @@ int plugin_load(const char* plugin, void* parameter)
436 gui_syncsplash(0, true, str(LANG_WAIT)); 439 gui_syncsplash(0, true, str(LANG_WAIT));
437 440
438#ifdef SIMULATOR 441#ifdef SIMULATOR
439 hdr = sim_plugin_load((char *)plugin, &fd); 442 hdr = sim_plugin_load((char *)plugin, &pd);
440 if (!fd) { 443 if (pd == NULL) {
441 gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_CANT_OPEN), plugin); 444 gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_CANT_OPEN), plugin);
442 return -1; 445 return -1;
443 } 446 }
444 if (hdr == NULL 447 if (hdr == NULL
445 || hdr->magic != PLUGIN_MAGIC 448 || hdr->magic != PLUGIN_MAGIC
446 || hdr->target_id != TARGET_ID) { 449 || hdr->target_id != TARGET_ID) {
447 sim_plugin_close(fd); 450 sim_plugin_close(pd);
448 gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_MODEL)); 451 gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_MODEL));
449 return -1; 452 return -1;
450 } 453 }
451 if (hdr->api_version > PLUGIN_API_VERSION 454 if (hdr->api_version > PLUGIN_API_VERSION
452 || hdr->api_version < PLUGIN_MIN_API_VERSION) { 455 || hdr->api_version < PLUGIN_MIN_API_VERSION) {
453 sim_plugin_close(fd); 456 sim_plugin_close(pd);
454 gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_VERSION)); 457 gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_VERSION));
455 return -1; 458 return -1;
456 } 459 }
@@ -549,7 +552,7 @@ int plugin_load(const char* plugin, void* parameter)
549 if (pfn_tsr_exit == NULL) 552 if (pfn_tsr_exit == NULL)
550 plugin_loaded = false; 553 plugin_loaded = false;
551 554
552 sim_plugin_close(fd); 555 sim_plugin_close(pd);
553 556
554 switch (rc) { 557 switch (rc) {
555 case PLUGIN_OK: 558 case PLUGIN_OK: