fs/Charset: pass std::string_view to PathToUTF8()

This commit is contained in:
Max Kellermann 2020-04-03 16:14:26 +02:00
parent 0a4c5edc3b
commit f13f66487a
2 changed files with 2 additions and 8 deletions

View File

@ -92,13 +92,8 @@ FixSeparators(const PathTraitsUTF8::string_view _s)
} }
PathTraitsUTF8::string PathTraitsUTF8::string
PathToUTF8(PathTraitsFS::const_pointer path_fs) PathToUTF8(PathTraitsFS::string_view path_fs)
{ {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(path_fs != nullptr);
#endif
#ifdef _WIN32 #ifdef _WIN32
const auto buffer = WideCharToMultiByte(CP_UTF8, path_fs); const auto buffer = WideCharToMultiByte(CP_UTF8, path_fs);
return FixSeparators(buffer); return FixSeparators(buffer);

View File

@ -44,9 +44,8 @@ DeinitFSCharset() noexcept;
* *
* Throws std::runtime_error on error. * Throws std::runtime_error on error.
*/ */
gcc_nonnull_all
PathTraitsUTF8::string PathTraitsUTF8::string
PathToUTF8(PathTraitsFS::const_pointer path_fs); PathToUTF8(PathTraitsFS::string_view path_fs);
/** /**
* Convert the path from UTF-8. * Convert the path from UTF-8.