From 791e0928c5f9d5287a6077a95a385bc6bd90ac1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Wallm=C3=A9nius?= Date: Wed, 9 Apr 2008 21:47:43 +0000 Subject: [PATCH] Slight readability improvements git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17056 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist_viewer.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 9483dadfab..c9a9f4b7af 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -223,7 +223,7 @@ static int playlist_entry_load(struct playlist_entry *entry, int index, return -1; } -static int playlist_buffer_get_index(struct playlist_buffer *pb, int index ) +static int playlist_buffer_get_index(struct playlist_buffer *pb, int index) { int buffer_index; if(pb->direction==FORWARD) @@ -246,7 +246,8 @@ static int playlist_buffer_get_index(struct playlist_buffer *pb, int index ) #define distance(a, b) \ a>b? (a) - (b) : (b) - (a) -static bool playlist_buffer_needs_reload(struct playlist_buffer* pb, int track_index) +static bool playlist_buffer_needs_reload(struct playlist_buffer* pb, + int track_index) { if(pb->num_loaded==viewer.num_tracks) return(false); @@ -550,8 +551,13 @@ static char *playlist_callback_name(int selected_item, size_t buffer_len) { struct playlist_viewer * local_viewer = (struct playlist_viewer *)data; - struct playlist_entry *track = playlist_buffer_get_track(&(local_viewer->buffer), get_track_num(local_viewer,selected_item)); + + int track_num = get_track_num(local_viewer, selected_item); + struct playlist_entry *track = + playlist_buffer_get_track(&(local_viewer->buffer), track_num); + format_line(track, buffer, buffer_len); + return(buffer); } @@ -559,9 +565,11 @@ static char *playlist_callback_name(int selected_item, static int playlist_callback_icons(int selected_item, void *data) { struct playlist_viewer * local_viewer=(struct playlist_viewer *)data; + + int track_num = get_track_num(local_viewer, selected_item); struct playlist_entry *track= - playlist_buffer_get_track(&(local_viewer->buffer), - get_track_num(local_viewer, selected_item)); + playlist_buffer_get_track(&(local_viewer->buffer), track_num); + if (track->index == local_viewer->current_playing_track) { /* Current playing track */