aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am20
-rw-r--r--src/ConfigData.cxx5
-rw-r--r--src/ConfigGlobal.cxx6
-rw-r--r--src/ConfigPath.cxx (renamed from src/utils.c)26
-rw-r--r--src/ConfigPath.hxx (renamed from src/utils.h)6
5 files changed, 21 insertions, 42 deletions
diff --git a/Makefile.am b/Makefile.am
index bf00de012..4c6b78e47 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -98,7 +98,6 @@ mpd_headers = \
src/tag_ape.h \
src/tag_id3.h \
src/tag_rva2.h \
- src/utils.h \
src/timer.h \
src/mpd_error.h
@@ -242,7 +241,6 @@ src_mpd_SOURCES = \
src/TagFile.cxx src/TagFile.hxx \
src/TextFile.cxx src/TextFile.hxx \
src/text_input_stream.c \
- src/utils.c \
src/Volume.cxx src/Volume.hxx \
src/SongFilter.cxx src/SongFilter.hxx \
src/SongPointer.hxx \
@@ -420,6 +418,7 @@ endif
# configuration library
libconf_a_SOURCES = \
+ src/ConfigPath.cxx src/ConfigPath.hxx \
src/ConfigData.cxx src/ConfigData.hxx \
src/ConfigParser.cxx src/ConfigParser.hxx \
src/ConfigGlobal.cxx src/ConfigGlobal.hxx \
@@ -1056,8 +1055,7 @@ test_read_conf_LDADD = \
libutil.a \
libfs.a \
$(GLIB_LIBS)
-test_read_conf_SOURCES = test/read_conf.cxx \
- src/utils.c
+test_read_conf_SOURCES = test/read_conf.cxx
test_run_resolver_LDADD = \
$(GLIB_LIBS)
@@ -1079,8 +1077,7 @@ test_DumpDatabase_SOURCES = test/DumpDatabase.cxx \
src/Song.cxx src/song_sort.c src/SongSave.cxx \
src/Tag.cxx src/TagNames.c src/TagPool.cxx src/TagSave.cxx \
src/SongFilter.cxx \
- src/TextFile.cxx \
- src/utils.c
+ src/TextFile.cxx
test_run_input_LDADD = \
$(INPUT_LIBS) \
@@ -1093,7 +1090,6 @@ test_run_input_LDADD = \
test_run_input_SOURCES = test/run_input.cxx \
test/stdbin.h \
src/IOThread.cxx \
- src/utils.c \
src/Tag.cxx src/TagNames.c src/TagPool.cxx src/TagSave.cxx \
src/fd_util.c
@@ -1110,7 +1106,6 @@ test_visit_archive_LDADD = \
test_visit_archive_SOURCES = test/visit_archive.cxx \
src/IOThread.cxx \
src/InputStream.cxx \
- src/utils.c \
src/Tag.cxx src/TagNames.c src/TagPool.cxx \
src/fd_util.c
@@ -1131,7 +1126,6 @@ test_dump_text_file_LDADD = \
test_dump_text_file_SOURCES = test/dump_text_file.cxx \
test/stdbin.h \
src/IOThread.cxx \
- src/utils.c \
src/Tag.cxx src/TagNames.c src/TagPool.cxx \
src/text_input_stream.c \
src/fd_util.c
@@ -1151,7 +1145,6 @@ test_dump_playlist_LDADD = \
test_dump_playlist_SOURCES = test/dump_playlist.cxx \
$(DECODER_SRC) \
src/IOThread.cxx \
- src/utils.c \
src/Song.cxx src/Tag.cxx src/TagNames.c src/TagPool.cxx src/TagSave.cxx \
src/tag_handler.c src/TagFile.cxx \
src/audio_check.c src/pcm_buffer.c \
@@ -1179,7 +1172,6 @@ test_run_decoder_LDADD = \
test_run_decoder_SOURCES = test/run_decoder.cxx \
test/stdbin.h \
src/IOThread.cxx \
- src/utils.c \
src/Tag.cxx src/TagNames.c src/TagPool.cxx src/tag_handler.c \
src/ReplayGainInfo.cxx \
src/fd_util.c \
@@ -1203,7 +1195,6 @@ test_read_tags_LDADD = \
$(GLIB_LIBS)
test_read_tags_SOURCES = test/read_tags.cxx \
src/IOThread.cxx \
- src/utils.c \
src/Tag.cxx src/TagNames.c src/TagPool.cxx src/tag_handler.c \
src/ReplayGainInfo.cxx \
src/fd_util.c \
@@ -1231,7 +1222,6 @@ test_run_filter_SOURCES = test/run_filter.cxx \
test/FakeReplayGainConfig.cxx \
test/stdbin.h \
src/FilterPlugin.cxx src/FilterRegistry.cxx \
- src/utils.c \
src/audio_check.c \
src/audio_format.c \
src/AudioParser.cxx \
@@ -1250,7 +1240,6 @@ if ENABLE_ENCODER
noinst_PROGRAMS += test/run_encoder
test_run_encoder_SOURCES = test/run_encoder.cxx \
test/stdbin.h \
- src/utils.c \
src/Tag.cxx src/TagNames.c src/TagPool.cxx \
src/audio_check.c \
src/audio_format.c \
@@ -1269,7 +1258,6 @@ if ENABLE_VORBIS_ENCODER
noinst_PROGRAMS += test/test_vorbis_encoder
test_test_vorbis_encoder_SOURCES = test/test_vorbis_encoder.cxx \
test/stdbin.h \
- src/utils.c \
src/Tag.cxx src/TagNames.c src/TagPool.cxx \
src/audio_check.c \
src/audio_format.c \
@@ -1325,7 +1313,6 @@ test_run_output_LDADD = $(MPD_LIBS) \
test_run_output_SOURCES = test/run_output.cxx \
test/FakeReplayGainConfig.cxx \
test/stdbin.h \
- src/utils.c \
src/IOThread.cxx \
src/audio_check.c \
src/audio_format.c \
@@ -1356,7 +1343,6 @@ test_read_mixer_LDADD = \
libfs.a \
$(GLIB_LIBS)
test_read_mixer_SOURCES = test/read_mixer.cxx \
- src/utils.c \
src/MixerControl.cxx \
src/MixerInternal.cxx \
src/FilterPlugin.cxx \
diff --git a/src/ConfigData.cxx b/src/ConfigData.cxx
index 48e9612d4..dd102a19a 100644
--- a/src/ConfigData.cxx
+++ b/src/ConfigData.cxx
@@ -19,12 +19,9 @@
#include "ConfigData.hxx"
#include "ConfigParser.hxx"
+#include "ConfigPath.hxx"
#include "mpd_error.h"
-extern "C" {
-#include "utils.h"
-}
-
#include <glib.h>
#include <assert.h>
diff --git a/src/ConfigGlobal.cxx b/src/ConfigGlobal.cxx
index 9786690d0..a66c03748 100644
--- a/src/ConfigGlobal.cxx
+++ b/src/ConfigGlobal.cxx
@@ -22,11 +22,7 @@
#include "ConfigParser.hxx"
#include "ConfigData.hxx"
#include "ConfigFile.hxx"
-
-extern "C" {
-#include "utils.h"
-}
-
+#include "ConfigPath.hxx"
#include "mpd_error.h"
#include <glib.h>
diff --git a/src/utils.c b/src/ConfigPath.cxx
index 776813c4b..767115d19 100644
--- a/src/utils.c
+++ b/src/ConfigPath.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,7 @@
*/
#include "config.h"
-#include "utils.h"
+#include "ConfigPath.hxx"
#include "conf.h"
#include <glib.h>
@@ -55,35 +55,35 @@ parse_path_quark(void)
char *
parsePath(const char *path, G_GNUC_UNUSED GError **error_r)
{
- assert(path != NULL);
- assert(error_r == NULL || *error_r == NULL);
+ assert(path != nullptr);
+ assert(error_r == nullptr || *error_r == nullptr);
#ifndef WIN32
if (!g_path_is_absolute(path) && path[0] != '~') {
g_set_error(error_r, parse_path_quark(), 0,
"not an absolute path: %s", path);
- return NULL;
+ return nullptr;
} else if (path[0] == '~') {
const char *home;
if (path[1] == '/' || path[1] == '\0') {
- const char *user = config_get_string(CONF_USER, NULL);
- if (user != NULL) {
+ const char *user = config_get_string(CONF_USER, nullptr);
+ if (user != nullptr) {
struct passwd *passwd = getpwnam(user);
if (!passwd) {
g_set_error(error_r, parse_path_quark(), 0,
"no such user: %s", user);
- return NULL;
+ return nullptr;
}
home = passwd->pw_dir;
} else {
home = g_get_home_dir();
- if (home == NULL) {
+ if (home == nullptr) {
g_set_error_literal(error_r, parse_path_quark(), 0,
"problems getting home "
"for current user");
- return NULL;
+ return nullptr;
}
}
@@ -92,7 +92,7 @@ parsePath(const char *path, G_GNUC_UNUSED GError **error_r)
++path;
const char *slash = strchr(path, '/');
- char *user = slash != NULL
+ char *user = slash != nullptr
? g_strndup(path, slash - path)
: g_strdup(path);
@@ -101,7 +101,7 @@ parsePath(const char *path, G_GNUC_UNUSED GError **error_r)
g_set_error(error_r, parse_path_quark(), 0,
"no such user: %s", user);
g_free(user);
- return NULL;
+ return nullptr;
}
g_free(user);
@@ -110,7 +110,7 @@ parsePath(const char *path, G_GNUC_UNUSED GError **error_r)
path = slash;
}
- return g_strconcat(home, path, NULL);
+ return g_strconcat(home, path, nullptr);
} else {
#endif
return g_strdup(path);
diff --git a/src/utils.h b/src/ConfigPath.hxx
index 059d44fa3..42e51215f 100644
--- a/src/utils.h
+++ b/src/ConfigPath.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_UTILS_H
-#define MPD_UTILS_H
+#ifndef MPD_CONFIG_PATH_HXX
+#define MPD_CONFIG_PATH_HXX
#include "gerror.h"