aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-08 19:30:10 +0100
committerMax Kellermann <max@duempel.org>2014-01-08 19:50:10 +0100
commit3b568b09437bac0b7419c7d43f3c06357a9205ed (patch)
treea114e6c491008c712c41ac08f17dac9946de5c4f /src/playlist
parentb2e1b3886452451aa4b11c6eeb44d97f96567b35 (diff)
downloadmpd-3b568b09437bac0b7419c7d43f3c06357a9205ed.tar.gz
mpd-3b568b09437bac0b7419c7d43f3c06357a9205ed.tar.xz
mpd-3b568b09437bac0b7419c7d43f3c06357a9205ed.zip
playlist/pls: make variables more local
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/PlsPlaylistPlugin.cxx26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/playlist/PlsPlaylistPlugin.cxx b/src/playlist/PlsPlaylistPlugin.cxx
index efd74e9c5..4dc7a7361 100644
--- a/src/playlist/PlsPlaylistPlugin.cxx
+++ b/src/playlist/PlsPlaylistPlugin.cxx
@@ -40,7 +40,6 @@ static void
pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
{
gchar *value;
- int length;
GError *error = nullptr;
int num_entries = g_key_file_get_integer(keyfile, "playlist",
"NumberOfEntries", &error);
@@ -60,8 +59,6 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
}
for (; num_entries > 0; --num_entries) {
- Song *song;
-
char key[64];
sprintf(key, "File%u", num_entries);
value = g_key_file_get_string(keyfile, "playlist", key,
@@ -74,7 +71,7 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
return;
}
- song = Song::NewRemote(value);
+ Song *song = Song::NewRemote(value);
g_free(value);
TagBuilder tag;
@@ -88,8 +85,8 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
g_free(value);
sprintf(key, "Length%u", num_entries);
- length = g_key_file_get_integer(keyfile, "playlist", key,
- nullptr);
+ int length = g_key_file_get_integer(keyfile, "playlist", key,
+ nullptr);
if (length > 0)
tag.SetTime(length);
@@ -104,15 +101,12 @@ pls_open_stream(InputStream &is)
{
GError *error = nullptr;
Error error2;
- size_t nbytes;
- char buffer[1024];
- bool success;
- GKeyFile *keyfile;
std::string kf_data;
do {
- nbytes = is.LockRead(buffer, sizeof(buffer), error2);
+ char buffer[1024];
+ size_t nbytes = is.LockRead(buffer, sizeof(buffer), error2);
if (nbytes == 0) {
if (error2.IsDefined()) {
LogError(error2);
@@ -131,12 +125,10 @@ pls_open_stream(InputStream &is)
return nullptr;
}
- keyfile = g_key_file_new();
- success = g_key_file_load_from_data(keyfile,
- kf_data.data(), kf_data.length(),
- G_KEY_FILE_NONE, &error);
-
- if (!success) {
+ GKeyFile *keyfile = g_key_file_new();
+ if (!g_key_file_load_from_data(keyfile,
+ kf_data.data(), kf_data.length(),
+ G_KEY_FILE_NONE, &error)) {
FormatError(pls_domain,
"KeyFile parser failed: %s", error->message);
g_error_free(error);