[gnote] Move semantics for Uri



commit e547473deecf28892b86e08fc4d8f4369bb6cb7c
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Jun 19 18:44:04 2022 +0300

    Move semantics for Uri

 src/plugins/bugzilla/bugzillapreferences.cpp       | 6 +++---
 src/plugins/exporttohtml/exporttohtmlnoteaddin.cpp | 4 ++--
 src/sharp/uri.hpp                                  | 6 +++---
 src/utils.cpp                                      | 4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/bugzilla/bugzillapreferences.cpp b/src/plugins/bugzilla/bugzillapreferences.cpp
index df9703c4..41ae9b34 100644
--- a/src/plugins/bugzilla/bugzillapreferences.cpp
+++ b/src/plugins/bugzilla/bugzillapreferences.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011,2013-2014,2017,2019,2021 Aurimas Cernius
+ * Copyright (C) 2011,2013-2014,2017,2019,2022 Aurimas Cernius
  * Copyright (C) 2010 Debarshi Ray
  * Copyright (C) 2009 Hubert Figuiere
  *
@@ -208,12 +208,12 @@ namespace bugzilla {
     bool sanitize_hostname(Glib::ustring & hostname)
     {
       if(hostname.find("/") != Glib::ustring::npos || hostname.find(":") != Glib::ustring::npos) {
-        sharp::Uri uri(hostname);
+        sharp::Uri uri(std::move(hostname));
         Glib::ustring new_host = uri.get_host();
         if(new_host.empty()) {
           return false;
         }
-        hostname = new_host;
+        hostname = std::move(new_host);
       }
       return true;
     }
diff --git a/src/plugins/exporttohtml/exporttohtmlnoteaddin.cpp 
b/src/plugins/exporttohtml/exporttohtmlnoteaddin.cpp
index af4419da..d30b560c 100644
--- a/src/plugins/exporttohtml/exporttohtmlnoteaddin.cpp
+++ b/src/plugins/exporttohtml/exporttohtmlnoteaddin.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2013,2016-2017,2019-2021 Aurimas Cernius
+ * Copyright (C) 2010-2013,2016-2017,2019-2022 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -115,7 +115,7 @@ void ExportToHtmlNoteAddin::export_button_clicked(const Glib::VariantBase&)
     dialog.save_preferences ();
 
     try {
-      sharp::Uri output_uri(output_path);
+      sharp::Uri output_uri{Glib::ustring(output_path)};
       gnote::utils::open_url(*get_host_window(), "file://" + output_uri.get_absolute_uri());
     } 
     catch (const Glib::Exception & ex) {
diff --git a/src/sharp/uri.hpp b/src/sharp/uri.hpp
index 60f296af..657a543a 100644
--- a/src/sharp/uri.hpp
+++ b/src/sharp/uri.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2017 Aurimas Cernius
+ * Copyright (C) 2017,2022 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -37,8 +37,8 @@ namespace sharp {
   class Uri
   {
   public:
-    Uri(const Glib::ustring & u)
-      : m_uri(u)
+    Uri(Glib::ustring && u)
+      : m_uri(std::move(u))
       {
       }
     const Glib::ustring & to_string() const
diff --git a/src/utils.cpp b/src/utils.cpp
index 7aeca629..4f032fc9 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2017,2019-2021 Aurimas Cernius
+ * Copyright (C) 2010-2017,2019-2022 Aurimas Cernius
  * Copyright (C) 2010 Debarshi Ray
  * Copyright (C) 2009 Hubert Figuiere
  *
@@ -477,7 +477,7 @@ namespace gnote {
           s = sharp::string_replace_first(s, "file:////", "file:///");
         }
         DBG_OUT("uri = %s", s.c_str());
-        push_back(sharp::Uri(s));
+        push_back(sharp::Uri(std::move(s)));
       }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]