From c7d35bcdb2cbd8fb552e28b196cef862e92d8b39 Mon Sep 17 00:00:00 2001 From: Brent McBride Date: Tue, 23 Jun 2026 19:33:40 -0700 Subject: [PATCH] gnc-uri: compose URIs with std::format --- libgnucash/engine/gnc-uri.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libgnucash/engine/gnc-uri.cpp b/libgnucash/engine/gnc-uri.cpp index 3f30857a83..c85a7fe864 100755 --- a/libgnucash/engine/gnc-uri.cpp +++ b/libgnucash/engine/gnc-uri.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -239,8 +240,8 @@ GncUri::try_str (bool allow_password) const */ bool absolute = !abs_path.empty() && (abs_path.front() == '/' || abs_path.front() == '\\'); - return absolute ? scheme + "://" + abs_path - : scheme + ":///" + abs_path; // extra "/" for windows + return absolute ? std::format ("{}://{}", scheme, abs_path) + : std::format ("{}:///{}", scheme, abs_path); // extra "/" for windows } std::string userpass; @@ -257,9 +258,9 @@ GncUri::try_str (bool allow_password) const std::string portstr; if (m_port != 0) - portstr = ":" + std::to_string (m_port); + portstr = std::format (":{}", m_port); - return *m_scheme + "://" + userpass + *m_hostname + portstr + "/" + path; + return std::format ("{}://{}{}{}/{}", *m_scheme, userpass, *m_hostname, portstr, path); } std::string