aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-03-02 21:43:04 +0100
committerMax Kellermann <max@duempel.org>2015-03-02 21:47:33 +0100
commite9125ef8e4fc42ba123aa71b5aed6f7e8d05f103 (patch)
tree53f28976288ee60dbaeb58962d41a00e71a06422
parent6ff394bcc95fbd3796e44b72c7aa4bfe9e3f759b (diff)
downloadmpd-e9125ef8e4fc42ba123aa71b5aed6f7e8d05f103.tar.gz
mpd-e9125ef8e4fc42ba123aa71b5aed6f7e8d05f103.tar.xz
mpd-e9125ef8e4fc42ba123aa71b5aed6f7e8d05f103.zip
PlaylistFile: use PathTraitsFS typedefs
-rw-r--r--src/PlaylistFile.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx
index 804f7d951..e22cacfea 100644
--- a/src/PlaylistFile.cxx
+++ b/src/PlaylistFile.cxx
@@ -37,6 +37,7 @@
#include "fs/FileSystem.hxx"
#include "fs/FileInfo.hxx"
#include "fs/DirectoryReader.hxx"
+#include "util/Macros.hxx"
#include "util/StringUtil.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
@@ -168,10 +169,10 @@ LoadPlaylistFileInfo(PlaylistInfo &info,
const Path parent_path_fs,
const Path name_fs)
{
- const char *name_fs_str = name_fs.c_str();
- size_t name_length = strlen(name_fs_str);
+ const auto *const name_fs_str = name_fs.c_str();
+ const size_t name_length = name_fs.length();
- if (name_length < sizeof(PLAYLIST_FILE_SUFFIX) ||
+ if (name_length < ARRAY_SIZE(PLAYLIST_FILE_SUFFIX) ||
memchr(name_fs_str, '\n', name_length) != nullptr)
return false;
@@ -183,8 +184,8 @@ LoadPlaylistFileInfo(PlaylistInfo &info,
if (!GetFileInfo(path_fs, fi) || !fi.IsRegular())
return false;
- std::string name(name_fs_str,
- name_length + 1 - sizeof(PLAYLIST_FILE_SUFFIX));
+ PathTraitsFS::string name(name_fs_str,
+ name_length + 1 - ARRAY_SIZE(PLAYLIST_FILE_SUFFIX));
std::string name_utf8 = PathToUTF8(name.c_str());
if (name_utf8.empty())
return false;