summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-08-22 07:12:45 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-08-22 07:12:45 +0000
commit487662a67cedf34b8062453eb392f49a575dbe21 (patch)
tree516d2e4aa180726acea84a09c8cf42868d4aee2d
parent09499b54a4118abe8bc4353129aa5b83172337ec (diff)
downloadrockbox-487662a67cedf34b8062453eb392f49a575dbe21.zip
rockbox-487662a67cedf34b8062453eb392f49a575dbe21.tar.gz
rockbox-487662a67cedf34b8062453eb392f49a575dbe21.tar.bz2
rockbox-487662a67cedf34b8062453eb392f49a575dbe21.tar.xz
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
-rw-r--r--apps/wps.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/wps.c b/apps/wps.c
index 2259088..3198e75 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:"<no 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:"<no 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",