summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-02-22 18:21:16 +0000
committerJens Arnold <amiconn@rockbox.org>2005-02-22 18:21:16 +0000
commitcf208c50a2b52d0dd5a79567aeef4738c6082137 (patch)
tree00d332db0e95d8dcf58371846a5f393b25ee59c9
parentba454115ece21d987f3d010360f7a6d68d2d2eb6 (diff)
downloadrockbox-cf208c50a2b52d0dd5a79567aeef4738c6082137.tar.gz
rockbox-cf208c50a2b52d0dd5a79567aeef4738c6082137.zip
Killed some simulator warnings; proper plugin error reporting for Win32 simulator.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6039 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--uisimulator/common/io.c24
-rw-r--r--uisimulator/win32/mpeg-win32.c3
2 files changed, 17 insertions, 10 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
index 48b888a027..33f1091314 100644
--- a/uisimulator/common/io.c
+++ b/uisimulator/common/io.c
@@ -289,11 +289,9 @@ int sim_fsync(int fd)
289 289
290#ifdef WIN32 290#ifdef WIN32
291/* sim-win32 */ 291/* sim-win32 */
292typedef enum plugin_status (*plugin_fn)(void* api, void* param);
293#define dlopen(_x_, _y_) LoadLibrary(_x_) 292#define dlopen(_x_, _y_) LoadLibrary(_x_)
294#define dlsym(_x_, _y_) (plugin_fn)GetProcAddress(_x_, _y_) 293#define dlsym(_x_, _y_) (void *)GetProcAddress(_x_, _y_)
295#define dlclose(_x_) FreeLibrary(_x_) 294#define dlclose(_x_) FreeLibrary(_x_)
296#define dlerror() "Unknown"
297#else 295#else
298/* sim-x11 */ 296/* sim-x11 */
299#include <dlfcn.h> 297#include <dlfcn.h>
@@ -303,17 +301,25 @@ void *sim_plugin_load(char *plugin, int *fd)
303{ 301{
304 void* pd; 302 void* pd;
305 char path[256]; 303 char path[256];
306 char buf[256];
307 int (*plugin_start)(void * api, void* param); 304 int (*plugin_start)(void * api, void* param);
308 305#ifdef WIN32
306 char buf[256];
307#endif
308
309 snprintf(path, sizeof path, "archos%s", plugin); 309 snprintf(path, sizeof path, "archos%s", plugin);
310 310
311 *fd = -1; 311 *fd = -1;
312 312
313 pd = dlopen(path, RTLD_NOW); 313 pd = dlopen(path, RTLD_NOW);
314 if (!pd) { 314 if (!pd) {
315 snprintf(buf, sizeof buf, "failed to load %s", plugin); 315 DEBUGF("failed to load %s\n", plugin);
316 DEBUGF("dlopen(%s): %s\n",path,dlerror()); 316#ifdef WIN32
317 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
318 buf, sizeof buf, NULL);
319 DEBUGF("dlopen(%s): %s\n", path, buf);
320#else
321 DEBUGF("dlopen(%s): %s\n", path, dlerror());
322#endif
317 dlclose(pd); 323 dlclose(pd);
318 return NULL; 324 return NULL;
319 } 325 }
@@ -326,13 +332,13 @@ void *sim_plugin_load(char *plugin, int *fd)
326 return NULL; 332 return NULL;
327 } 333 }
328 } 334 }
329 *fd = pd; /* success */ 335 *fd = (int)pd; /* success */
330 return plugin_start; 336 return plugin_start;
331} 337}
332 338
333void sim_plugin_close(int pd) 339void sim_plugin_close(int pd)
334{ 340{
335 dlclose(pd); 341 dlclose((void *)pd);
336} 342}
337 343
338#ifndef WIN32 344#ifndef WIN32
diff --git a/uisimulator/win32/mpeg-win32.c b/uisimulator/win32/mpeg-win32.c
index 6f34befb8d..06adbfa012 100644
--- a/uisimulator/win32/mpeg-win32.c
+++ b/uisimulator/win32/mpeg-win32.c
@@ -33,4 +33,5 @@ void mpeg_bass(void)
33 33
34void mpeg_treble(void) 34void mpeg_treble(void)
35{ 35{
36} \ No newline at end of file 36}
37