From 4810adbca2842aaf264e51db6e59814c5bb9c90e Mon Sep 17 00:00:00 2001 From: arthurdead Date: Fri, 26 Aug 2022 13:15:31 -0300 Subject: [PATCH] use PushStringEx --- extension.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/extension.cpp b/extension.cpp index b4d6695..7004844 100644 --- a/extension.cpp +++ b/extension.cpp @@ -925,7 +925,7 @@ struct callback_t final : prop_reference_t bool fwd_call_ehandle(int client, const SendProp *pProp, const void *old_pData, opaque_ptr &new_pData, int objectID) const noexcept { fwd->PushCell(objectID); - fwd->PushString(name.c_str()); + fwd->PushStringEx((char *)name.c_str(), name.size(), SM_PARAM_STRING_COPY|SM_PARAM_STRING_UTF8, 0); const CBaseHandle &hndl{*reinterpret_cast(old_pData)}; edict_t *edict{gamehelpers->GetHandleEntity(const_cast(hndl))}; cell_t sp_value{static_cast(edict ? gamehelpers->IndexOfEdict(edict) : -1)}; @@ -949,7 +949,7 @@ struct callback_t final : prop_reference_t bool fwd_call_color32(int client, const SendProp *pProp, const void *old_pData, opaque_ptr &new_pData, int objectID) const noexcept { fwd->PushCell(objectID); - fwd->PushString(name.c_str()); + fwd->PushStringEx((char *)name.c_str(), name.size(), SM_PARAM_STRING_COPY|SM_PARAM_STRING_UTF8, 0); const color32 &clr{*reinterpret_cast(old_pData)}; cell_t sp_r{static_cast(clr.r)}; cell_t sp_g{static_cast(clr.g)}; @@ -979,7 +979,7 @@ struct callback_t final : prop_reference_t bool fwd_call_int(int client, const SendProp *pProp, const void *old_pData, opaque_ptr &new_pData, int objectID) const noexcept { fwd->PushCell(objectID); - fwd->PushString(name.c_str()); + fwd->PushStringEx((char *)name.c_str(), name.size(), SM_PARAM_STRING_COPY|SM_PARAM_STRING_UTF8, 0); cell_t sp_value{static_cast(*reinterpret_cast(old_pData))}; fwd->PushCellByRef(&sp_value); fwd->PushCell(element); @@ -998,7 +998,7 @@ struct callback_t final : prop_reference_t bool fwd_call_float(int client, const SendProp *pProp, const void *old_pData, opaque_ptr &new_pData, int objectID) const noexcept { fwd->PushCell(objectID); - fwd->PushString(name.c_str()); + fwd->PushStringEx((char *)name.c_str(), name.size(), SM_PARAM_STRING_COPY|SM_PARAM_STRING_UTF8, 0); float sp_value{static_cast(*reinterpret_cast(old_pData))}; fwd->PushFloatByRef(&sp_value); fwd->PushCell(element); @@ -1018,7 +1018,7 @@ struct callback_t final : prop_reference_t bool fwd_call_vec(int client, const SendProp *pProp, const void *old_pData, opaque_ptr &new_pData, int objectID) const noexcept { fwd->PushCell(objectID); - fwd->PushString(name.c_str()); + fwd->PushStringEx((char *)name.c_str(), name.size(), SM_PARAM_STRING_COPY|SM_PARAM_STRING_UTF8, 0); const T &vec{*reinterpret_cast(old_pData)}; cell_t sp_value[3]{ sp_ftoc(vec[0]), @@ -1044,7 +1044,7 @@ struct callback_t final : prop_reference_t bool fwd_call_str(int client, const SendProp *pProp, const void *old_pData, opaque_ptr &new_pData, int objectID) const noexcept { fwd->PushCell(objectID); - fwd->PushString(name.c_str()); + fwd->PushStringEx((char *)name.c_str(), name.size(), SM_PARAM_STRING_COPY|SM_PARAM_STRING_UTF8, 0); static char sp_value[4096]; strcpy(sp_value, reinterpret_cast(old_pData)); fwd->PushStringEx(sp_value, sizeof(sp_value), SM_PARAM_STRING_UTF8|SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); @@ -1065,7 +1065,7 @@ struct callback_t final : prop_reference_t bool fwd_call_tstr(int client, const SendProp *pProp, const void *old_pData, opaque_ptr &new_pData, int objectID) const noexcept { fwd->PushCell(objectID); - fwd->PushString(name.c_str()); + fwd->PushStringEx((char *)name.c_str(), name.size(), SM_PARAM_STRING_COPY|SM_PARAM_STRING_UTF8, 0); static char sp_value[4096]; strcpy(sp_value, STRING(*reinterpret_cast(old_pData))); fwd->PushStringEx(sp_value, sizeof(sp_value), SM_PARAM_STRING_UTF8|SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);