scilab: fix SWIG_SciString_FromChar compilation error on some compilers

This commit is contained in:
Simon Marchetto 2014-10-14 09:26:12 +02:00
parent 07eb661565
commit 6791e3ac7a
1 changed files with 3 additions and 7 deletions

View File

@ -156,18 +156,14 @@ SWIGINTERN int
SWIG_SciString_FromCharPtr(void *pvApiCtx, int iVarOut, const char *pchValue) {
if (pchValue) {
SciErr sciErr;
char **pstData = NULL;
const char* pstStrings[1];
pstStrings[0] = pchValue;
pstData = (char **)malloc(sizeof(char *));
pstData[0] = strdup(pchValue);
sciErr = createMatrixOfString(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, 1, 1, (char **)pstData);
sciErr = createMatrixOfString(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, 1, 1, pstStrings);
if (sciErr.iErr) {
printError(&sciErr, 0);
return SWIG_ERROR;
}
free(pstData[0]);
}
else {
int iRet = createEmptyMatrix(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut);