From 699630ed167692e6d8d953caadd228bbd87c19aa Mon Sep 17 00:00:00 2001 From: npwoods Date: Wed, 15 Jun 2022 06:57:23 -0400 Subject: osdcore.h: Changed osd_subst_env to accept a std::string_view and return a std::string. (#9928) --- src/osd/windows/winutil.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/osd/windows/winutil.cpp') diff --git a/src/osd/windows/winutil.cpp b/src/osd/windows/winutil.cpp index 7d790949178..3a344386a12 100644 --- a/src/osd/windows/winutil.cpp +++ b/src/osd/windows/winutil.cpp @@ -101,7 +101,7 @@ BOOL win_is_gui_application() //============================================================ // osd_subst_env //============================================================ -void osd_subst_env(std::string &dst, const std::string &src) +std::string osd_subst_env(std::string_view src) { std::wstring const w_src = osd::text::to_wstring(src); std::vector buffer(w_src.size() + 2); @@ -112,10 +112,11 @@ void osd_subst_env(std::string &dst, const std::string &src) buffer.resize(length + 1); length = ExpandEnvironmentStringsW(w_src.c_str(), &buffer[0], buffer.size()); } + + std::string dst; if (length) osd::text::from_wstring(dst, &buffer[0]); - else - dst.clear(); + return dst; } //------------------------------------------------- -- cgit v1.2.3