Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Apps
parole
Commits
034878ce
Commit
034878ce
authored
Jul 07, 2013
by
Sean Davis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use g_path_dirname instead of own implementation, fix crash with remember playlist (bug 10166)
parent
b939f439
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
36 deletions
+12
-36
src/misc/parole-pl-parser.c
src/misc/parole-pl-parser.c
+12
-36
No files found.
src/misc/parole-pl-parser.c
View file @
034878ce
...
...
@@ -58,8 +58,6 @@ typedef struct
gchar
*
g_substr
(
const
gchar
*
string
,
gint
start
,
gint
end
);
gchar
*
g_char_dirname
(
const
gchar
*
filename
);
static
gchar
*
parole_filename_to_utf8
(
const
gchar
*
filename
)
{
...
...
@@ -320,27 +318,6 @@ g_substr (const gchar* string,
return
g_utf8_strncpy
(
output
,
&
string
[
start
],
len
);
}
gchar
*
g_char_dirname
(
const
gchar
*
filename
)
{
int
index
;
const
gchar
*
ptr
;
char
*
find
;
gchar
*
f_name
;
f_name
=
g_strdup
(
filename
);
find
=
"/"
;
ptr
=
strrchr
((
char
*
)
f_name
,
find
[
0
]);
if
(
ptr
)
{
index
=
ptr
-
f_name
;
return
g_substr
(
filename
,
0
,
index
);
}
return
NULL
;
}
static
GSList
*
parole_pl_parser_parse_m3u
(
const
gchar
*
filename
)
{
...
...
@@ -355,7 +332,7 @@ parole_pl_parser_parse_m3u (const gchar *filename)
guint
i
;
file
=
g_file_new_for_path
(
filename
);
path
=
g_
char
_dirname
(
filename
);
path
=
g_
path_get
_dirname
(
filename
);
if
(
!
g_file_load_contents
(
file
,
NULL
,
&
contents
,
&
size
,
NULL
,
NULL
)
)
goto
out
;
...
...
@@ -388,27 +365,26 @@ parole_pl_parser_parse_m3u (const gchar *filename)
for
(
i
=
0
;
lines
[
i
]
!=
NULL
;
i
++
)
{
if
(
lines
[
i
][
0
]
==
'\0'
||
lines
[
i
][
0
]
==
'#'
)
continue
;
if
(
lines
[
i
][
0
]
==
'\0'
||
lines
[
i
][
0
]
==
'#'
)
continue
;
if
(
lines
[
i
][
0
]
!=
'/'
)
{
pl_filename
=
g_strjoin
(
""
,
path
,
lines
[
i
],
NULL
);
list
=
g_slist_append
(
list
,
parole_file_new
(
pl_filename
));
}
if
(
lines
[
i
][
0
]
==
'/'
)
{
pl_filename
=
g_strdup
(
lines
[
i
]);
}
else
{
list
=
g_slist_append
(
list
,
parole_file_new
(
lines
[
i
]));
}
else
{
pl_filename
=
g_strjoin
(
""
,
path
,
lines
[
i
],
NULL
);
}
list
=
g_slist_append
(
list
,
parole_file_new
(
pl_filename
));
}
if
(
pl_filename
)
g_free
(
pl_filename
);
g_strfreev
(
lines
);
out:
g_object_unref
(
file
);
return
list
;
}
...
...
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