diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2010-02-13 14:51:38 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2010-02-13 14:51:38 +0000 |
commit | 1251fa5766d79d97e83d19f1ca3a104e1d8b77a5 (patch) | |
tree | 9e1183995f49c00dc22384d258d07c9a46089732 /apps/plugins | |
parent | 9bf28debd8617bbc5b8e42c9a47a3eb8c78ef43d (diff) | |
download | rockbox-1251fa5766d79d97e83d19f1ca3a104e1d8b77a5.tar.gz rockbox-1251fa5766d79d97e83d19f1ca3a104e1d8b77a5.zip |
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
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/lua/fscanf.c | 7 |
1 files changed, 4 insertions, 3 deletions
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), | |||
266 | 266 | ||
267 | static int fspeek(void *userp) | 267 | static int fspeek(void *userp) |
268 | { | 268 | { |
269 | int fd = (int) userp; | 269 | int fd = *((int*) userp); |
270 | char buf = 0; | 270 | char buf = 0; |
271 | if(rb->read(fd, &buf, 1) == 1) | 271 | if(rb->read(fd, &buf, 1) == 1) |
272 | rb->lseek(fd, -1, SEEK_CUR); | 272 | rb->lseek(fd, -1, SEEK_CUR); |
@@ -275,7 +275,8 @@ static int fspeek(void *userp) | |||
275 | 275 | ||
276 | static void fspop(void *userp) | 276 | static void fspop(void *userp) |
277 | { | 277 | { |
278 | rb->lseek((int) userp, 1, SEEK_CUR); | 278 | int fd = *((int*) userp); |
279 | rb->lseek(fd, 1, SEEK_CUR); | ||
279 | } | 280 | } |
280 | 281 | ||
281 | int PREFIX(fscanf)(int fd, const char *fmt, ...) | 282 | int PREFIX(fscanf)(int fd, const char *fmt, ...) |
@@ -284,7 +285,7 @@ int PREFIX(fscanf)(int fd, const char *fmt, ...) | |||
284 | va_list ap; | 285 | va_list ap; |
285 | 286 | ||
286 | va_start(ap, fmt); | 287 | va_start(ap, fmt); |
287 | r = scan(fspeek, fspop, (void*) fd, fmt, ap); | 288 | r = scan(fspeek, fspop, &fd, fmt, ap); |
288 | va_end(ap); | 289 | va_end(ap); |
289 | return r; | 290 | return r; |
290 | } | 291 | } |