You need to sign in or sign up before continuing.
Commit 975e2750 authored by Max Kellermann's avatar Max Kellermann

fs/Charset: change FixSeparators() API to use std::string&&

parent afcd5670
...@@ -73,7 +73,8 @@ GetFSCharset() ...@@ -73,7 +73,8 @@ GetFSCharset()
#endif #endif
} }
static inline void FixSeparators(std::string &s) static inline std::string &&
FixSeparators(std::string &&s)
{ {
#ifdef WIN32 #ifdef WIN32
// For whatever reason GCC can't convert constexpr to value reference. // For whatever reason GCC can't convert constexpr to value reference.
...@@ -81,9 +82,8 @@ static inline void FixSeparators(std::string &s) ...@@ -81,9 +82,8 @@ static inline void FixSeparators(std::string &s)
auto from = PathTraitsFS::SEPARATOR; auto from = PathTraitsFS::SEPARATOR;
auto to = PathTraitsUTF8::SEPARATOR; auto to = PathTraitsUTF8::SEPARATOR;
std::replace(s.begin(), s.end(), from, to); std::replace(s.begin(), s.end(), from, to);
#else
(void)s;
#endif #endif
return std::move(s);
} }
std::string std::string
...@@ -95,17 +95,12 @@ PathToUTF8(const char *path_fs) ...@@ -95,17 +95,12 @@ PathToUTF8(const char *path_fs)
#endif #endif
#ifdef HAVE_FS_CHARSET #ifdef HAVE_FS_CHARSET
if (fs_converter == nullptr) { if (fs_converter == nullptr)
#endif #endif
auto result = std::string(path_fs); return FixSeparators(path_fs);
FixSeparators(result);
return result;
#ifdef HAVE_FS_CHARSET #ifdef HAVE_FS_CHARSET
}
auto result_path = fs_converter->ToUTF8(path_fs); return FixSeparators(fs_converter->ToUTF8(path_fs));
FixSeparators(result_path);
return result_path;
#endif #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment