fixed string pushing
fixed CFunction::_PushString not counting the null terminator --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40193
This commit is contained in:
parent
34097b1dba
commit
a42fa24ef5
@ -130,7 +130,7 @@ int CFunction::_PushString(const char *string, int flags)
|
|||||||
IPluginContext *base = m_pPlugin->m_ctx_current.base;
|
IPluginContext *base = m_pPlugin->m_ctx_current.base;
|
||||||
ParamInfo *info = &m_info[m_curparam];
|
ParamInfo *info = &m_info[m_curparam];
|
||||||
size_t len = strlen(string);
|
size_t len = strlen(string);
|
||||||
size_t cells = (len + sizeof(cell_t) - 1) / sizeof(cell_t);
|
size_t cells = (len + sizeof(cell_t)) / sizeof(cell_t);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if ((err=base->HeapAlloc(cells, &info->local_addr, &info->phys_addr)) != SP_ERROR_NONE)
|
if ((err=base->HeapAlloc(cells, &info->local_addr, &info->phys_addr)) != SP_ERROR_NONE)
|
||||||
@ -142,7 +142,7 @@ int CFunction::_PushString(const char *string, int flags)
|
|||||||
m_params[m_curparam] = info->local_addr;
|
m_params[m_curparam] = info->local_addr;
|
||||||
m_curparam++; /* Prevent a leak */
|
m_curparam++; /* Prevent a leak */
|
||||||
|
|
||||||
if ((err=base->StringToLocalUTF8(info->local_addr, len, string, NULL)) != SP_ERROR_NONE)
|
if ((err=base->StringToLocalUTF8(info->local_addr, len+1, string, NULL)) != SP_ERROR_NONE)
|
||||||
{
|
{
|
||||||
return SetError(err);
|
return SetError(err);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ CForwardManager g_Forwards;
|
|||||||
* X Push floats
|
* X Push floats
|
||||||
* X Push floats byref (copyback tested = yes)
|
* X Push floats byref (copyback tested = yes)
|
||||||
* X Push arrays (copyback tested = yes)
|
* X Push arrays (copyback tested = yes)
|
||||||
* - Push strings (copyback tested = ??)
|
* X Push strings (copyback tested = yes)
|
||||||
* VARARG FUNCTIONS:
|
* VARARG FUNCTIONS:
|
||||||
* - Pushing no varargs
|
* - Pushing no varargs
|
||||||
* - Push vararg cells (copyback should be verified to not happen = ??)
|
* - Push vararg cells (copyback should be verified to not happen = ??)
|
||||||
@ -453,7 +453,7 @@ int CForward::PushString(const char *string)
|
|||||||
if (m_types[m_curparam] == Param_Any)
|
if (m_types[m_curparam] == Param_Any)
|
||||||
{
|
{
|
||||||
m_params[m_curparam].pushedas = Param_String;
|
m_params[m_curparam].pushedas = Param_String;
|
||||||
} else if (m_types[m_curparam] == Param_String) {
|
} else if (m_types[m_curparam] != Param_String) {
|
||||||
return SetError(SP_ERROR_PARAM);
|
return SetError(SP_ERROR_PARAM);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -477,7 +477,7 @@ int CForward::PushStringEx(char *string, int flags)
|
|||||||
if (m_types[m_curparam] == Param_Any)
|
if (m_types[m_curparam] == Param_Any)
|
||||||
{
|
{
|
||||||
m_params[m_curparam].pushedas = Param_String;
|
m_params[m_curparam].pushedas = Param_String;
|
||||||
} else if (m_types[m_curparam] == Param_String) {
|
} else if (m_types[m_curparam] != Param_String) {
|
||||||
return SetError(SP_ERROR_PARAM);
|
return SetError(SP_ERROR_PARAM);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user