diff options
-rw-r--r-- | src/fs/Charset.cxx | 5 | ||||
-rw-r--r-- | src/fs/Charset.hxx | 6 | ||||
-rw-r--r-- | src/fs/Path.hxx | 4 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/fs/Charset.cxx b/src/fs/Charset.cxx index 5a06bf949..b75001043 100644 --- a/src/fs/Charset.cxx +++ b/src/fs/Charset.cxx @@ -79,8 +79,7 @@ GetFSCharset() std::string PathToUTF8(const char *path_fs) { - if (path_fs == nullptr) - return std::string(); + assert(path_fs != nullptr); GIConv conv = g_iconv_open("utf-8", fs_charset.c_str()); if (conv == reinterpret_cast<GIConv>(-1)) @@ -107,6 +106,8 @@ PathToUTF8(const char *path_fs) char * PathFromUTF8(const char *path_utf8) { + assert(path_utf8 != nullptr); + return g_convert(path_utf8, -1, fs_charset.c_str(), "utf-8", nullptr, nullptr, nullptr); diff --git a/src/fs/Charset.hxx b/src/fs/Charset.hxx index 58b5a090a..19dabeb2b 100644 --- a/src/fs/Charset.hxx +++ b/src/fs/Charset.hxx @@ -37,13 +37,13 @@ SetFSCharset(const char *charset); /** * Convert the path to UTF-8. - * Returns empty string on error or if #path_fs is null pointer. + * Returns empty string on error. */ -gcc_pure +gcc_pure gcc_nonnull_all std::string PathToUTF8(const char *path_fs); -gcc_malloc +gcc_malloc gcc_nonnull_all char * PathFromUTF8(const char *path_utf8); diff --git a/src/fs/Path.hxx b/src/fs/Path.hxx index 38112feee..d5b96f407 100644 --- a/src/fs/Path.hxx +++ b/src/fs/Path.hxx @@ -123,10 +123,10 @@ public: * Convert a UTF-8 C string to a #Path instance. * Returns return a "nulled" instance on error. */ - gcc_pure + gcc_pure gcc_nonnull_all static Path FromUTF8(const char *path_utf8); - gcc_pure + gcc_pure gcc_nonnull_all static Path FromUTF8(const char *path_utf8, Error &error); /** |