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
4729d10b
Commit
4729d10b
authored
Sep 24, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/sidplay: moved code to sidplay_load_songlength_db()
parent
a8af3ce0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
29 deletions
+36
-29
sidplay_plugin.cxx
src/decoder/sidplay_plugin.cxx
+36
-29
No files found.
src/decoder/sidplay_plugin.cxx
View file @
4729d10b
...
...
@@ -41,42 +41,49 @@ static GKeyFile *songlength_database;
static
bool
all_files_are_containers
;
static
unsigned
default_songlength
;
static
bool
sidplay_
init
(
const
struct
config_param
*
param
)
static
GKeyFile
*
sidplay_
load_songlength_db
(
const
char
*
path
)
{
GError
*
err
=
NULL
;
gchar
*
songlen_data
;
gsize
songlen_data_size
;
GError
*
error
=
NULL
;
gchar
*
data
;
gsize
size
;
if
(
!
g_file_get_contents
(
path
,
&
data
,
&
size
,
&
error
))
{
g_warning
(
"unable to read songlengths file %s: %s"
,
path
,
error
->
message
);
g_error_free
(
error
);
return
NULL
;
}
/* read the songlengths database file */
songlength_file
=
config_get_block_string
(
param
,
"songlength_database"
,
NULL
);
if
(
songlength_file
)
{
if
(
g_file_get_contents
(
songlength_file
,
&
songlen_data
,
&
songlen_data_size
,
&
err
))
{
/* replace any ; comment characters with # */
for
(
int
i
=
0
;
i
<
songlen_data_size
;
i
++
)
if
(
songlen_data
[
i
]
==
';'
)
songlen_data
[
i
]
=
'#'
;
for
(
gsize
i
=
0
;
i
<
size
;
i
++
)
if
(
data
[
i
]
==
';'
)
data
[
i
]
=
'#'
;
songlength_database
=
g_key_file_new
();
if
(
!
g_key_file_load_from_data
(
songlength_database
,
songlen_data
,
songlen_data_size
,
G_KEY_FILE_NONE
,
&
err
))
{
GKeyFile
*
db
=
g_key_file_new
();
if
(
!
g_key_file_load_from_data
(
db
,
data
,
size
,
G_KEY_FILE_NONE
,
&
error
))
{
g_warning
(
"unable to parse songlengths file %s: %s"
,
songlength_file
,
err
->
message
);
g_error_free
(
err
);
g_key_file_free
(
songlength_database
);
songlength_database
=
NULL
;
}
g_key_file_set_list_separator
(
songlength_database
,
' '
);
g_free
(
songlen_data
);
}
else
{
g_warning
(
"unable to read songlengths file %s: %s"
,
songlength_file
,
err
->
message
);
g_error_free
(
err
);
}
path
,
error
->
message
);
g_error_free
(
error
);
g_key_file_free
(
db
);
return
NULL
;
}
g_key_file_set_list_separator
(
db
,
' '
);
g_free
(
data
);
return
db
;
}
static
bool
sidplay_init
(
const
struct
config_param
*
param
)
{
/* read the songlengths database file */
songlength_file
=
config_get_block_string
(
param
,
"songlength_database"
,
NULL
);
if
(
songlength_file
!=
NULL
)
songlength_database
=
sidplay_load_songlength_db
(
songlength_file
);
default_songlength
=
config_get_block_unsigned
(
param
,
"default_songlength"
,
0
);
...
...
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