summaryrefslogtreecommitdiff
path: root/apps/wps.c
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 /apps/wps.c
parent09499b54a4118abe8bc4353129aa5b83172337ec (diff)
downloadrockbox-487662a67cedf34b8062453eb392f49a575dbe21.tar.gz
rockbox-487662a67cedf34b8062453eb392f49a575dbe21.zip
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
Diffstat (limited to 'apps/wps.c')
-rw-r--r--apps/wps.c15
1 files changed, 9 insertions, 6 deletions
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)
221 int i; 221 int i;
222 int fd; 222 int fd;
223 struct mp3entry* id3 = NULL; 223 struct mp3entry* id3 = NULL;
224 char ch = '/';
225 char* szLast; 224 char* szLast;
226 225
227 id3 = mpeg_current_track(); 226 id3 = mpeg_current_track();
228 szLast = strrchr(id3->path, ch); 227 szLast = strrchr(id3->path, '/');
229 snprintf(buffer, sizeof(buffer), ""); 228 if(szLast)
229 /* point to the first letter in the file name */
230 szLast++;
231
232 buffer[0]=0;
230 lcd_stop_scroll(); 233 lcd_stop_scroll();
231 fd = open("/wps.config", O_RDONLY); 234 fd = open("/wps.config", O_RDONLY);
232 if(-1 == fd) 235 if(-1 == fd)
@@ -280,7 +283,7 @@ int wps_load_custom_config(void)
280 id3->title?id3->title:"<no title>"); 283 id3->title?id3->title:"<no title>");
281 else 284 else
282 snprintf(tmpbuf, sizeof(tmpbuf), "%s", 285 snprintf(tmpbuf, sizeof(tmpbuf), "%s",
283 szLast?++szLast:id3->path); 286 szLast?szLast:id3->path);
284 break; 287 break;
285 case 'h': /* Conditional Filename \ ID3 Title-Artist */ 288 case 'h': /* Conditional Filename \ ID3 Title-Artist */
286 if(id3->artist && id3->title) 289 if(id3->artist && id3->title)
@@ -289,7 +292,7 @@ int wps_load_custom_config(void)
289 id3->artist?id3->artist:"<no artist>"); 292 id3->artist?id3->artist:"<no artist>");
290 else 293 else
291 snprintf(tmpbuf, sizeof(tmpbuf), "%s", 294 snprintf(tmpbuf, sizeof(tmpbuf), "%s",
292 szLast?++szLast:id3->path); 295 szLast?szLast:id3->path);
293 break; 296 break;
294 case 'b': /* File Bitrate */ 297 case 'b': /* File Bitrate */
295 snprintf(tmpbuf, sizeof(tmpbuf), "%d", id3->bitrate); 298 snprintf(tmpbuf, sizeof(tmpbuf), "%d", id3->bitrate);
@@ -302,7 +305,7 @@ int wps_load_custom_config(void)
302 break; 305 break;
303 case 'm': /* File Name */ 306 case 'm': /* File Name */
304 snprintf(tmpbuf, sizeof(tmpbuf), "%s", 307 snprintf(tmpbuf, sizeof(tmpbuf), "%s",
305 szLast?++szLast:id3->path); 308 szLast?szLast:id3->path);
306 break; 309 break;
307 case 's': /* File Size (In Kilobytes) */ 310 case 's': /* File Size (In Kilobytes) */
308 snprintf(tmpbuf, sizeof(tmpbuf), "%d", 311 snprintf(tmpbuf, sizeof(tmpbuf), "%d",