diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CommandLine.cxx | 10 | ||||
-rw-r--r-- | src/PlaylistFile.cxx | 3 | ||||
-rw-r--r-- | src/db/Configured.cxx | 3 | ||||
-rw-r--r-- | src/fs/FileSystem.hxx | 4 | ||||
-rw-r--r-- | src/fs/Traits.hxx | 4 | ||||
-rw-r--r-- | src/tag/ApeLoader.cxx | 2 | ||||
-rw-r--r-- | src/tag/TagId3.cxx | 2 | ||||
-rw-r--r-- | src/unix/Daemon.cxx | 2 | ||||
-rw-r--r-- | src/unix/PidFile.hxx | 2 |
9 files changed, 18 insertions, 14 deletions
diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx index 33d8117fb..e87b1676f 100644 --- a/src/CommandLine.cxx +++ b/src/CommandLine.cxx @@ -66,12 +66,12 @@ #include <stdlib.h> #ifdef WIN32 -#define CONFIG_FILE_LOCATION "mpd\\mpd.conf" -#define APP_CONFIG_FILE_LOCATION "conf\\mpd.conf" +#define CONFIG_FILE_LOCATION PATH_LITERAL("mpd\\mpd.conf") +#define APP_CONFIG_FILE_LOCATION PATH_LITERAL("conf\\mpd.conf") #else -#define USER_CONFIG_FILE_LOCATION1 ".mpdconf" -#define USER_CONFIG_FILE_LOCATION2 ".mpd/mpd.conf" -#define USER_CONFIG_FILE_LOCATION_XDG "mpd/mpd.conf" +#define USER_CONFIG_FILE_LOCATION1 PATH_LITERAL(".mpdconf") +#define USER_CONFIG_FILE_LOCATION2 PATH_LITERAL(".mpd/mpd.conf") +#define USER_CONFIG_FILE_LOCATION_XDG PATH_LITERAL("mpd/mpd.conf") #endif static constexpr OptionDef opt_kill( diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx index 0ebb232e5..791b2f2ed 100644 --- a/src/PlaylistFile.cxx +++ b/src/PlaylistFile.cxx @@ -174,7 +174,8 @@ LoadPlaylistFileInfo(PlaylistInfo &info, const auto *const name_fs_str = name_fs.c_str(); const auto *const name_fs_end = - FindStringSuffix(name_fs_str, PLAYLIST_FILE_SUFFIX); + FindStringSuffix(name_fs_str, + PATH_LITERAL(PLAYLIST_FILE_SUFFIX)); if (name_fs_end == nullptr) return false; diff --git a/src/db/Configured.cxx b/src/db/Configured.cxx index 5d95b3e70..c71195769 100644 --- a/src/db/Configured.cxx +++ b/src/db/Configured.cxx @@ -59,7 +59,8 @@ CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener, if (cache_dir.IsNull()) return nullptr; - const auto db_file = AllocatedPath::Build(cache_dir, "mpd.db"); + const auto db_file = AllocatedPath::Build(cache_dir, + PATH_LITERAL("mpd.db")); const auto db_file_utf8 = db_file.ToUTF8(); if (db_file_utf8.empty()) return nullptr; diff --git a/src/fs/FileSystem.hxx b/src/fs/FileSystem.hxx index dcaca7c34..ac4e0998d 100644 --- a/src/fs/FileSystem.hxx +++ b/src/fs/FileSystem.hxx @@ -41,12 +41,12 @@ namespace FOpenMode { /** * Open mode for writing text files. */ - constexpr PathTraitsFS::const_pointer WriteText = "w"; + constexpr PathTraitsFS::const_pointer WriteText = PATH_LITERAL("w"); /** * Open mode for appending text files. */ - constexpr PathTraitsFS::const_pointer AppendText = "a"; + constexpr PathTraitsFS::const_pointer AppendText = PATH_LITERAL("a"); } /** diff --git a/src/fs/Traits.hxx b/src/fs/Traits.hxx index 1a2cd8226..b557dd752 100644 --- a/src/fs/Traits.hxx +++ b/src/fs/Traits.hxx @@ -32,6 +32,8 @@ #include <assert.h> +#define PATH_LITERAL(s) (s) + /** * This class describes the nature of a native filesystem path. */ @@ -48,7 +50,7 @@ struct PathTraitsFS { static constexpr value_type SEPARATOR = '/'; #endif - static constexpr const_pointer CURRENT_DIRECTORY = "."; + static constexpr const_pointer CURRENT_DIRECTORY = PATH_LITERAL("."); static constexpr bool IsSeparator(value_type ch) { return diff --git a/src/tag/ApeLoader.cxx b/src/tag/ApeLoader.cxx index 786ecfe8f..8c89f34c9 100644 --- a/src/tag/ApeLoader.cxx +++ b/src/tag/ApeLoader.cxx @@ -103,7 +103,7 @@ ape_scan_internal(FILE *fp, ApeTagCallback callback) bool tag_ape_scan(Path path_fs, ApeTagCallback callback) { - FILE *fp = FOpen(path_fs, "rb"); + FILE *fp = FOpen(path_fs, PATH_LITERAL("rb")); if (fp == nullptr) return false; diff --git a/src/tag/TagId3.cxx b/src/tag/TagId3.cxx index ade1fd007..98f85daff 100644 --- a/src/tag/TagId3.cxx +++ b/src/tag/TagId3.cxx @@ -521,7 +521,7 @@ tag_id3_riff_aiff_load(FILE *file) struct id3_tag * tag_id3_load(Path path_fs, Error &error) { - FILE *file = FOpen(path_fs, "rb"); + FILE *file = FOpen(path_fs, PATH_LITERAL("rb")); if (file == nullptr) { error.FormatErrno("Failed to open file %s", path_fs.c_str()); return nullptr; diff --git a/src/unix/Daemon.cxx b/src/unix/Daemon.cxx index 3787244d7..c3638cc80 100644 --- a/src/unix/Daemon.cxx +++ b/src/unix/Daemon.cxx @@ -71,7 +71,7 @@ daemonize_kill(void) if (pidfile.IsNull()) FatalError("no pid_file specified in the config file"); - fp = FOpen(pidfile, "r"); + fp = FOpen(pidfile, PATH_LITERAL("r")); if (fp == nullptr) { const std::string utf8 = pidfile.ToUTF8(); FormatFatalSystemError("Unable to open pid file \"%s\"", diff --git a/src/unix/PidFile.hxx b/src/unix/PidFile.hxx index 76d0f13cc..3c3d5ca21 100644 --- a/src/unix/PidFile.hxx +++ b/src/unix/PidFile.hxx @@ -37,7 +37,7 @@ public: if (path.IsNull()) return; - file = FOpen(path, "w"); + file = FOpen(path, FOpenMode::WriteText); if (file == nullptr) { const std::string utf8 = path.ToUTF8(); FormatFatalSystemError("Failed to create pid file \"%s\"", |