PlaylistFile: use PathTraitsFS typedefs

This commit is contained in:
Max Kellermann 2015-03-02 21:43:04 +01:00
parent 6ff394bcc9
commit e9125ef8e4
1 changed files with 6 additions and 5 deletions

View File

@ -37,6 +37,7 @@
#include "fs/FileSystem.hxx" #include "fs/FileSystem.hxx"
#include "fs/FileInfo.hxx" #include "fs/FileInfo.hxx"
#include "fs/DirectoryReader.hxx" #include "fs/DirectoryReader.hxx"
#include "util/Macros.hxx"
#include "util/StringUtil.hxx" #include "util/StringUtil.hxx"
#include "util/UriUtil.hxx" #include "util/UriUtil.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
@ -168,10 +169,10 @@ LoadPlaylistFileInfo(PlaylistInfo &info,
const Path parent_path_fs, const Path parent_path_fs,
const Path name_fs) const Path name_fs)
{ {
const char *name_fs_str = name_fs.c_str(); const auto *const name_fs_str = name_fs.c_str();
size_t name_length = strlen(name_fs_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) memchr(name_fs_str, '\n', name_length) != nullptr)
return false; return false;
@ -183,8 +184,8 @@ LoadPlaylistFileInfo(PlaylistInfo &info,
if (!GetFileInfo(path_fs, fi) || !fi.IsRegular()) if (!GetFileInfo(path_fs, fi) || !fi.IsRegular())
return false; return false;
std::string name(name_fs_str, PathTraitsFS::string name(name_fs_str,
name_length + 1 - sizeof(PLAYLIST_FILE_SUFFIX)); name_length + 1 - ARRAY_SIZE(PLAYLIST_FILE_SUFFIX));
std::string name_utf8 = PathToUTF8(name.c_str()); std::string name_utf8 = PathToUTF8(name.c_str());
if (name_utf8.empty()) if (name_utf8.empty())
return false; return false;