scilab: fix default_args test (crash on casts1)
This commit is contained in:
parent
a00354f2e3
commit
a33d81fd6b
1 changed files with 18 additions and 10 deletions
|
|
@ -155,19 +155,27 @@ SWIG_SciString_AsCharPtrAndSize(void *_pvApiCtx, int _iVar, char **_pcValue, siz
|
||||||
%fragment("SWIG_SciString_FromCharPtr", "header") {
|
%fragment("SWIG_SciString_FromCharPtr", "header") {
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SWIG_SciString_FromCharPtr(void *_pvApiCtx, int _iVarOut, const char *_pchValue) {
|
SWIG_SciString_FromCharPtr(void *_pvApiCtx, int _iVarOut, const char *_pchValue) {
|
||||||
SciErr sciErr;
|
if (_pchValue) {
|
||||||
char **pstData = NULL;
|
SciErr sciErr;
|
||||||
|
char **pstData = NULL;
|
||||||
|
|
||||||
pstData = (char **)malloc(sizeof(char *));
|
pstData = (char **)malloc(sizeof(char *));
|
||||||
pstData[0] = strdup(_pchValue);
|
pstData[0] = strdup(_pchValue);
|
||||||
|
|
||||||
sciErr = createMatrixOfString(_pvApiCtx, SWIG_NbInputArgument(_pvApiCtx) + _iVarOut, 1, 1, (char **)pstData);
|
sciErr = createMatrixOfString(_pvApiCtx, SWIG_NbInputArgument(_pvApiCtx) + _iVarOut, 1, 1, (char **)pstData);
|
||||||
if (sciErr.iErr) {
|
if (sciErr.iErr) {
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(pstData[0]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int iRet = createEmptyMatrix(_pvApiCtx, SWIG_NbInputArgument(_pvApiCtx) + _iVarOut);
|
||||||
|
if (iRet) {
|
||||||
|
return SWIG_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(pstData[0]);
|
|
||||||
|
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue