diff --git a/source/lib/utf8.cpp b/source/lib/utf8.cpp index 5d6002e917..784424bb44 100644 --- a/source/lib/utf8.cpp +++ b/source/lib/utf8.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -215,7 +215,7 @@ private: //----------------------------------------------------------------------------- -std::string utf8_from_wstring(const std::wstring& src, Status* err) +std::string utf8_from_wstring(const std::wstring_view src, Status* err) { if(err) *err = INFO::OK; @@ -232,7 +232,7 @@ std::string utf8_from_wstring(const std::wstring& src, Status* err) } -std::wstring wstring_from_utf8(const std::string& src, Status* err) +std::wstring wstring_from_utf8(const std::string_view src, Status* err) { if(err) *err = INFO::OK; diff --git a/source/lib/utf8.h b/source/lib/utf8.h index a2903d592e..7745d82a56 100644 --- a/source/lib/utf8.h +++ b/source/lib/utf8.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -26,6 +26,7 @@ #include "lib/status.h" #include +#include // note: error codes are returned via optional output parameter. namespace ERR @@ -46,11 +47,11 @@ namespace ERR * otherwise, the function raises a warning dialog for every * error/warning. **/ -std::wstring wstring_from_utf8(const std::string& s, Status* err = 0); +std::wstring wstring_from_utf8(const std::string_view s, Status* err = 0); /** * opposite of wstring_from_utf8 **/ -std::string utf8_from_wstring(const std::wstring& s, Status* err = 0); +std::string utf8_from_wstring(const std::wstring_view s, Status* err = 0); #endif // #ifndef INCLUDED_UTF8