From 9f0245e5ffd5075d86a5a3be5b706ac88c3eccfe Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 14 Sep 2024 07:22:51 +0300 Subject: [PATCH] update values reset construction --- .../browser/main/tab/page/navigation/request.cpp | 16 +++++++--------- .../browser/main/tab/page/navigation/request.hpp | 8 ++++---- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/app/browser/main/tab/page/navigation/request.cpp b/src/app/browser/main/tab/page/navigation/request.cpp index c891cd90..de11ba15 100644 --- a/src/app/browser/main/tab/page/navigation/request.cpp +++ b/src/app/browser/main/tab/page/navigation/request.cpp @@ -148,20 +148,18 @@ int Request::save( void Request::parse() // @TODO https://docs.gtk.org/glib/struct.Uri.html { + scheme.clear(); + host.clear(); + port.clear(); + path.clear(); + query.clear(); + auto match = Glib::Regex::split_simple( R"regex(^((\w+)?:\/\/)?([^:\/]+)?(:(\d+)?)?([^\?$]+)?(\?(.*)?)?)regex", get_text() ); - scheme = ""; - host = ""; - port = ""; - path = ""; - query = ""; - - int index = 0; - - for (const Glib::ustring & VALUE : match) + int index = 0; for (const Glib::ustring & VALUE : match) { switch (index) { diff --git a/src/app/browser/main/tab/page/navigation/request.hpp b/src/app/browser/main/tab/page/navigation/request.hpp index 14b499e4..90c31315 100644 --- a/src/app/browser/main/tab/page/navigation/request.hpp +++ b/src/app/browser/main/tab/page/navigation/request.hpp @@ -67,10 +67,10 @@ namespace app::browser::main::tab::page::navigation double progress_fraction; Glib::ustring scheme, - host, - port, - path, - query; + host, + port, + path, + query; // Defaults const bool HEXPAND = true;