summaryrefslogtreecommitdiffstats
path: root/apps/bookmark.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2008-04-09 15:25:17 +0000
committerNils Wallménius <nils@rockbox.org>2008-04-09 15:25:17 +0000
commit6848961aa5f93a290917071ff3496e1d5026621b (patch)
tree70d377348ab0694c356fffd9fe25f095ccbe88fe /apps/bookmark.c
parentae64d2602befd5589c8c0141a6d812841fdfb232 (diff)
downloadrockbox-6848961aa5f93a290917071ff3496e1d5026621b.tar.gz
rockbox-6848961aa5f93a290917071ff3496e1d5026621b.tar.bz2
rockbox-6848961aa5f93a290917071ff3496e1d5026621b.zip
Pass the buffer length to the list_get_name callback functions instead of using hardcoded MAX_PATH
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17049 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/bookmark.c')
-rw-r--r--apps/bookmark.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c
index 39a9aa07d2..363660306c 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -96,7 +96,10 @@ static bool parse_bookmark(const char *bookmark,
bool *shuffle,
char* file_name);
static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line);
-static char* get_bookmark_info(int list_index, void* data, char *buffer);
+static char* get_bookmark_info(int list_index,
+ void* data,
+ char *buffer,
+ size_t buffer_len);
static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume);
static bool system_check(void);
static bool write_bookmark(bool create_bookmark_file);
@@ -523,7 +526,10 @@ static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line)
return bookmarks->start + bookmarks->count;
}
-static char* get_bookmark_info(int list_index, void* data, char *buffer)
+static char* get_bookmark_info(int list_index,
+ void* data,
+ char *buffer,
+ size_t buffer_len)
{
struct bookmark_list* bookmarks = (struct bookmark_list*) data;
int index = list_index / 2;
@@ -625,7 +631,7 @@ static char* get_bookmark_info(int list_index, void* data, char *buffer)
}
strrsplt(global_filename, '.');
- snprintf(buffer, MAX_PATH, format, name, global_filename);
+ snprintf(buffer, buffer_len, format, name, global_filename);
return buffer;
}
else
@@ -633,7 +639,7 @@ static char* get_bookmark_info(int list_index, void* data, char *buffer)
char time_buf[32];
format_time(time_buf, sizeof(time_buf), resume_time);
- snprintf(buffer, MAX_PATH, "%s, %d%s", time_buf, resume_index + 1,
+ snprintf(buffer, buffer_len, "%s, %d%s", time_buf, resume_index + 1,
shuffle ? (char*) str(LANG_BOOKMARK_SHUFFLE) : "");
return buffer;
}