From 1251fa5766d79d97e83d19f1ca3a104e1d8b77a5 Mon Sep 17 00:00:00 2001 From: Maurus Cuelenaere Date: Sat, 13 Feb 2010 14:51:38 +0000 Subject: Lua fscanf: use pointer of file descriptor instead of file descriptor itself to avoid 64-bit pointer<->int clash (aka fix yellow). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24633 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/lua/fscanf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'apps/plugins/lua/fscanf.c') diff --git a/apps/plugins/lua/fscanf.c b/apps/plugins/lua/fscanf.c index 25058af7da..9f5f129d3c 100644 --- a/apps/plugins/lua/fscanf.c +++ b/apps/plugins/lua/fscanf.c @@ -266,7 +266,7 @@ static int scan(int (*peek)(void *userp), static int fspeek(void *userp) { - int fd = (int) userp; + int fd = *((int*) userp); char buf = 0; if(rb->read(fd, &buf, 1) == 1) rb->lseek(fd, -1, SEEK_CUR); @@ -275,7 +275,8 @@ static int fspeek(void *userp) static void fspop(void *userp) { - rb->lseek((int) userp, 1, SEEK_CUR); + int fd = *((int*) userp); + rb->lseek(fd, 1, SEEK_CUR); } int PREFIX(fscanf)(int fd, const char *fmt, ...) @@ -284,7 +285,7 @@ int PREFIX(fscanf)(int fd, const char *fmt, ...) va_list ap; va_start(ap, fmt); - r = scan(fspeek, fspop, (void*) fd, fmt, ap); + r = scan(fspeek, fspop, &fd, fmt, ap); va_end(ap); return r; } -- cgit v1.2.3