[prev in list] [next in list] [prev in thread] [next in thread]
List: rockbox-cvs
Subject: playlist: Cleanup get_next_dir()
From: rockbox-gerrit-noreply--- via rockbox-cvs <rockbox-cvs () lists ! haxx ! se>
Date: 2023-03-24 10:12:04
Message-ID: 202303241012.32OAC4Qi1011596 () archos ! rockbox ! org
[Download RAW message or body]
commit 5eb24a9582eba2b9036e3f849472bfa0950c7277
Author: Aidan MacDonald <amachronic@protonmail.com>
Date: Wed Mar 15 06:16:02 2023 +0000
playlist: Cleanup get_next_dir()
Pass the direction as a signed integer to avoid jumping through
unnecessary hoops.
Change-Id: I1a36c3804b5f7103464f0d2ee69d060505261274
diff --git a/apps/playlist.c b/apps/playlist.c
index c755aca9fd..eef6321f19 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -1021,7 +1021,7 @@ static int check_subdir_for_music(char *dir, const char *subdir, bool recurse)
* search through all the directories (starting with the current) to find
* one that has tracks to play
*/
-static int get_next_dir(char *dir, bool is_forward)
+static int get_next_dir(char *dir, int direction)
{
struct playlist_info* playlist = ¤t_playlist;
int result = -1;
@@ -1103,7 +1103,7 @@ static int get_next_dir(char *dir, bool is_forward)
/* set up sorting/direction */
tc->sort_dir = global_settings.sort_dir;
- if (!is_forward)
+ if (direction < 0)
{
static const char sortpairs[] =
{
@@ -1199,14 +1199,6 @@ static int get_next_dir(char *dir, bool is_forward)
return result;
}
-static int get_next_directory(char *dir){
- return get_next_dir(dir, true);
-}
-
-static int get_previous_directory(char *dir){
- return get_next_dir(dir, false);
-}
-
/*
* gets pathname for track at seek index
*/
@@ -1314,14 +1306,9 @@ static int get_track_filename(struct playlist_info* playlist, int index, int see
static int create_and_play_dir(int direction, bool play_last)
{
char dir[MAX_PATH + 1];
- int res;
+ int res = get_next_dir(dir, direction);
int index = -1;
- if(direction > 0)
- res = get_next_directory(dir);
- else
- res = get_previous_directory(dir);
-
if (res < 0) /* return the error encountered */
return res;
--
rockbox-cvs mailing list
rockbox-cvs@lists.haxx.se
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic