diff options
-rw-r--r-- | src/FilePath.cpp | 5 | ||||
-rw-r--r-- | src/URI.cpp | 7 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/FilePath.cpp b/src/FilePath.cpp index ad739e95..d16c133c 100644 --- a/src/FilePath.cpp +++ b/src/FilePath.cpp @@ -44,13 +44,14 @@ FilePath::operator=(FilePath&& path) noexcept FilePath& FilePath::operator=(string_type&& str) { - return *this = FilePath(std::move(str)); + _str = std::move(str); + return *this; } FilePath& FilePath::operator/=(const FilePath& path) { - const FilePath::string_type str = path.string(); + const FilePath::string_type& str = path.string(); if (!_str.empty() && !is_sep(_str.back()) && !str.empty() && !is_sep(str.front())) { _str += preferred_separator; diff --git a/src/URI.cpp b/src/URI.cpp index 67a26ee9..f7b64209 100644 --- a/src/URI.cpp +++ b/src/URI.cpp @@ -81,8 +81,11 @@ URI::URI(const URI& uri) URI& URI::operator=(const URI& uri) { - serd_node_free(&_node); - _node = serd_node_new_uri(&uri._uri, nullptr, &_uri); + if (&uri != this) { + serd_node_free(&_node); + _node = serd_node_new_uri(&uri._uri, nullptr, &_uri); + } + return *this; } |