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
cff923b9
Commit
cff923b9
authored
Aug 26, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist: eliminate unused fd parameters
Again, remove file descriptor parameters, which are not actually used. These functions can also be converted to return void.
parent
3db333b5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
49 deletions
+46
-49
command.c
src/command.c
+12
-8
playlist.c
src/playlist.c
+30
-37
playlist.h
src/playlist.h
+4
-4
No files found.
src/command.c
View file @
cff923b9
...
...
@@ -268,10 +268,11 @@ static int handlePlayId(int fd, mpd_unused int *permission,
return
playPlaylistById
(
fd
,
id
,
0
);
}
static
int
handleStop
(
int
fd
,
mpd_unused
int
*
permission
,
static
int
handleStop
(
mpd_unused
int
fd
,
mpd_unused
int
*
permission
,
mpd_unused
int
argc
,
mpd_unused
char
*
argv
[])
{
return
stopPlaylist
(
fd
);
stopPlaylist
();
return
0
;
}
static
int
handleCurrentSong
(
int
fd
,
mpd_unused
int
*
permission
,
...
...
@@ -441,10 +442,11 @@ static int handleShuffle(int fd, mpd_unused int *permission,
return
shufflePlaylist
(
fd
);
}
static
int
handleClear
(
int
fd
,
mpd_unused
int
*
permission
,
static
int
handleClear
(
mpd_unused
int
fd
,
mpd_unused
int
*
permission
,
mpd_unused
int
argc
,
mpd_unused
char
*
argv
[])
{
return
clearPlaylist
(
fd
);
clearPlaylist
();
return
0
;
}
static
int
handleSave
(
int
fd
,
mpd_unused
int
*
permission
,
...
...
@@ -716,16 +718,18 @@ static int handleUpdate(int fd, mpd_unused int *permission,
return
updateInit
(
fd
,
NULL
);
}
static
int
handleNext
(
int
fd
,
mpd_unused
int
*
permission
,
static
int
handleNext
(
mpd_unused
int
fd
,
mpd_unused
int
*
permission
,
mpd_unused
int
argc
,
mpd_unused
char
*
argv
[])
{
return
nextSongInPlaylist
(
fd
);
nextSongInPlaylist
();
return
0
;
}
static
int
handlePrevious
(
int
fd
,
mpd_unused
int
*
permission
,
static
int
handlePrevious
(
mpd_unused
int
fd
,
mpd_unused
int
*
permission
,
mpd_unused
int
argc
,
mpd_unused
char
*
argv
[])
{
return
previousSongInPlaylist
(
fd
);
previousSongInPlaylist
();
return
0
;
}
static
int
handleListAll
(
int
fd
,
mpd_unused
int
*
permission
,
...
...
src/playlist.c
View file @
cff923b9
...
...
@@ -68,7 +68,7 @@ static int playlist_noGoToNext;
int
playlist_saveAbsolutePaths
=
DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS
;
static
void
swapOrder
(
int
a
,
int
b
);
static
int
playPlaylistOrderNumber
(
int
fd
,
int
orderNum
);
static
void
playPlaylistOrderNumber
(
int
orderNum
);
static
void
randomizeOrder
(
int
start
,
int
end
);
static
void
incrPlaylistVersion
(
void
)
...
...
@@ -193,12 +193,11 @@ void finishPlaylist(void)
playlist
.
positionToId
=
NULL
;
}
int
clearPlaylist
(
int
f
d
)
void
clearPlaylist
(
voi
d
)
{
int
i
;
if
(
stopPlaylist
(
fd
)
<
0
)
return
-
1
;
stopPlaylist
();
for
(
i
=
0
;
i
<
playlist
.
length
;
i
++
)
{
if
(
playlist
.
songs
[
i
]
->
type
==
SONG_TYPE_URL
)
{
...
...
@@ -211,8 +210,6 @@ int clearPlaylist(int fd)
playlist
.
current
=
-
1
;
incrPlaylistVersion
();
return
0
;
}
int
clearStoredPlaylist
(
int
fd
,
char
*
utf8file
)
...
...
@@ -828,7 +825,7 @@ void deleteASongFromPlaylist(Song * song)
}
}
int
stopPlaylist
(
mpd_unused
int
f
d
)
void
stopPlaylist
(
voi
d
)
{
DEBUG
(
"playlist: stop
\n
"
);
playerWait
();
...
...
@@ -837,10 +834,9 @@ int stopPlaylist(mpd_unused int fd)
playlist_noGoToNext
=
0
;
if
(
playlist
.
random
)
randomizeOrder
(
0
,
playlist
.
length
-
1
);
return
0
;
}
static
int
playPlaylistOrderNumber
(
mpd_unused
int
fd
,
int
orderNum
)
static
void
playPlaylistOrderNumber
(
int
orderNum
)
{
char
path_max_tmp
[
MPD_PATH_MAX
];
...
...
@@ -857,8 +853,6 @@ static int playPlaylistOrderNumber(mpd_unused int fd, int orderNum)
playerPlay
(
playlist
.
songs
[
playlist
.
order
[
orderNum
]]);
playlist
.
current
=
orderNum
;
return
0
;
}
int
playPlaylist
(
int
fd
,
int
song
,
int
stopOnError
)
...
...
@@ -903,7 +897,8 @@ int playPlaylist(int fd, int song, int stopOnError)
playlist_stopOnError
=
stopOnError
;
playlist_errorCount
=
0
;
return
playPlaylistOrderNumber
(
fd
,
i
);
playPlaylistOrderNumber
(
i
);
return
0
;
}
int
playPlaylistById
(
int
fd
,
int
id
,
int
stopOnError
)
...
...
@@ -957,39 +952,39 @@ void syncPlayerAndPlaylist(void)
syncCurrentPlayerDecodeMetadata
();
}
static
int
currentSongInPlaylist
(
int
f
d
)
static
void
currentSongInPlaylist
(
voi
d
)
{
if
(
playlist_state
!=
PLAYLIST_STATE_PLAY
)
return
0
;
return
;
playlist_stopOnError
=
0
;
syncPlaylistWithQueue
(
0
);
if
(
playlist
.
current
>=
0
&&
playlist
.
current
<
playlist
.
length
)
{
return
playPlaylistOrderNumber
(
fd
,
playlist
.
current
);
}
else
return
stopPlaylist
(
fd
);
if
(
playlist
.
current
>=
0
&&
playlist
.
current
<
playlist
.
length
)
playPlaylistOrderNumber
(
playlist
.
current
);
else
stopPlaylist
(
);
}
int
nextSongInPlaylist
(
int
f
d
)
void
nextSongInPlaylist
(
voi
d
)
{
if
(
playlist_state
!=
PLAYLIST_STATE_PLAY
)
return
0
;
return
;
syncPlaylistWithQueue
(
0
);
playlist_stopOnError
=
0
;
if
(
playlist
.
current
<
playlist
.
length
-
1
)
{
return
playPlaylistOrderNumber
(
fd
,
playlist
.
current
+
1
);
playPlaylistOrderNumber
(
playlist
.
current
+
1
);
}
else
if
(
playlist
.
length
&&
playlist
.
repeat
)
{
if
(
playlist
.
random
)
randomizeOrder
(
0
,
playlist
.
length
-
1
);
return
playPlaylistOrderNumber
(
fd
,
0
);
playPlaylistOrderNumber
(
0
);
}
else
{
incrPlaylistCurrent
();
return
stopPlaylist
(
fd
);
stopPlaylist
(
);
}
}
...
...
@@ -1008,11 +1003,11 @@ void playPlaylistIfPlayerStopped(void)
||
error
==
PLAYER_ERROR_AUDIO
||
error
==
PLAYER_ERROR_SYSTEM
||
playlist_errorCount
>=
playlist
.
length
))
{
stopPlaylist
(
STDERR_FILENO
);
stopPlaylist
();
}
else
if
(
playlist_noGoToNext
)
currentSongInPlaylist
(
STDERR_FILENO
);
currentSongInPlaylist
();
else
nextSongInPlaylist
(
STDERR_FILENO
);
nextSongInPlaylist
();
}
}
...
...
@@ -1227,7 +1222,7 @@ int setPlaylistRandomStatus(int fd, int status)
return
0
;
}
int
previousSongInPlaylist
(
int
f
d
)
void
previousSongInPlaylist
(
voi
d
)
{
static
time_t
lastTime
;
time_t
diff
=
time
(
NULL
)
-
lastTime
;
...
...
@@ -1235,20 +1230,19 @@ int previousSongInPlaylist(int fd)
lastTime
+=
diff
;
if
(
playlist_state
!=
PLAYLIST_STATE_PLAY
)
return
0
;
return
;
syncPlaylistWithQueue
(
0
);
if
(
diff
&&
getPlayerElapsedTime
()
>
PLAYLIST_PREV_UNLESS_ELAPSED
)
{
return
playPlaylistOrderNumber
(
fd
,
playlist
.
current
);
playPlaylistOrderNumber
(
playlist
.
current
);
}
else
{
if
(
playlist
.
current
>
0
)
{
return
playPlaylistOrderNumber
(
fd
,
playlist
.
current
-
1
);
playPlaylistOrderNumber
(
playlist
.
current
-
1
);
}
else
if
(
playlist
.
repeat
)
{
return
playPlaylistOrderNumber
(
fd
,
playlist
.
length
-
1
);
playPlaylistOrderNumber
(
playlist
.
length
-
1
);
}
else
{
return
playPlaylistOrderNumber
(
fd
,
playlist
.
current
);
playPlaylistOrderNumber
(
playlist
.
current
);
}
}
}
...
...
@@ -1388,12 +1382,11 @@ int seekSongInPlaylist(int fd, int song, float seek_time)
if
(
playlist_state
==
PLAYLIST_STATE_PLAY
)
{
if
(
playlist
.
queued
>=
0
)
clearPlayerQueueLocked
();
}
else
if
(
playPlaylistOrderNumber
(
fd
,
i
)
<
0
)
return
-
1
;
}
else
playPlaylistOrderNumber
(
i
)
;
if
(
playlist
.
current
!=
i
)
{
if
(
playPlaylistOrderNumber
(
fd
,
i
)
<
0
)
return
-
1
;
playPlaylistOrderNumber
(
i
);
}
return
playerSeek
(
fd
,
playlist
.
songs
[
playlist
.
order
[
i
]],
seek_time
);
...
...
src/playlist.h
View file @
cff923b9
...
...
@@ -51,7 +51,7 @@ void readPlaylistState(FILE *);
void
savePlaylistState
(
FILE
*
);
int
clearPlaylist
(
int
f
d
);
void
clearPlaylist
(
voi
d
);
int
clearStoredPlaylist
(
int
fd
,
char
*
utf8file
);
...
...
@@ -71,17 +71,17 @@ int playlistInfo(int fd, int song);
int
playlistId
(
int
fd
,
int
song
);
int
stopPlaylist
(
int
f
d
);
void
stopPlaylist
(
voi
d
);
int
playPlaylist
(
int
fd
,
int
song
,
int
stopOnError
);
int
playPlaylistById
(
int
fd
,
int
song
,
int
stopOnError
);
int
nextSongInPlaylist
(
int
f
d
);
void
nextSongInPlaylist
(
voi
d
);
void
syncPlayerAndPlaylist
(
void
);
int
previousSongInPlaylist
(
int
f
d
);
void
previousSongInPlaylist
(
voi
d
);
int
shufflePlaylist
(
int
fd
);
...
...
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