Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
ac853b61
Commit
ac853b61
authored
Oct 22, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stored_playlist: no CamelCase
Renamed all public functions, prefix is "spl_".
parent
a4def813
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
34 deletions
+39
-34
command.c
src/command.c
+3
-3
dbUtils.c
src/dbUtils.c
+1
-1
playlist.c
src/playlist.c
+5
-5
stored_playlist.c
src/stored_playlist.c
+23
-19
stored_playlist.h
src/stored_playlist.h
+7
-6
No files found.
src/command.c
View file @
ac853b61
...
...
@@ -544,7 +544,7 @@ static int handleRename(struct client *client,
{
enum
playlist_result
result
;
result
=
renameStoredPlaylist
(
argv
[
1
],
argv
[
2
]);
result
=
spl_rename
(
argv
[
1
],
argv
[
2
]);
return
print_playlist_result
(
client
,
result
);
}
...
...
@@ -718,7 +718,7 @@ static int handlePlaylistDelete(struct client *client,
if
(
check_int
(
client
,
&
from
,
argv
[
2
],
check_integer
,
argv
[
2
])
<
0
)
return
-
1
;
result
=
removeOneSongFromStoredPlaylistByPath
(
playlist
,
from
);
result
=
spl_remove_index
(
playlist
,
from
);
return
print_playlist_result
(
client
,
result
);
}
...
...
@@ -734,7 +734,7 @@ static int handlePlaylistMove(struct client *client,
if
(
check_int
(
client
,
&
to
,
argv
[
3
],
check_integer
,
argv
[
3
])
<
0
)
return
-
1
;
result
=
moveSongInStoredPlaylistByPath
(
playlist
,
from
,
to
);
result
=
spl_move_index
(
playlist
,
from
,
to
);
return
print_playlist_result
(
client
,
result
);
}
...
...
src/dbUtils.c
View file @
ac853b61
...
...
@@ -208,7 +208,7 @@ directoryAddSongToStoredPlaylist(struct song *song, void *_data)
{
struct
add_data
*
data
=
_data
;
if
(
appendSongToStoredPlaylistByPath
(
data
->
path
,
song
)
!=
0
)
if
(
spl_append_song
(
data
->
path
,
song
)
!=
0
)
return
-
1
;
return
0
;
}
...
...
src/playlist.c
View file @
ac853b61
...
...
@@ -220,7 +220,7 @@ void clearPlaylist(void)
int
clearStoredPlaylist
(
const
char
*
utf8file
)
{
return
removeAllFromStoredPlaylistByPath
(
utf8file
);
return
spl_clear
(
utf8file
);
}
void
showPlaylist
(
struct
client
*
client
)
...
...
@@ -583,14 +583,14 @@ int addToStoredPlaylist(const char *url, const char *utf8file)
song
=
db_get_song
(
url
);
if
(
song
)
return
appendSongToStoredPlaylistByPath
(
utf8file
,
song
);
return
spl_append_song
(
utf8file
,
song
);
if
(
!
isValidRemoteUtf8Url
(
url
))
return
ACK_ERROR_NO_EXIST
;
song
=
song_remote_new
(
url
);
if
(
song
)
{
int
ret
=
appendSongToStoredPlaylistByPath
(
utf8file
,
song
);
int
ret
=
spl_append_song
(
utf8file
,
song
);
song_free
(
song
);
return
ret
;
}
...
...
@@ -1343,7 +1343,7 @@ int PlaylistInfo(struct client *client, const char *utf8file, int detail)
ListNode
*
node
;
List
*
list
;
if
(
!
(
list
=
loadStoredPlaylist
(
utf8file
)))
if
(
!
(
list
=
spl_load
(
utf8file
)))
return
-
1
;
node
=
list
->
firstNode
;
...
...
@@ -1375,7 +1375,7 @@ enum playlist_result loadPlaylist(struct client *client, const char *utf8file)
ListNode
*
node
;
List
*
list
;
if
(
!
(
list
=
loadStoredPlaylist
(
utf8file
)))
if
(
!
(
list
=
spl_load
(
utf8file
)))
return
PLAYLIST_RESULT_NO_SUCH_LIST
;
node
=
list
->
firstNode
;
...
...
src/stored_playlist.c
View file @
ac853b61
...
...
@@ -27,7 +27,8 @@
#include "idle.h"
#include "os_compat.h"
static
ListNode
*
nodeOfStoredPlaylist
(
List
*
list
,
int
idx
)
static
ListNode
*
spl_get_index
(
List
*
list
,
int
idx
)
{
int
forward
;
ListNode
*
node
;
...
...
@@ -63,7 +64,7 @@ static ListNode *nodeOfStoredPlaylist(List *list, int idx)
}
static
enum
playlist_result
writeStoredPlaylistToPath
(
List
*
list
,
const
char
*
utf8path
)
spl_save
(
List
*
list
,
const
char
*
utf8path
)
{
ListNode
*
node
;
FILE
*
file
;
...
...
@@ -87,7 +88,8 @@ writeStoredPlaylistToPath(List *list, const char *utf8path)
return
PLAYLIST_RESULT_SUCCESS
;
}
List
*
loadStoredPlaylist
(
const
char
*
utf8path
)
List
*
spl_load
(
const
char
*
utf8path
)
{
List
*
list
;
FILE
*
file
;
...
...
@@ -136,7 +138,8 @@ List *loadStoredPlaylist(const char *utf8path)
return
list
;
}
static
int
moveSongInStoredPlaylist
(
List
*
list
,
int
src
,
int
dest
)
static
int
spl_move_index_internal
(
List
*
list
,
int
src
,
int
dest
)
{
ListNode
*
srcNode
,
*
destNode
;
...
...
@@ -144,11 +147,11 @@ static int moveSongInStoredPlaylist(List *list, int src, int dest)
src
<
0
||
dest
<
0
||
src
==
dest
)
return
-
1
;
srcNode
=
nodeOfStoredPlaylist
(
list
,
src
);
srcNode
=
spl_get_index
(
list
,
src
);
if
(
!
srcNode
)
return
-
1
;
destNode
=
nodeOfStoredPlaylist
(
list
,
dest
);
destNode
=
spl_get_index
(
list
,
dest
);
/* remove src */
if
(
srcNode
->
prevNode
)
...
...
@@ -198,20 +201,20 @@ static int moveSongInStoredPlaylist(List *list, int src, int dest)
}
enum
playlist_result
moveSongInStoredPlaylistByPath
(
const
char
*
utf8path
,
int
src
,
int
dest
)
spl_move_index
(
const
char
*
utf8path
,
int
src
,
int
dest
)
{
List
*
list
;
enum
playlist_result
result
;
if
(
!
(
list
=
loadStoredPlaylist
(
utf8path
)))
if
(
!
(
list
=
spl_load
(
utf8path
)))
return
PLAYLIST_RESULT_NO_SUCH_LIST
;
if
(
moveSongInStoredPlaylist
(
list
,
src
,
dest
)
!=
0
)
{
if
(
spl_move_index_internal
(
list
,
src
,
dest
)
!=
0
)
{
freeList
(
list
);
return
PLAYLIST_RESULT_BAD_RANGE
;
}
result
=
writeStoredPlaylistToPath
(
list
,
utf8path
);
result
=
spl_save
(
list
,
utf8path
);
freeList
(
list
);
...
...
@@ -220,7 +223,7 @@ moveSongInStoredPlaylistByPath(const char *utf8path, int src, int dest)
}
enum
playlist_result
removeAllFromStoredPlaylistByPath
(
const
char
*
utf8path
)
spl_clear
(
const
char
*
utf8path
)
{
char
filename
[
MPD_PATH_MAX
];
FILE
*
file
;
...
...
@@ -240,9 +243,10 @@ removeAllFromStoredPlaylistByPath(const char *utf8path)
return
PLAYLIST_RESULT_SUCCESS
;
}
static
int
removeOneSongFromStoredPlaylist
(
List
*
list
,
int
pos
)
static
int
spl_remove_index_internal
(
List
*
list
,
int
pos
)
{
ListNode
*
node
=
nodeOfStoredPlaylist
(
list
,
pos
);
ListNode
*
node
=
spl_get_index
(
list
,
pos
);
if
(
!
node
)
return
-
1
;
...
...
@@ -252,20 +256,20 @@ static int removeOneSongFromStoredPlaylist(List *list, int pos)
}
enum
playlist_result
removeOneSongFromStoredPlaylistByPath
(
const
char
*
utf8path
,
int
pos
)
spl_remove_index
(
const
char
*
utf8path
,
int
pos
)
{
List
*
list
;
enum
playlist_result
result
;
if
(
!
(
list
=
loadStoredPlaylist
(
utf8path
)))
if
(
!
(
list
=
spl_load
(
utf8path
)))
return
PLAYLIST_RESULT_NO_SUCH_LIST
;
if
(
removeOneSongFromStoredPlaylist
(
list
,
pos
)
!=
0
)
{
if
(
spl_remove_index_internal
(
list
,
pos
)
!=
0
)
{
freeList
(
list
);
return
PLAYLIST_RESULT_BAD_RANGE
;
}
result
=
writeStoredPlaylistToPath
(
list
,
utf8path
);
result
=
spl_save
(
list
,
utf8path
);
freeList
(
list
);
...
...
@@ -274,7 +278,7 @@ removeOneSongFromStoredPlaylistByPath(const char *utf8path, int pos)
}
enum
playlist_result
appendSongToStoredPlaylistByPath
(
const
char
*
utf8path
,
struct
song
*
song
)
spl_append_song
(
const
char
*
utf8path
,
struct
song
*
song
)
{
FILE
*
file
;
struct
stat
st
;
...
...
@@ -313,7 +317,7 @@ appendSongToStoredPlaylistByPath(const char *utf8path, struct song *song)
}
enum
playlist_result
renameStoredPlaylist
(
const
char
*
utf8from
,
const
char
*
utf8to
)
spl_rename
(
const
char
*
utf8from
,
const
char
*
utf8to
)
{
struct
stat
st
;
char
from
[
MPD_PATH_MAX
];
...
...
src/stored_playlist.h
View file @
ac853b61
...
...
@@ -24,21 +24,22 @@
struct
song
;
List
*
loadStoredPlaylist
(
const
char
*
utf8path
);
List
*
spl_load
(
const
char
*
utf8path
);
enum
playlist_result
moveSongInStoredPlaylistByPath
(
const
char
*
utf8path
,
int
src
,
int
dest
);
spl_move_index
(
const
char
*
utf8path
,
int
src
,
int
dest
);
enum
playlist_result
removeAllFromStoredPlaylistByPath
(
const
char
*
utf8path
);
spl_clear
(
const
char
*
utf8path
);
enum
playlist_result
removeOneSongFromStoredPlaylistByPath
(
const
char
*
utf8path
,
int
pos
);
spl_remove_index
(
const
char
*
utf8path
,
int
pos
);
enum
playlist_result
appendSongToStoredPlaylistByPath
(
const
char
*
utf8path
,
struct
song
*
song
);
spl_append_song
(
const
char
*
utf8path
,
struct
song
*
song
);
enum
playlist_result
renameStoredPlaylist
(
const
char
*
utf8from
,
const
char
*
utf8to
);
spl_rename
(
const
char
*
utf8from
,
const
char
*
utf8to
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment