pD->setImg(_pdblImg[i]);
}
pP->setCoef(i, pD);
+ delete pD;
}
wchar_t* pwstName = to_wide_string(_pstName);
{
*_pdblImg = pI;
}
+ else
+ {
+ FREE(pI);
+ }
+
return sciErr;
}
//get function arguments
exps_t args = e.getArgs();
- for (auto arg : args)
+ try
{
- if (arg->isAssignExp())
+ for (auto arg : args)
{
- AssignExp* pAssign = static_cast<AssignExp*>(arg);
- //optional parameter
- Exp* pL = &pAssign->getLeftExp();
- if (!pL->isSimpleVar())
+ if (arg->isAssignExp())
{
- clearResult();
- cleanOpt(opt);
- cleanIn(in, out);
-
- std::wostringstream os;
- os << _W("left side of optional parameter must be a variable") << std::endl;
- throw ast::InternalError(os.str(), 999, e.getLocation());
- }
+ AssignExp* pAssign = static_cast<AssignExp*>(arg);
+ //optional parameter
+ Exp* pL = &pAssign->getLeftExp();
+ if (!pL->isSimpleVar())
+ {
+ std::wostringstream os;
+ os << _W("left side of optional parameter must be a variable") << std::endl;
+ throw ast::InternalError(os.str(), 999, e.getLocation());
+ }
- SimpleVar* pVar = pL->getAs<SimpleVar>();
- Exp* pR = &pAssign->getRightExp();
- pR->accept(*this);
- InternalType* pITR = getResult();
- // IncreaseRef to protect opt argument of scope_end delete
- // It will be deleted by clear_opt
- pITR->IncreaseRef();
+ SimpleVar* pVar = pL->getAs<SimpleVar>();
+ Exp* pR = &pAssign->getRightExp();
+ pR->accept(*this);
+ InternalType* pITR = getResult();
+ // IncreaseRef to protect opt argument of scope_end delete
+ // It will be deleted by clear_opt
+ pITR->IncreaseRef();
- if (pIT->hasInvokeOption())
- {
- opt.push_back(std::pair<std::wstring, InternalType*>(pVar->getSymbol().getName(), pITR));
- //in case of macro/macrofile, we have to shift input param
- //so add NULL item in in list to keep initial order
- if (pIT->isMacro() || pIT->isMacroFile())
+ if (pIT->hasInvokeOption())
+ {
+ opt.push_back(std::pair<std::wstring, InternalType*>(pVar->getSymbol().getName(), pITR));
+ //in case of macro/macrofile, we have to shift input param
+ //so add NULL item in in list to keep initial order
+ if (pIT->isMacro() || pIT->isMacroFile())
+ {
+ in.push_back(NULL);
+ }
+ }
+ else
{
- in.push_back(NULL);
+ in.push_back(pITR);
}
- }
- else
- {
- in.push_back(pITR);
- }
- clearResult();
- continue;
- }
+ clearResult();
+ continue;
+ }
- int iSize = getExpectedSize();
- setExpectedSize(-1);
- arg->accept(*this);
- setExpectedSize(iSize);
+ int iSize = getExpectedSize();
+ setExpectedSize(-1);
+ arg->accept(*this);
+ setExpectedSize(iSize);
- if (getResult() == NULL)
- {
- //special case for empty extraction of list ( list()(:) )
- continue;
- }
+ if (getResult() == NULL)
+ {
+ //special case for empty extraction of list ( list()(:) )
+ continue;
+ }
- //extract implicit list for call()
- if (pIT->isCallable() || pIT->isUserType())
- {
- InternalType * pITArg = getResult();
- if (pITArg->isImplicitList())
+ //extract implicit list for call()
+ if (pIT->isCallable() || pIT->isUserType())
{
- types::ImplicitList* pIL = pITArg->getAs<types::ImplicitList>();
- if (pIL->isComputable())
+ InternalType * pITArg = getResult();
+ if (pITArg->isImplicitList())
{
- setResult(pIL->extractFullMatrix());
- pITArg->killMe();
+ types::ImplicitList* pIL = pITArg->getAs<types::ImplicitList>();
+ if (pIL->isComputable())
+ {
+ setResult(pIL->extractFullMatrix());
+ pITArg->killMe();
+ }
}
}
- }
- if (isSingleResult())
- {
- in.push_back(getResult());
- getResult()->IncreaseRef();
- clearResult();
- }
- else
- {
- for (int i = 0 ; i < getResultSize() ; i++)
+ if (isSingleResult())
{
- InternalType * pITArg = getResult(i);
- pITArg->IncreaseRef();
- in.push_back(pITArg);
+ in.push_back(getResult());
+ getResult()->IncreaseRef();
+ clearResult();
}
+ else
+ {
+ for (int i = 0 ; i < getResultSize() ; i++)
+ {
+ InternalType * pITArg = getResult(i);
+ pITArg->IncreaseRef();
+ in.push_back(pITArg);
+ }
- clearResult();
+ clearResult();
+ }
}
}
+ catch (const InternalError& ie)
+ {
+ clearResult();
+ cleanOpt(opt);
+ cleanIn(in, out);
+ throw ie;
+ }
try
{
Function::ReturnValue sci_getmd5(types::typed_list &in, int _iRetCount, types::typed_list &out)
{
bool bStringMode = false;
+ char* pstPath = NULL;
if (_iRetCount != 1)
{
if (bStringMode)
{
- pstMD5 = to_wide_string(md5_str(wide_string_to_UTF8(wcsCurrentIn)));
+ pstPath = wide_string_to_UTF8(wcsCurrentIn);
+ pstMD5 = to_wide_string(md5_str(pstPath));
}
else
{
/* Replaces SCI, ~, HOME, TMPDIR by the real path */
real_path = expandPathVariableW(wcsCurrentIn);
+ pstPath = wide_string_to_UTF8(real_path);
/* bug 4469 */
if (isdirW(real_path))
{
- char* pstPath = wide_string_to_UTF8(real_path);
Scierror(999, _("%s: The file %s does not exist.\n"), "getmd5", pstPath);
FREE(pstPath);
delete pOutput;
- delete real_path;
+ FREE(real_path);
return Function::Error;
}
- wcfopen(fp, wide_string_to_UTF8(real_path), "rb");
+ wcfopen(fp, pstPath, "rb");
if (fp)
{
- pstMD5 = to_wide_string(md5_file(fp));
+ char* pstrFile = md5_file(fp);
+ pstMD5 = to_wide_string(pstrFile);
fclose(fp);
+ FREE(pstrFile);
}
else
{
- char* pstPath = wide_string_to_UTF8(real_path);
Scierror(999, _("%s: The file %s does not exist.\n"), "getmd5", pstPath);
FREE(pstPath);
delete pOutput;
FREE(real_path);
return Function::Error;
}
+
+ FREE(pstPath);
+ FREE(real_path);
}
pOutput->set(i, pstMD5);
-
+ FREE(pstMD5);
}
out.push_back(pOutput);
-
return Function::OK;
}
/*--------------------------------------------------------------------------*/
}
catch (const std::exception & e)
{
+ if (strs)
+ {
+ freeAllocatedMatrixOfString(row, col, strs);
+ }
+
Scierror(999, _("%s: %s\n"), fname, e.what());
return 0;
}
+ if (strs)
+ {
+ freeAllocatedMatrixOfString(row, col, strs);
+ }
+
AssignOutputVariable(pvApiCtx, 1) = 0;
ReturnArguments(pvApiCtx);
-
return 0;
}
createEmptyMatrix(pvApiCtx, nbIn + 1);
}
- for (auto& i : varList)
+ for (auto & i : varList)
{
FREE(i);
}
{
sciErr = createMatrixOfInteger8InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pcData);
}
+
+ FREE(pcData);
}
break;
case SCI_UINT8:
{
sciErr = createMatrixOfUnsignedInteger8InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pucData);
}
+
+ FREE(pucData);
}
break;
case SCI_INT16:
{
sciErr = createMatrixOfInteger16InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, psData);
}
+
+ FREE(psData);
}
break;
case SCI_UINT16:
{
sciErr = createMatrixOfUnsignedInteger16InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pusData);
}
+
+ FREE(pusData);
}
break;
case SCI_INT32:
{
sciErr = createMatrixOfInteger32InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, piData);
}
+
+ FREE(piData);
}
break;
case SCI_UINT32:
{
sciErr = createMatrixOfUnsignedInteger32InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, puiData);
}
+
+ FREE(puiData);
}
break;
case SCI_INT64:
{
sciErr = createMatrixOfInteger64InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pllData);
}
+
+ FREE(pllData);
#else
return false;
#endif
{
sciErr = createMatrixOfUnsignedInteger64InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, iRows, iCols, pullData);
}
+
+ FREE(pullData);
#else
return false;
#endif
iRet = readStringMatrix_v1(iItemDataset, iRows, iCols, pstData);
if (iRet || strcmp(pstData[0], "hm") != 0)
{
- //freeStringMatrix_v1(iItemDataset, pstData);
+ FREE(piItemRef);
+ for (int i = 0; i < iRows * iCols; i++)
+ {
+ FREE(pstData[i]);
+ }
delete[] pstData;
return false;
}
- //freeStringMatrix_v1(iItemDataset, pstData);
+ for (int i = 0; i < iRows * iCols; i++)
+ {
+ FREE(pstData[i]);
+ }
delete[] pstData;
pstData = NULL;
createEmptyMatrix(pvApiCtx, nbIn + 1);
}
- for (auto& i : varList)
+ for (auto & i : varList)
{
FREE(i);
}
if (iDims > 2)
{
//hypermatrix
- FREE(piDims);
return false;
}
if (iDims == 0 || iSize == 0) //empty matrix
{
+ if (piDims)
+ {
+ FREE(piDims);
+ }
+
/*bug 7224 : to close dataset */
iRet = readEmptyMatrix(_iDatasetId);
if (iRet)
{
- if (piDims)
- {
- FREE(piDims);
- }
-
return false;
}
{
sciErr = createMatrixOfInteger8InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], pcData);
}
+
+ FREE(pcData);
}
break;
case SCI_UINT8:
{
sciErr = createMatrixOfUnsignedInteger8InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], pucData);
}
+
+ FREE(pucData);
}
break;
case SCI_INT16:
{
sciErr = createMatrixOfInteger16InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], psData);
}
+
+ FREE(psData);
}
break;
case SCI_UINT16:
{
sciErr = createMatrixOfUnsignedInteger16InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], pusData);
}
+
+ FREE(pusData);
}
break;
case SCI_INT32:
{
sciErr = createMatrixOfInteger32InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], piData);
}
+
+ FREE(piData);
}
break;
case SCI_UINT32:
{
sciErr = createMatrixOfUnsignedInteger32InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], puiData);
}
+
+ FREE(puiData);
}
break;
case SCI_INT64:
{
sciErr = createMatrixOfInteger64InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], pllData);
}
+
+ FREE(pllData);
#else
FREE(piDims);
return false;
{
sciErr = createMatrixOfUnsignedInteger64InNamedList(pvCtx, _pstVarname, _piAddress, _iItemPos, piDims[0], piDims[1], pullData);
}
+
+ FREE(pullData);
#else
FREE(piDims);
return false;
iRet = getListItemReferences(_iDatasetId, &piItemRef);
if (iRet)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
iRet = getListItemDataset(_iDatasetId, piItemRef, 0, &iItemDataset);
if (iRet || iItemDataset == 0)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
int iItemType = getScilabTypeFromDataSet(iItemDataset);
if (iItemType != sci_strings)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
iRet = getDatasetInfo(iItemDataset, &iComplex, &iDims, NULL);
if (iRet < 0 || iDims != 2)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
int iSize = getDatasetInfo(iItemDataset, &iComplex, &iDims, piDims);
if (iSize != 3)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete[] piDims;
return false;
}
iRet = readStringMatrix(iItemDataset, pstData);
if (iRet || strcmp(pstData[0], "hm") != 0)
{
+ // if not the good type, do not h5close (deleteListItemReferences)
+ FREE(piItemRef);
freeStringMatrix(iItemDataset, pstData);
delete[] pstData;
return false;
iRet = getListItemDataset(_iDatasetId, piItemRef, 1, &iItemDataset);
if (iRet)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
iRet = getDatasetInfo(iItemDataset, &iComplex, &iDims, NULL);
if (iRet < 0 || iDims != 2)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
iSize = getDatasetInfo(iItemDataset, &iComplex, &iDims, piDims);
if (piDims[0] != 1)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete[] piDims;
return false;
}
iRet = readInteger32Matrix(iItemDataset, piDimsArray);
if (iRet)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete[] piDims;
delete[] piDimsArray;
return false;
bool bRet = import_data(pvCtx, iItemDataset, _iItemPos, _piAddress, _pstVarname);
if (bRet == false)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete[] piDims;
delete[] piDimsArray;
return false;
iRet = getListItemReferences(_iDatasetId, &piItemRef);
if (iRet)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
iRet = getListItemDataset(_iDatasetId, piItemRef, 0, &iItemDataset);
if (iRet || iItemDataset == 0)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
int iItemType = getScilabTypeFromDataSet(iItemDataset);
if (iItemType != sci_strings)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
iRet = getDatasetInfo(iItemDataset, &iComplex, &iDims, NULL);
if (iRet < 0 || iDims != 2)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
int iSize = getDatasetInfo(iItemDataset, &iComplex, &iDims, piDims);
if (iSize != iItems)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete[] piDims;
return false;
}
iRet = readStringMatrix(iItemDataset, pstData);
if (iRet || strcmp(pstData[0], "st") != 0)
{
+ // if not the good type, do not h5close (deleteListItemReferences)
+ FREE(piItemRef);
freeStringMatrix(iItemDataset, pstData);
delete[] pstData;
delete[] pstDataSave;
iRet = getListItemDataset(_iDatasetId, piItemRef, 1, &iItemDataset);
if (iRet)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
for (int i = 0; i < (-2 + iItems); ++i)
{
delete pstDataSave[i];
iRet = getDatasetInfo(iItemDataset, &iComplex, &iDims, NULL);
if (iRet < 0 || iDims != 2)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
for (int i = 0; i < (-2 + iItems); ++i)
{
delete pstDataSave[i];
iSize = getDatasetInfo(iItemDataset, &iComplex, &iDims, piDims);
if (piDims[0] != 1)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
for (int i = 0; i < (-2 + iItems); ++i)
{
delete pstDataSave[i];
iRet = readInteger32Matrix(iItemDataset, piDimsArray);
if (iRet)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
for (int i = 0; i < (-2 + iItems); ++i)
{
delete pstDataSave[i];
iRet = getListItemDataset(_iDatasetId, piItemRef, i + 2, &iItemDataset);
if (iRet || iItemDataset == 0)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete pList;
delete pStruct;
return false;
bool bRet = import_data(pvCtx, iItemDataset, 1, (int*)pList, pcName);
if (bRet == false)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete pList;
delete pStruct;
return false;
iRet = getListItemDataset(_iDatasetId, piItemRef, i + 2, &iItemDataset);
if (iRet || iItemDataset == 0)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete pList;
delete pStruct;
return false;
bool bRet = import_data(pvCtx, iItemDataset, 1, (int*)pList, pcName);
if (bRet == false)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete pList;
delete pStruct;
return false;
iRet = getListItemReferences(_iDatasetId, &piItemRef);
if (iRet)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
iRet = getListItemDataset(_iDatasetId, piItemRef, 0, &iItemDataset);
if (iRet || iItemDataset == 0)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
int iItemType = getScilabTypeFromDataSet(iItemDataset);
if (iItemType != sci_strings)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
iRet = getDatasetInfo(iItemDataset, &iComplex, &iDims, NULL);
if (iRet < 0 || iDims != 2)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
int iSize = getDatasetInfo(iItemDataset, &iComplex, &iDims, piDims);
if (iSize != 3)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete[] piDims;
return false;
}
iRet = readStringMatrix(iItemDataset, pstData);
if (iRet || strcmp(pstData[0], "ce") != 0)
{
+ // if not the good type, do not h5close (deleteListItemReferences)
+ FREE(piItemRef);
freeStringMatrix(iItemDataset, pstData);
delete[] pstData;
return false;
iRet = getListItemDataset(_iDatasetId, piItemRef, 1, &iItemDataset);
if (iRet)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
iRet = getDatasetInfo(iItemDataset, &iComplex, &iDims, NULL);
if (iRet < 0 || iDims != 2)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
return false;
}
iSize = getDatasetInfo(iItemDataset, &iComplex, &iDims, piDims);
if (piDims[0] != 1)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete[] piDims;
return false;
}
iRet = readInteger32Matrix(iItemDataset, piDimsArray);
if (iRet)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete[] piDims;
delete[] piDimsArray;
return false;
iRet = getListItemDataset(_iDatasetId, piItemRef, 2, &iItemDataset);
if (iRet || iItemDataset == 0)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete pList;
delete pCell;
return false;
bool bRet = import_data(pvCtx, iItemDataset, 1, (int*)pList, NULL);
if (bRet == false)
{
+ deleteListItemReferences(_iDatasetId, piItemRef);
delete pList;
delete pCell;
return false;
{
std::vector<char*> vars(iNbItem);
iNbItem = getVariableNames6(iFile, vars.data());
- for (auto &var : vars)
+ for (auto & var : vars)
{
std::string s(var);
FREE(var);
}
lst->append(child);
+ if (child->isList())
+ {
+ child->killMe();
+ }
}
closeList6(dataset);
{
//empty struct
closeList6(dataset);
+ delete str;
return new types::Struct();
}
//open __refs__ node
int refs = getDataSetIdFromName(dataset, "__refs__");
- for (const auto& name : fields)
+ for (const auto & name : fields)
{
wchar_t* field = to_wide_string(name);
str->addField(field);
{
closeList6(dataset);
freeStringMatrix(dfield, fields.data());
+ delete str;
return nullptr;
}
if (ret < 0)
{
freeStringMatrix(dfield, fields.data());
+ delete str;
return nullptr;
}
if (data < 0)
{
freeStringMatrix(dfield, fields.data());
+ delete str;
return nullptr;
}
if (val == nullptr)
{
freeStringMatrix(dfield, fields.data());
+ delete str;
return nullptr;
}
if (Links::count())
{
std::list<int> legends = Links::legends();
- for (auto& i : legends)
+ for (auto & i : legends)
{
Links::PathList paths = Links::get(i);
update_link_path(i, paths);
{
readStringMatrix(inputNode, inputNames.data());
- for (auto& input : inputNames)
+ for (auto & input : inputNames)
{
wchar_t* winput = to_wide_string(input);
symbol::Variable* var = ctx->getOrCreate(symbol::Symbol(winput));
{
readStringMatrix(outputNode, outputNames.data());
- for (auto& output : outputNames)
+ for (auto & output : outputNames)
{
wchar_t* woutput = to_wide_string(output);
symbol::Variable* var = ctx->getOrCreate(symbol::Symbol(woutput));
if (out.size() != 1)
{
- for (auto& i : out)
+ for (auto & i : out)
{
i->killMe();
}
//save fields list in vector to keep order
export_string(dset, "__fields__", fields);
-
std::vector<hobj_ref_t> vrefs(size);
//fill main group with struct field name
for (int i = 0; i < fieldCount; ++i)
ret = addItemStruct6(refs, vrefs.data(), j, refname.data());
if (ret)
{
+ delete fields;
return -1;
}
}
FREE(cfield);
if (ret < 0)
{
+ delete fields;
return -1;
}
}
+ delete fields;
+
if (closeList6(refs) == -1)
{
return -1;
char* pstScilabVersion = getScilabVersionAttribute(_iFile);
if (pstScilabVersion)
{
+ FREE(pstScilabVersion);
+
//delete before write
status = H5Adelete(_iFile, g_SCILAB_CLASS_SCI_VERSION);
if (status < 0)
}
////unlink child
//status = H5Ldelete(groupID, pstChildName, H5P_DEFAULT);
- //FREE(pstChildName);
+ FREE(pstChildName);
//if (status < 0)
//{
// export does not return %f when try to export unmanaged data types.
//
A = sparse( [ 2 3 0 0 0;
- 3 0 4 0 6;
- 0 -1 -3 2 0;
- 0 0 1 0 0;
- 0 4 2 0 1] );
+3 0 4 0 6;
+0 -1 -3 2 0;
+0 0 1 0 0;
+0 4 2 0 1] );
b = [8 ; 45; -3; 3; 19];
lusparse = umf_lufact(A);
err = execstr("save(TMPDIR + ""/lusparse.sod"",""lusparse"")", "errcatch");
assert_checktrue(err <> 0);
if ls(TMPDIR+"/lusparse.sod") <> [] then pause end
+umf_ludel(lusparse);
err = execstr("save(TMPDIR + ""/lusparse.sod"",""lusparse"")", "errcatch");
assert_checktrue(err <> 0);
if ls(TMPDIR+"/lusparse.sod") <> [] then pause end
+umf_ludel(lusparse);
msgerr = msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"), "h5open", 1);
assert_checkerror("h5open(42)",msgerr,999);
a = h5open(TMPDIR + "/x.sod");
-assert_checkequal(a.root.Name,'/')
+assert_checkequal(a.root.Name,"/")
ans =
-
- T
+ T
h5close(a);
x = 1:10;
save(TMPDIR + "/x.sod", "x");
b = h5open(TMPDIR + "/x.sod");
-assert_checkequal(b.root.Datasets,'x');
+assert_checkequal(b.root.Datasets,"x");
h5close(b);
a = h5open(TMPDIR + "/y.tst");
-assert_checkequal(a.root.Name,'/');
+assert_checkequal(a.root.Name,"/");
h5write(a,"Dset_1",[1 2;3 4]);
h5close(a);
-msgerr = msprintf(gettext("%s: %s\n"), "h5open", msprintf(gettext("Cannot append the file (not HDF5): %s."), pathconvert(SCI, %f) + filesep() + "COPYING-FR"));
-msgerr($+1) = gettext("HDF5 description") + ": " + "unable to find a valid file signature.";
-assert_checkerror("h5open(SCI + ""/COPYING-FR"")",msgerr,999);
+try
+ h5open(SCI + "/COPYING-FR");
+ error("h5open should produce an error");
+catch
+end
copyfile(SCI+"/COPYING-FR",TMPDIR+"/z.h5");
-msgerr = msprintf(gettext("%s: %s\n"), "h5open", msprintf(gettext("Cannot append the file (not HDF5): %s."), TMPDIR + filesep() + "z.h5"));
-msgerr($+1) = gettext("HDF5 description") + ": " + "unable to find a valid file signature.";
-assert_checkerror("h5open(TMPDIR + ""/z.h5"")",msgerr,999);
+try
+ h5open(TMPDIR+"/z.h5");
+ error("h5open should produce an error");
+catch
+end
assert_checkerror("h5open(42)",msgerr,999);
a = h5open(TMPDIR + "/x.sod");
-assert_checkequal(a.root.Name,'/')
+assert_checkequal(a.root.Name,"/")
h5close(a);
x = 1:10;
save(TMPDIR + "/x.sod", "x");
b = h5open(TMPDIR + "/x.sod");
-assert_checkequal(b.root.Datasets,'x');
+assert_checkequal(b.root.Datasets,"x");
h5close(b);
a = h5open(TMPDIR + "/y.tst");
-assert_checkequal(a.root.Name,'/');
+assert_checkequal(a.root.Name,"/");
h5write(a,"Dset_1",[1 2;3 4]);
h5close(a);
-msgerr = msprintf(gettext("%s: %s\n"), "h5open", msprintf(gettext("Cannot append the file (not HDF5): %s."), pathconvert(SCI, %f) + filesep() + "COPYING-FR"));
-msgerr($+1) = gettext("HDF5 description") + ": " + "unable to find a valid file signature.";
-assert_checkerror("h5open(SCI + ""/COPYING-FR"")",msgerr,999);
+try
+ h5open(SCI + "/COPYING-FR");
+ error("h5open should produce an error");
+catch
+end
copyfile(SCI+"/COPYING-FR",TMPDIR+"/z.h5");
-msgerr = msprintf(gettext("%s: %s\n"), "h5open", msprintf(gettext("Cannot append the file (not HDF5): %s."), TMPDIR + filesep() + "z.h5"));
-msgerr($+1) = gettext("HDF5 description") + ": " + "unable to find a valid file signature.";
-assert_checkerror("h5open(TMPDIR + ""/z.h5"")",msgerr,999);
+try
+ h5open(TMPDIR+"/z.h5");
+ error("h5open should produce an error");
+catch
+end
+
piDimsArray[i] = (int)in[i]->getAs<types::Double>()->get(0);
}
pRetVal = new types::Cell(in.size(), piDimsArray);
- delete piDimsArray;
+ delete[] piDimsArray;
}
if (pRetVal == NULL)
if (sciErr.iErr)
{
+ FREE(piNbItemRow);
+ FREE(piColPos);
+ FREE(pdblSpReal);
+ if (pdblSpImg)
+ {
+ FREE(pdblSpImg);
+ }
printError(&sciErr, 0);
return 1;
}
if (nA <= 0 || mA <= 0)
{
+ FREE(piNbItemRow);
+ FREE(piColPos);
+ FREE(pdblSpReal);
+ if (pdblSpImg)
+ {
+ FREE(pdblSpImg);
+ }
Scierror(999, _("%s: Wrong size for input argument #%d.\n"), fname, 1);
return 1;
}
SciSparseToCcsSparse(&AA, &A);
+ FREE(piNbItemRow);
+ FREE(piColPos);
+ FREE(pdblSpReal);
+ if (pdblSpImg)
+ {
+ FREE(pdblSpImg);
+ }
+
/* symbolic factorization */
if (A.it == 1)
{
fun:_dl_allocate_tls
...
}
+{
+ hdf5/H5_build_extpath
+ Memcheck:Addr4
+ fun:H5_build_extpath
+ fun:H5F_open
+ ...
+}