From e2eff494a3c11547758b3830854b63626f979853 Mon Sep 17 00:00:00 2001 From: Jeffrey Goode Date: Sat, 10 Apr 2010 21:53:55 +0000 Subject: [PATCH] Fix yellow: pointer cast git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25578 a1c6a512-1295-4272-9138-f99709370657 --- apps/bookmark.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/bookmark.c b/apps/bookmark.c index 2c9b3d5d17..029a56406f 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -942,9 +942,15 @@ static const char* skip_token(const char* s) return s; } +static const char* int_token(const char* s, int* dest) +{ + *dest = atoi(s); + return skip_token(s); +} + static const char* long_token(const char* s, long* dest) { - *dest = atoi(s); /* Should be atol, but we don't have it. */ + *dest = atoi(s); /* Should be atol, but we don't have it. */ return skip_token(s); } @@ -958,7 +964,8 @@ static bool parse_bookmark(const char *bookmark, const bool parse_filenames) const char* s = bookmark; const char* end; -#define GET_INT_TOKEN(var) s = long_token(s, (long *)&var) +#define GET_INT_TOKEN(var) s = int_token(s, &var) +#define GET_LONG_TOKEN(var) s = long_token(s, &var) #define GET_BOOL_TOKEN(var) var = (atoi(s)!=0); s = skip_token(s) /* if new format bookmark, extract the optional content flags, @@ -973,11 +980,11 @@ static bool parse_bookmark(const char *bookmark, const bool parse_filenames) /* extract all original bookmark tokens */ GET_INT_TOKEN(bm.resume_index); - GET_INT_TOKEN(bm.resume_offset); + GET_LONG_TOKEN(bm.resume_offset); GET_INT_TOKEN(bm.resume_seed); if (!new_format) /* skip deprecated token */ s = skip_token(s); - GET_INT_TOKEN(bm.resume_time); + GET_LONG_TOKEN(bm.resume_time); GET_INT_TOKEN(bm.repeat_mode); GET_BOOL_TOKEN(bm.shuffle);