Remove the ability to set string_t return values.

This commit is contained in:
Dr!fter 2014-02-13 20:07:26 -05:00
parent 14aae4bf7f
commit 8e4c7d7274
2 changed files with 2 additions and 14 deletions

View File

@ -581,14 +581,6 @@ cell_t Native_SetReturnString(IPluginContext *pContext, const cell_t *params)
switch(returnStruct->type) switch(returnStruct->type)
{ {
case ReturnType_String:
*(string_t *)returnStruct->newResult = MAKE_STRING(value);
returnStruct->isChanged = true;
return 1;
case ReturnType_StringPtr:
*(string_t **)returnStruct->newResult = new string_t(MAKE_STRING(value));
returnStruct->isChanged = true;
return 1;
case ReturnType_CharPtr: case ReturnType_CharPtr:
*(char **)returnStruct->newResult = new char[strlen(value)+1]; *(char **)returnStruct->newResult = new char[strlen(value)+1];
strcpy(*(char **)returnStruct->newResult, value); strcpy(*(char **)returnStruct->newResult, value);

View File

@ -91,20 +91,16 @@ class HookReturnStruct
public: public:
~HookReturnStruct() ~HookReturnStruct()
{ {
if(this->type != ReturnType_CharPtr && this->type != ReturnType_StringPtr && this->type != ReturnType_Vector && this->type != ReturnType_VectorPtr) if(this->type != ReturnType_CharPtr && this->type != ReturnType_Vector && this->type != ReturnType_VectorPtr)
{ {
free(this->newResult); free(this->newResult);
} }
else if(this->isChanged) else if(this->isChanged)
{ {
if(this->type != ReturnType_CharPtr) if(this->type == ReturnType_CharPtr)
{ {
delete *(char **)this->newResult; delete *(char **)this->newResult;
} }
else if(this->type != ReturnType_StringPtr)
{
delete *(string_t **)this->newResult;
}
else if(this->type == ReturnType_Vector || this->type == ReturnType_VectorPtr) else if(this->type == ReturnType_Vector || this->type == ReturnType_VectorPtr)
{ {
delete *(Vector **)this->newResult; delete *(Vector **)this->newResult;