replace use of old-style casts

parent 53ae5493
......@@ -48,16 +48,16 @@ mexFunction(int nlhs, mxArray *plhs[],
/*
* Allocate memory
*/
maxnargs = (int) (mxGetN(prhs[0])/2+1);
argument = (char *) mxCalloc(mxGetN(prhs[0])+1, sizeof(char));
args = (char **) mxCalloc(maxnargs, sizeof(char *));
maxnargs = static_cast<int> (mxGetN(prhs[0])/2+1);
argument = static_cast<char *> (mxCalloc(mxGetN(prhs[0])+1, sizeof(char)));
args = static_cast<char **> (mxCalloc(maxnargs, sizeof(char *)));
if (argument == NULL || args == NULL)
DYN_MEX_FUNC_ERR_MSG_TXT("Error in MS-SBVAR MEX file: could not allocate memory. (1)");
/*
* Create argument string from prhs and parse to create args / nargs
*/
if (!(args[nargs] = (char *) mxCalloc(strlen(mainarg)+1, sizeof(char))))
if (!(args[nargs] = static_cast<char *> (mxCalloc(strlen(mainarg)+1, sizeof(char)))))
DYN_MEX_FUNC_ERR_MSG_TXT("Error in MS-SBVAR MEX file: could not allocate memory. (2)");
strncpy(args[nargs++], mainarg, strlen(mainarg));
......@@ -68,7 +68,7 @@ mexFunction(int nlhs, mxArray *plhs[],
beginarg = &argument[0];
while ((n = strcspn(beginarg, " ")))
{
if (!(args[nargs] = (char *) mxCalloc(n+1, sizeof(char))))
if (!(args[nargs] = static_cast<char *> (mxCalloc(n+1, sizeof(char)))))
DYN_MEX_FUNC_ERR_MSG_TXT("Error in MS-SBVAR MEX file: could not allocate memory. (3)");
strncpy(args[nargs++], beginarg, n);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment