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
923d2c96
Commit
923d2c96
authored
Jan 04, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mapper: allocate the result of map_fs_to_utf8()
parent
8c5470a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
11 deletions
+10
-11
mapper.c
src/mapper.c
+5
-3
mapper.h
src/mapper.h
+2
-6
stored_playlist.c
src/stored_playlist.c
+3
-2
No files found.
src/mapper.c
View file @
923d2c96
...
@@ -142,9 +142,11 @@ map_song_fs(const struct song *song)
...
@@ -142,9 +142,11 @@ map_song_fs(const struct song *song)
return
g_strdup
(
utf8_to_fs_charset
(
buffer
,
song
->
url
));
return
g_strdup
(
utf8_to_fs_charset
(
buffer
,
song
->
url
));
}
}
c
onst
c
har
*
char
*
map_fs_to_utf8
(
const
char
*
path_fs
,
char
*
buffer
)
map_fs_to_utf8
(
const
char
*
path_fs
)
{
{
char
buffer
[
MPD_PATH_MAX
];
if
(
strncmp
(
path_fs
,
music_dir
,
music_dir_length
)
==
0
&&
if
(
strncmp
(
path_fs
,
music_dir
,
music_dir_length
)
==
0
&&
path_fs
[
music_dir_length
]
==
'/'
)
path_fs
[
music_dir_length
]
==
'/'
)
/* remove musicDir prefix */
/* remove musicDir prefix */
...
@@ -153,7 +155,7 @@ map_fs_to_utf8(const char *path_fs, char *buffer)
...
@@ -153,7 +155,7 @@ map_fs_to_utf8(const char *path_fs, char *buffer)
/* not within musicDir */
/* not within musicDir */
return
NULL
;
return
NULL
;
return
fs_charset_to_utf8
(
buffer
,
path_fs
);
return
g_strdup
(
fs_charset_to_utf8
(
buffer
,
path_fs
)
);
}
}
const
char
*
const
char
*
...
...
src/mapper.h
View file @
923d2c96
...
@@ -44,7 +44,6 @@ map_uri_fs(const char *uri);
...
@@ -44,7 +44,6 @@ map_uri_fs(const char *uri);
* Determines the file system path of a directory object.
* Determines the file system path of a directory object.
*
*
* @param directory the directory object
* @param directory the directory object
* @param a buffer which is MPD_PATH_MAX bytes long
* @return the path in file system encoding, or NULL if mapping failed
* @return the path in file system encoding, or NULL if mapping failed
*/
*/
char
*
char
*
...
@@ -56,7 +55,6 @@ map_directory_fs(const struct directory *directory);
...
@@ -56,7 +55,6 @@ map_directory_fs(const struct directory *directory);
*
*
* @param directory the parent directory object
* @param directory the parent directory object
* @param name the child's name in UTF-8
* @param name the child's name in UTF-8
* @param a buffer which is MPD_PATH_MAX bytes long
* @return the path in file system encoding, or NULL if mapping failed
* @return the path in file system encoding, or NULL if mapping failed
*/
*/
char
*
char
*
...
@@ -67,7 +65,6 @@ map_directory_child_fs(const struct directory *directory, const char *name);
...
@@ -67,7 +65,6 @@ map_directory_child_fs(const struct directory *directory, const char *name);
* remote song.
* remote song.
*
*
* @param song the song object
* @param song the song object
* @param a buffer which is MPD_PATH_MAX bytes long
* @return the path in file system encoding, or NULL if mapping failed
* @return the path in file system encoding, or NULL if mapping failed
*/
*/
char
*
char
*
...
@@ -78,11 +75,10 @@ map_song_fs(const struct song *song);
...
@@ -78,11 +75,10 @@ map_song_fs(const struct song *song);
* absolute) to a relative path in UTF-8 encoding.
* absolute) to a relative path in UTF-8 encoding.
*
*
* @param path_fs a path in file system encoding
* @param path_fs a path in file system encoding
* @param buffer a buffer which is MPD_PATH_MAX bytes long
* @return the relative path in UTF-8, or NULL if mapping failed
* @return the relative path in UTF-8, or NULL if mapping failed
*/
*/
c
onst
c
har
*
char
*
map_fs_to_utf8
(
const
char
*
path_fs
,
char
*
buffer
);
map_fs_to_utf8
(
const
char
*
path_fs
);
/**
/**
* Returns the playlist directory.
* Returns the playlist directory.
...
...
src/stored_playlist.c
View file @
923d2c96
...
@@ -158,7 +158,6 @@ spl_load(const char *utf8path)
...
@@ -158,7 +158,6 @@ spl_load(const char *utf8path)
while
(
fgets
(
buffer
,
sizeof
(
buffer
),
file
))
{
while
(
fgets
(
buffer
,
sizeof
(
buffer
),
file
))
{
char
*
s
=
buffer
;
char
*
s
=
buffer
;
const
char
*
path_utf8
;
if
(
*
s
==
PLAYLIST_COMMENT
)
if
(
*
s
==
PLAYLIST_COMMENT
)
continue
;
continue
;
...
@@ -166,13 +165,15 @@ spl_load(const char *utf8path)
...
@@ -166,13 +165,15 @@ spl_load(const char *utf8path)
g_strchomp
(
buffer
);
g_strchomp
(
buffer
);
if
(
!
uri_has_scheme
(
s
))
{
if
(
!
uri_has_scheme
(
s
))
{
char
*
path_utf8
;
struct
song
*
song
;
struct
song
*
song
;
path_utf8
=
map_fs_to_utf8
(
s
,
path_max_tmp
);
path_utf8
=
map_fs_to_utf8
(
s
);
if
(
path_utf8
==
NULL
)
if
(
path_utf8
==
NULL
)
continue
;
continue
;
song
=
db_get_song
(
path_utf8
);
song
=
db_get_song
(
path_utf8
);
g_free
(
path_utf8
);
if
(
song
==
NULL
)
if
(
song
==
NULL
)
continue
;
continue
;
...
...
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