From 412f35c0a3e4eff3b80e981c905402fab43a6ca4 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Fri, 6 Oct 2017 13:11:25 +0300 Subject: Small refactoring + elim trail space. --- src/uri.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/uri.cpp') diff --git a/src/uri.cpp b/src/uri.cpp index 9178c8ae8..219792b6e 100644 --- a/src/uri.cpp +++ b/src/uri.cpp @@ -159,7 +159,7 @@ const std::string URI::getFullPath(std::string const &base) const { path = Glib::build_filename(base, path); } // Check the existance of the file - if(! g_file_test(path.c_str(), G_FILE_TEST_EXISTS) + if(! g_file_test(path.c_str(), G_FILE_TEST_EXISTS) || g_file_test(path.c_str(), G_FILE_TEST_IS_DIR) ) { path.clear(); } @@ -207,13 +207,11 @@ URI URI::fromUtf8( gchar const* path ) { tmp += (gunichar)one; } else { gchar scratch[4]; - g_snprintf( scratch, 4, "%c%02X", '%', one ); + g_snprintf( scratch, 4, "%%%02X", one ); tmp.append( scratch ); } } - const gchar *uri = tmp.data(); - URI result(uri); - return result; + return URI( tmp.data() ); } /* TODO !!! proper error handling */ -- cgit v1.2.3