gs-effect: Don't include the null character in strings

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2019-08-07 17:14:14 +02:00
parent b88cc0fe01
commit 845a2cbb21

View file

@ -726,7 +726,7 @@ void gs::effect_parameter::get_string(std::string& v)
size_t ptr_len = gs_effect_get_val_size(_param); size_t ptr_len = gs_effect_get_val_size(_param);
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_val(_param)); uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_val(_param));
if (ptr) { if (ptr) {
v = std::string(ptr, ptr + ptr_len); v = std::string(ptr, ptr + ptr_len - 1);
bfree(ptr); bfree(ptr);
} else { } else {
v = ""; v = "";
@ -740,7 +740,7 @@ void gs::effect_parameter::get_default_string(std::string& v)
size_t ptr_len = gs_effect_get_default_val_size(_param); size_t ptr_len = gs_effect_get_default_val_size(_param);
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_default_val(_param)); uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_default_val(_param));
if (ptr) { if (ptr) {
v = std::string(ptr, ptr + ptr_len); v = std::string(ptr, ptr + ptr_len - 1);
bfree(ptr); bfree(ptr);
} else { } else {
v = ""; v = "";