From 943ac26cf6fdc2676ca4ee8ffc5c25a4fb58da6e Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Tue, 31 Aug 2004 23:44:24 +0000 Subject: Reverted an erroneous const, and fixed & optimized relative path handling. The bug didn't show up because FAT is inherently able to handle relative paths itself. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5028 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/playlist.c b/apps/playlist.c index fa663fe..d147226 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -156,7 +156,7 @@ static int compare(const void* p1, const void* p2); static int get_filename(struct playlist_info* playlist, int seek, bool control_file, char *buf, int buf_length); static int format_track_path(char *dest, char *src, int buf_length, int max, - const char *dir); + char *dir); static void display_playlist_count(int count, const char *fmt); static void display_buffer_full(void); static int flush_pending_control(struct playlist_info* playlist); @@ -972,7 +972,7 @@ static int get_filename(struct playlist_info* playlist, int seek, * Returns absolute path of track */ static int format_track_path(char *dest, char *src, int buf_length, int max, - const char *dir) + char *dir) { int i = 0; int j; @@ -1005,13 +1005,11 @@ static int format_track_path(char *dest, char *src, int buf_length, int max, /* handle dos style drive letter */ if (':' == src[1]) strncpy(dest, &src[2], buf_length); - else if ('.' == src[0] && '.' == src[1] && '/' == src[2]) + else if (!strncmp(src, "../", 3)) { /* handle relative paths */ i=3; - while(src[i] == '.' && - src[i] == '.' && - src[i] == '/') + while(!strncmp(&src[i], "../", 3)) i += 3; for (j=0; j