From 487662a67cedf34b8062453eb392f49a575dbe21 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 22 Aug 2002 07:12:45 +0000 Subject: fix file name pointer usage, clean the buffer faster, don't use extra variable git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1921 a1c6a512-1295-4272-9138-f99709370657 --- apps/wps.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'apps/wps.c') diff --git a/apps/wps.c b/apps/wps.c index 225908850f..3198e75d20 100644 --- a/apps/wps.c +++ b/apps/wps.c @@ -221,12 +221,15 @@ int wps_load_custom_config(void) int i; int fd; struct mp3entry* id3 = NULL; - char ch = '/'; char* szLast; id3 = mpeg_current_track(); - szLast = strrchr(id3->path, ch); - snprintf(buffer, sizeof(buffer), ""); + szLast = strrchr(id3->path, '/'); + if(szLast) + /* point to the first letter in the file name */ + szLast++; + + buffer[0]=0; lcd_stop_scroll(); fd = open("/wps.config", O_RDONLY); if(-1 == fd) @@ -280,7 +283,7 @@ int wps_load_custom_config(void) id3->title?id3->title:""); else snprintf(tmpbuf, sizeof(tmpbuf), "%s", - szLast?++szLast:id3->path); + szLast?szLast:id3->path); break; case 'h': /* Conditional Filename \ ID3 Title-Artist */ if(id3->artist && id3->title) @@ -289,7 +292,7 @@ int wps_load_custom_config(void) id3->artist?id3->artist:""); else snprintf(tmpbuf, sizeof(tmpbuf), "%s", - szLast?++szLast:id3->path); + szLast?szLast:id3->path); break; case 'b': /* File Bitrate */ snprintf(tmpbuf, sizeof(tmpbuf), "%d", id3->bitrate); @@ -302,7 +305,7 @@ int wps_load_custom_config(void) break; case 'm': /* File Name */ snprintf(tmpbuf, sizeof(tmpbuf), "%s", - szLast?++szLast:id3->path); + szLast?szLast:id3->path); break; case 's': /* File Size (In Kilobytes) */ snprintf(tmpbuf, sizeof(tmpbuf), "%d", -- cgit v1.2.3