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
9e46c320
Commit
9e46c320
authored
Jan 02, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist: use GLib instead of utils.h
parent
cc4e0a78
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
playlist.c
src/playlist.c
+15
-11
stored_playlist.c
src/stored_playlist.c
+2
-2
No files found.
src/playlist.c
View file @
9e46c320
...
...
@@ -30,7 +30,6 @@
#include "log.h"
#include "mapper.h"
#include "path.h"
#include "utils.h"
#include "state_file.h"
#include "stored_playlist.h"
#include "ack.h"
...
...
@@ -43,6 +42,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#define PLAYLIST_STATE_STOP 0
#define PLAYLIST_STATE_PLAY 1
...
...
@@ -149,14 +150,17 @@ void initPlaylist(void)
playlist_saveAbsolutePaths
=
DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS
;
playlist
.
songs
=
xmalloc
(
sizeof
(
struct
song
*
)
*
playlist_max_length
);
playlist
.
songMod
=
xmalloc
(
sizeof
(
uint32_t
)
*
playlist_max_length
);
playlist
.
order
=
xmalloc
(
sizeof
(
playlist
.
order
[
0
])
*
playlist_max_length
);
playlist
.
idToPosition
=
xmalloc
(
sizeof
(
int
)
*
playlist_max_length
*
PLAYLIST_HASH_MULT
);
playlist
.
positionToId
=
xmalloc
(
sizeof
(
playlist
.
positionToId
[
0
])
*
playlist_max_length
);
playlist
.
songs
=
g_malloc
(
sizeof
(
playlist
.
songs
[
0
])
*
playlist_max_length
);
playlist
.
songMod
=
g_malloc
(
sizeof
(
playlist
.
songMod
[
0
])
*
playlist_max_length
);
playlist
.
order
=
g_malloc
(
sizeof
(
playlist
.
order
[
0
])
*
playlist_max_length
);
playlist
.
idToPosition
=
g_malloc
(
sizeof
(
playlist
.
idToPosition
[
0
])
*
playlist_max_length
*
PLAYLIST_HASH_MULT
);
playlist
.
positionToId
=
g_malloc
(
sizeof
(
playlist
.
positionToId
[
0
])
*
playlist_max_length
);
memset
(
playlist
.
songs
,
0
,
sizeof
(
char
*
)
*
playlist_max_length
);
...
...
@@ -1335,7 +1339,7 @@ enum playlist_result loadPlaylist(struct client *client, const char *utf8file)
const
char
*
temp
=
g_ptr_array_index
(
list
,
i
);
if
((
addToPlaylist
(
temp
,
NULL
))
!=
PLAYLIST_RESULT_SUCCESS
)
{
/* for windows compatibility, convert slashes */
char
*
temp2
=
x
strdup
(
temp
);
char
*
temp2
=
g_
strdup
(
temp
);
char
*
p
=
temp2
;
while
(
*
p
)
{
if
(
*
p
==
'\\'
)
...
...
@@ -1358,7 +1362,7 @@ void searchForSongsInPlaylist(struct client *client,
unsigned
numItems
,
LocateTagItem
*
items
)
{
unsigned
i
;
char
**
originalNeedles
=
x
malloc
(
numItems
*
sizeof
(
char
*
));
char
**
originalNeedles
=
g_
malloc
(
numItems
*
sizeof
(
char
*
));
for
(
i
=
0
;
i
<
numItems
;
i
++
)
{
originalNeedles
[
i
]
=
items
[
i
].
needle
;
...
...
src/stored_playlist.c
View file @
9e46c320
...
...
@@ -21,7 +21,6 @@
#include "song.h"
#include "mapper.h"
#include "path.h"
#include "utils.h"
#include "ls.h"
#include "database.h"
#include "idle.h"
...
...
@@ -32,6 +31,7 @@
#include <unistd.h>
#include <dirent.h>
#include <string.h>
#include <errno.h>
static
struct
stored_playlist_info
*
load_playlist_info
(
const
char
*
parent_path_fs
,
const
char
*
name_fs
)
...
...
@@ -179,7 +179,7 @@ spl_load(const char *utf8path)
s
=
song_get_url
(
song
,
path_max_tmp
);
}
g_ptr_array_add
(
list
,
x
strdup
(
s
));
g_ptr_array_add
(
list
,
g_
strdup
(
s
));
if
(
list
->
len
>=
playlist_max_length
)
break
;
...
...
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