Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jp7677/dxvk-nvapi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Peters <jp7677@gmail.com>2022-03-25 21:48:43 +0300
committerJens Peters <jp7677@gmail.com>2022-03-26 21:23:34 +0300
commitb7d7bb6f4a5d7e6df2dc3c510260aed2fd48cffc (patch)
treee5fd48b6f9bd4eeb3129082d7cf70eaeeee4e559
parent919b818f6fa6d34a3d2ff8de6c37da67214edcf3 (diff)
util: Introduce method to copy a string into nvapi-shortstring
Respect the maximum size.
-rw-r--r--src/util/util_string.cpp5
-rw-r--r--src/util/util_string.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/src/util/util_string.cpp b/src/util/util_string.cpp
index ae3e75b..e80be29 100644
--- a/src/util/util_string.cpp
+++ b/src/util/util_string.cpp
@@ -35,4 +35,9 @@ namespace dxvk::str {
auto w = std::wstring(reinterpret_cast<wchar_t*>(nvus));
return {w.begin(), w.end()};
}
+
+ void tonvss(NvAPI_ShortString nvss, std::string str) {
+ str.resize(NVAPI_SHORT_STRING_MAX);
+ strcpy(nvss, str.c_str());
+ }
}
diff --git a/src/util/util_string.h b/src/util/util_string.h
index 1260906..438f4c8 100644
--- a/src/util/util_string.h
+++ b/src/util/util_string.h
@@ -16,6 +16,8 @@ namespace dxvk::str {
std::string fromnvus(NvAPI_UnicodeString nvus);
+ void tonvss(NvAPI_ShortString nvss, std::string str);
+
inline void format1(std::stringstream&) { }
template<typename... Tx>