Codechange: [Script] Don't expose static buffers outside of ScriptText

This commit is contained in:
glx22
2023-02-16 02:05:54 +01:00
committed by Loïc Guilloux
parent e735370318
commit 3559576166
16 changed files with 60 additions and 76 deletions

View File

@@ -18,15 +18,10 @@
#include "../../safeguards.h"
RawText::RawText(const char *text) : text(stredup(text))
RawText::RawText(const char *text) : text(text)
{
}
RawText::~RawText()
{
free(this->text);
}
ScriptText::ScriptText(HSQUIRRELVM vm) :
ZeroedMemoryAllocator()
@@ -177,7 +172,7 @@ SQInteger ScriptText::_set(HSQUIRRELVM vm)
return this->_SetParam(k, vm);
}
const char *ScriptText::GetEncodedText()
const std::string ScriptText::GetEncodedText()
{
static char buf[1024];
int param_count = 0;
@@ -208,7 +203,7 @@ char *ScriptText::_GetEncodedText(char *p, char *lastofp, int &param_count)
return p;
}
const char *Text::GetDecodedText()
const std::string Text::GetDecodedText()
{
const std::string &encoded_text = this->GetEncodedText();