Commit 3f4d6a51 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cast malloc return value

parent 1183ed62
......@@ -11,7 +11,7 @@ uint32_t cdiCheckSum(int type, int count, void *buffer)
uint32_t s = 0U;
xassert(count >= 0);
size_t elemSize = (size_t)serializeGetSizeInCore(1, type, NULL);
memcrc_r_eswap(&s, buffer, count, elemSize);
memcrc_r_eswap(&s, (const unsigned char*) buffer, count, elemSize);
s = memcrc_finish(&s, elemSize * (size_t)count);
return s;
}
......@@ -955,7 +955,7 @@ int file_fill_buffer(bfile_t *fileptr)
fileptr->mappedSize = (size_t) nread;
fileptr->buffer = mmap(NULL, (size_t) nread, PROT_READ, MAP_PRIVATE, fd, fileptr->bufferPos);
fileptr->buffer = (char*) mmap(NULL, (size_t) nread, PROT_READ, MAP_PRIVATE, fd, fileptr->bufferPos);
if ( fileptr->buffer == MAP_FAILED ) SysError("mmap error for read %s", fileptr->name);
......
......@@ -4581,7 +4581,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
if (memberMask & gridHasRowLonFlag)
{
xassert(gridP->nrowlon);
gridP->rowlon = xmalloc(gridP->nrowlon * sizeof (int));
gridP->rowlon = (int*) xmalloc(gridP->nrowlon * sizeof (int));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->rowlon, gridP->nrowlon , DATATYPE_INT, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
......@@ -4630,7 +4630,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
else
size = gridP->xsize;
gridP->xvals = xmalloc(size * sizeof (double));
gridP->xvals = (double*) xmalloc(size * sizeof (double));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->xvals, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
......@@ -4645,7 +4645,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
else
size = gridP->ysize;
gridP->yvals = xmalloc( size * sizeof (double));
gridP->yvals = (double*) xmalloc( size * sizeof (double));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->yvals, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
......@@ -4656,7 +4656,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
if (memberMask & gridHasAreaFlag)
{
xassert((size = gridP->size));
gridP->area = xmalloc(size * sizeof (double));
gridP->area = (double*) xmalloc(size * sizeof (double));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->area, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
......@@ -4672,7 +4672,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
size = gridP->nvertex * gridP->xsize;
xassert(size);
gridP->xbounds = xmalloc(size * sizeof (double));
gridP->xbounds = (double*) xmalloc(size * sizeof (double));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->xbounds, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
......@@ -4688,7 +4688,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
size = gridP->nvertex * gridP->ysize;
xassert(size);
gridP->ybounds = xmalloc(size * sizeof (double));
gridP->ybounds = (double*) xmalloc(size * sizeof (double));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->ybounds, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
......@@ -4717,7 +4717,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
int referenceSize;
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&referenceSize, 1, DATATYPE_INT, context);
gridP->reference = xmalloc(referenceSize);
gridP->reference = (char*) xmalloc(referenceSize);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->reference, referenceSize, DATATYPE_TXT, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
......@@ -4728,7 +4728,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
if (memberMask & gridHasMaskFlag)
{
xassert((size = gridP->size));
gridP->mask = xmalloc(size * sizeof (mask_t));
gridP->mask = (mask_t*) xmalloc(size * sizeof (mask_t));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->mask, gridP->size, DATATYPE_UCHAR, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
......@@ -4739,7 +4739,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
if (memberMask & gridHasGMEMaskFlag)
{
xassert((size = gridP->size));
gridP->mask_gme = xmalloc(size * sizeof (mask_t));
gridP->mask_gme = (mask_t*) xmalloc(size * sizeof (mask_t));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->mask_gme, gridP->size, DATATYPE_UCHAR, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
......
......@@ -111,7 +111,7 @@ void instituteInit (void)
if ( !instituteInitialized )
{
instituteInitialized = 1;
instituteInitializedNsp = xcalloc ( 1, nspc * sizeof ( int ));
instituteInitializedNsp = (int*) xcalloc ( 1, nspc * sizeof ( int ));
atexit ( instituteFinalize );
}
......@@ -191,7 +191,7 @@ static enum cdiApplyRet
findInstitute(int id, void *res, void *data)
{
institute_t * ip1 = ((struct instLoc *)data)->ip;
institute_t * ip2 = res;
institute_t * ip2 = (institute_t*) res;
if (ip2->used && !instituteCompareKernel(ip1, ip2))
{
((struct instLoc *)data)->id = id;
......@@ -206,7 +206,7 @@ int institutInq(int center, int subcenter, const char *name, const char *longnam
{
instituteInit ();
institute_t * ip_ref = xmalloc(sizeof (*ip_ref));
institute_t * ip_ref = (institute_t*) xmalloc(sizeof (*ip_ref));
ip_ref->self = UNDEFID;
ip_ref->used = 0;
ip_ref->center = center;
......@@ -355,7 +355,7 @@ enum {
static int instituteGetSizeP ( void * instituteptr, void *context)
{
institute_t *p = instituteptr;
institute_t *p = (institute_t*) instituteptr;
int txsize = serializeGetSize(institute_nints, DATATYPE_INT, context)
+ serializeGetSize(strlen(p->name) + 1, DATATYPE_TXT, context)
+ serializeGetSize(strlen(p->longname) + 1, DATATYPE_TXT, context);
......@@ -364,7 +364,7 @@ static int instituteGetSizeP ( void * instituteptr, void *context)
static void institutePackP(void * instituteptr, void *buf, int size, int *position, void *context)
{
institute_t *p = instituteptr;
institute_t *p = (institute_t*) instituteptr;
int tempbuf[institute_nints];
tempbuf[0] = p->self;
tempbuf[1] = p->center;
......@@ -382,8 +382,8 @@ int instituteUnpack(void *buf, int size, int *position, int nspTarget, void *con
int instituteID;
char *name, *longname;
serializeUnpack(buf, size, position, tempbuf, institute_nints, DATATYPE_INT, context);
name = xmalloc(tempbuf[3]);
longname = xmalloc(tempbuf[4]);
name = (char*) xmalloc(tempbuf[3]);
longname = (char*) xmalloc(tempbuf[4]);
serializeUnpack(buf, size, position, name, tempbuf[3], DATATYPE_TXT, context);
serializeUnpack(buf, size, position, longname, tempbuf[4], DATATYPE_TXT, context);
instituteID = institutDef(tempbuf[1], tempbuf[2], name, longname);
......
......@@ -257,7 +257,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
maxMatch = maxFunMatch;
}
++maxMatch;
reMatch = malloc((size_t)maxMatch * sizeof (reMatch[0]));
reMatch = (regmatch_t*) malloc((size_t)maxMatch * sizeof (reMatch[0]));
/* compile comment regular expression */
regex_t commentRE;
{
......@@ -309,7 +309,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
fprintf(fpint, "#endif\n");
fprintf(fpint, "\n");
{
char *cppMacro = malloc(strlen(fname) + 2);
char *cppMacro = (char*) malloc(strlen(fname) + 2);
build_header_name(fname, cppMacro);
fprintf(fpint, "#if ! defined (%s)\n"
"# include \"%s\"\n"
......@@ -407,7 +407,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
if ((extLen = getline(&lineExtension, &extSize, fpin)) <= 0)
break;
if ((size_t)(lineLen + extLen) >= lineBufSize)
if (!(line = realloc(line, (size_t)(lineLen + extLen + 1))))
if (!(line = (char*) realloc(line, (size_t)(lineLen + extLen + 1))))
exit(EXIT_FAILURE);
memcpy(line + lineLen, lineExtension, (size_t)extLen + 1);
lineLen += extLen;
......@@ -781,7 +781,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
}
/* path to document root, separating /, max of path within root,
* terminating '\0' */
filename = malloc(doc_root_len + 1 + max_len + 1);
filename = (char*) malloc(doc_root_len + 1 + max_len + 1);
}
memcpy(filename, doc_root, doc_root_len);
......@@ -991,7 +991,7 @@ reCompile(regex_t *restrict RE, const char *restrict REstring,
char *restrict line;
size_t resize;
if (*lineBufSize < REGEX_MAX_ERRSTRLEN
&& (line = realloc(*lineBuf, resize = REGEX_MAX_ERRSTRLEN)))
&& (line = (char*) realloc(*lineBuf, resize = REGEX_MAX_ERRSTRLEN)))
{
*lineBuf = line;
*lineBufSize = resize;
......
......@@ -125,7 +125,7 @@ void modelInit(void)
if ( !modelInitialized )
{
modelInitialized = 1;
modelInitializedNsp = xcalloc ( 1, nspc * sizeof ( int ));
modelInitializedNsp = (int*) xcalloc ( 1, nspc * sizeof ( int ));
atexit ( modelFinalize );
env = getenv("MODEL_DEBUG");
if ( env ) MODEL_Debug = atoi(env);
......@@ -154,8 +154,8 @@ struct modelLoc
static enum cdiApplyRet
findModelByID(int resID, void *res, void *data)
{
model_t *modelptr = res;
struct modelLoc *ret = data;
model_t *modelptr = (model_t*) res;
struct modelLoc *ret = (struct modelLoc*) data;
int instID = ret->instID, modelgribID = ret->modelgribID;
if (modelptr->used
&& modelptr->instID == instID
......@@ -171,8 +171,8 @@ findModelByID(int resID, void *res, void *data)
static enum cdiApplyRet
findModelByName(int resID, void *res, void *data)
{
model_t *modelptr = res;
struct modelLoc *ret = data;
model_t *modelptr = (model_t*) res;
struct modelLoc *ret = (struct modelLoc*) data;
int instID = ret->instID, modelgribID = ret->modelgribID;
const char *name = ret->name;
if (modelptr->used
......@@ -303,7 +303,7 @@ enum {
static int modelGetSizeP(void * modelptr, void *context)
{
model_t *p = modelptr;
model_t *p = (model_t*) modelptr;
int txsize = serializeGetSize(model_nints, DATATYPE_INT, context)
+ serializeGetSize(p->name?strlen(p->name) + 1:0, DATATYPE_TXT, context);
return txsize;
......@@ -312,7 +312,7 @@ static int modelGetSizeP(void * modelptr, void *context)
static void modelPackP(void * modelptr, void * buf, int size, int *position, void *context)
{
model_t *p = modelptr;
model_t *p = (model_t*) modelptr;
int tempbuf[model_nints];
tempbuf[0] = p->self;
tempbuf[1] = p->instID;
......@@ -328,17 +328,14 @@ modelUnpack(void *buf, int size, int *position, int nspTarget, void *context)
{
int tempbuf[model_nints];
int modelID;
char *name;
char *name = NULL;
serializeUnpack(buf, size, position, tempbuf, model_nints, DATATYPE_INT, context);
if (tempbuf[3] != 0)
{
name = xmalloc(tempbuf[3]);
name = (char*) xmalloc(tempbuf[3]);
serializeUnpack(buf, size, position, name, tempbuf[3], DATATYPE_TXT, context);
}
else
{
name = "";
}
modelID = modelDef( namespaceAdaptKey ( tempbuf[1], nspTarget ), tempbuf[2], name);
// FIXME: this should work, once all types are transferred
//assert(modelID == tempbuf[0]);
......
......@@ -202,8 +202,7 @@ namespaceNew()
else if (namespacesSize == 1)
{
/* make room for additional namespace */
struct namespace *newNameSpaces
= xmalloc((namespacesSize + 1) * sizeof (namespaces[0]));
struct namespace *newNameSpaces = (struct namespace*) xmalloc((namespacesSize + 1) * sizeof (namespaces[0]));
memcpy(newNameSpaces, namespaces, sizeof (namespaces[0]));
namespaces = newNameSpaces;
++namespacesSize;
......@@ -213,8 +212,7 @@ namespaceNew()
{
/* make room for additional namespace */
newNamespaceID = namespacesSize;
namespaces
= xrealloc(namespaces, (namespacesSize + 1) * sizeof (namespaces[0]));
namespaces = (struct namespace*) xrealloc(namespaces, (namespacesSize + 1) * sizeof (namespaces[0]));
++namespacesSize;
}
else /* implicit: namespacesSize >= NUM_NAMESPACES */
......
......@@ -99,7 +99,7 @@ void pioInfoInit ( pioInfo_t * p )
void commInit ( void )
{
xassert ( info == 0 );
info = xmalloc ( sizeof ( pioInfo_t ));
info = (pioInfo_t*) xmalloc ( sizeof ( pioInfo_t ));
pioInfoInit ( info );
}
......@@ -384,7 +384,7 @@ void commDefCommNode ( void )
size = info->sizePio;
myHost = xmalloc(MPI_MAX_PROCESSOR_NAME);
myHost = (char*) xmalloc(MPI_MAX_PROCESSOR_NAME);
{
int len;
xmpi ( MPI_Get_processor_name ( myHost, &len ));
......@@ -512,7 +512,7 @@ void commRecvNodeMap ( void )
xdebug ( "info->nProcsColl=%d", info->nProcsColl );
info->nodeMap = xmalloc ( info->nProcsColl *
info->nodeMap = (int*) xmalloc ( info->nProcsColl *
sizeof ( info->nodeMap[0] ));
xmpi ( MPI_Recv ( info->nodeMap, info->nProcsColl, MPI_INTEGER,
......@@ -552,7 +552,7 @@ void commEvalPhysNodes ( void )
size = info->nProcsIO * sizeNodeInfo;
nodeInfo = xmalloc ( size * sizeof ( int ));
nodeInfo = (nodeInfo_t*) xmalloc ( size * sizeof ( int ));
if ( info->rankGlob == info->root )
{
......@@ -592,12 +592,12 @@ void commEvalPhysNodes ( void )
xassert ( info->nProcsColl <= info->nProcsModel );
info->procsCollMap = xmalloc ( info->nProcsColl *
info->procsCollMap = (int*) xmalloc ( info->nProcsColl *
sizeof ( info->procsCollMap[0] ));
// define nodeSizes
info->nodeInfo.nNodes = nNodes;
info->nodeSizes = xmalloc ( info->nodeInfo.nNodes *
info->nodeSizes = (int*) xmalloc ( info->nodeInfo.nNodes *
sizeof ( info->nodeSizes[0] ));
collID = 0;
for ( IOID = 0; IOID < info->nProcsIO; IOID++ )
......@@ -608,11 +608,11 @@ void commEvalPhysNodes ( void )
}
// define nodeMap
info->nodeMap = xmalloc ( info->nProcsColl *
info->nodeMap = (int*) xmalloc ( info->nProcsColl *
sizeof ( info->nodeMap[0] ));
// helpers
p1 = xmalloc ( info->nodeInfo.nNodes * sizeof ( p1[0] ));
p2 = xmalloc ( info->nodeInfo.nNodes * sizeof ( p2[0] ));
p1 = (int**) xmalloc ( info->nodeInfo.nNodes * sizeof ( p1[0] ));
p2 = (int**) xmalloc ( info->nodeInfo.nNodes * sizeof ( p2[0] ));
idx = 0;
for ( i = 0; i < info->nodeInfo.nNodes; i++ )
{
......@@ -694,7 +694,7 @@ void commDefCommsIO ( void )
info->nProcsModel != CDI_UNDEFID &&
info->commGlob != MPI_COMM_NULL );
info->commsIO = xmalloc ( info->nProcsColl *
info->commsIO = (MPI_Comm*) xmalloc ( info->nProcsColl *
sizeof ( info->commsIO[0] ));
for ( collID = 0; collID < info->nProcsColl; collID++ )
info->commsIO[collID] = MPI_COMM_NULL;
......@@ -702,7 +702,7 @@ void commDefCommsIO ( void )
strncpy ( name, "COMMSIO_", 8 );
name[MAXCOMMIONAME - 1] = '\0';
ranks = xmalloc (( info->nProcsModel + 1 ) * sizeof ( ranks[0] ));
ranks = (int*) xmalloc (( info->nProcsModel + 1 ) * sizeof ( ranks[0] ));
for ( i = 0; i < info->nProcsModel; i++ )
ranks[i] = i;
......
......@@ -184,7 +184,7 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping,
weightsStreams[i] += * ( vSizes + offset++ );
}
w = ( double * ) xmalloc ( nNodes * sizeof ( double ));
w = ( double * ) xmalloc( nNodes * sizeof ( double ));
for ( j = 0; j < nNodes; j++ )
nPEs += * ( nodeSizes + j );
......@@ -201,9 +201,9 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping,
if ( * ( streamMapping + j ) == i )
nVarsNode += * ( sSizes + j );
weightsVarsNode = ( int * ) xmalloc ( nVarsNode * sizeof ( int ));
varMappingNode = ( int * ) xmalloc ( nVarsNode * sizeof ( int ));
w = ( double * ) xmalloc ( * ( nodeSizes + i ) * sizeof ( double ));
weightsVarsNode = ( int * ) xmalloc( nVarsNode * sizeof ( int ));
varMappingNode = ( int * ) xmalloc( nVarsNode * sizeof ( int ));
w = ( double * ) xmalloc( * ( nodeSizes + i ) * sizeof ( double ));
offset = 0;
offsetN = 0;
......@@ -264,17 +264,17 @@ varsMapNDeco(int nNodes, int *nodeSizes)
nStreams = streamSize ();
resHs = xmalloc ( nStreams * sizeof ( resHs[0] ));
streamSizes = xmalloc ( nStreams * sizeof ( streamSizes[0] ));
collectsData = xmalloc ( nProcsColl * sizeof ( collectsData[0] ));
resHs = (int*) xmalloc( nStreams * sizeof ( resHs[0] ));
streamSizes = (int*) xmalloc( nStreams * sizeof ( streamSizes[0] ));
collectsData = (int*) xmalloc( nProcsColl * sizeof ( collectsData[0] ));
streamGetIndexList ( nStreams, resHs );
for ( i = 0; i < nStreams; i++ )
streamSizes[i] = streamInqNvars ( * ( resHs + i ));
nVars = sum_int(nStreams, streamSizes);
varSizes = xmalloc ( nVars * sizeof ( varSizes[0] ));
varMapping = xmalloc ( nVars * sizeof ( varMapping[0] ));
varSizes = (int*) xmalloc( nVars * sizeof ( varSizes[0] ));
varMapping = (int*) xmalloc( nVars * sizeof ( varMapping[0] ));
for ( i = 0; i < nStreams; i++ )
for ( j = 0; j < * ( streamSizes + i ); j++ )
......@@ -357,8 +357,8 @@ modelWinDefBufferSizes(void)
xassert(txWin != NULL);
nstreams = reshCountType ( &streamOps );
streamIndexList = xmalloc ( nstreams * sizeof ( streamIndexList[0] ));
collIndex = xcalloc(nProcsColl, sizeof (collIndex[0]));
streamIndexList = (int*) xmalloc( nstreams * sizeof ( streamIndexList[0] ));
collIndex = (struct collDesc*) xcalloc(nProcsColl, sizeof (collIndex[0]));
reshGetResHListOfType ( nstreams, streamIndexList, &streamOps );
for ( streamNo = 0; streamNo < nstreams; streamNo++ )
{
......@@ -458,7 +458,7 @@ void modelWinCreate ( void )
int nProcsColl = commInqNProcsColl ();
xdebug("%s", "START");
txWin = xmalloc(nProcsColl * sizeof (txWin[0]));
txWin = (struct rdmaWin*) xmalloc(nProcsColl * sizeof (txWin[0]));
modelWinDefBufferSizes ();
ranks[0] = commInqNProcsModel ();
......
......@@ -32,7 +32,7 @@ listSet *listSetNew( valDestroyFunction vD, eqPredicate kC )
{
listSet *myq;
myq = xmalloc ( sizeof ( listSet ));
myq = (listSet*) xmalloc( sizeof ( listSet ));
myq->head = NULL;
myq->tail = NULL;
......@@ -79,7 +79,7 @@ listSetAdd(listSet *q, void *v)
return -1;
}
if ((newCons = malloc(sizeof(struct cons))) == NULL)
if ((newCons = (struct cons*) malloc(sizeof(struct cons))) == NULL)
{
perror ( "pio_listSet: listSetAdd (): Not enough memory" );
/* FIXME: why not abort? */
......
......@@ -54,7 +54,7 @@ static aFiledataM *initAFiledataMPINONB ( const char *filename, size_t bs )
int iret;
MPI_Comm commNode = commInqCommNode ();
of = xmalloc(sizeof (*of) + strlen(filename) + 1);
of = (aFiledataM*) xmalloc(sizeof (*of) + strlen(filename) + 1);
strcpy(of->name, filename);
of->size = bs;
......
......@@ -68,7 +68,7 @@ initBFiledataPA(char *filename, size_t bs, int nc)
xdebug ( "filename=%s, buffersize=%zu, ncollectors=%d, nPrefetchStreams=%d",
filename, bs, nc, nPrefStreams );
bfd = xmalloc( sizeof (*bfd) + strlen(filename) + 1);
bfd = (bFiledataPA*) xmalloc( sizeof (*bfd) + strlen(filename) + 1);
strcpy(bfd->name, filename);
if (( bfd->handle = open ( bfd->name, O_CREAT | O_WRONLY, 0666 )) == -1 )
......@@ -76,7 +76,7 @@ initBFiledataPA(char *filename, size_t bs, int nc)
dbuffer_init(&(bfd->fb), (size_t)(nPrefStreams * bs));
bfd->ctrlBlks = xcalloc(nPrefStreams, sizeof (bfd->ctrlBlks[0]));
bfd->ctrlBlks = (struct aiocb *) xcalloc(nPrefStreams, sizeof (bfd->ctrlBlks[0]));
for ( i = 0; i < nPrefStreams; i++ )
{
......@@ -260,7 +260,7 @@ void pioWriterAIO(void)
xdebug ( "nProcsCollNode=%d on this node", nProcsCollNode );
bibBFiledataPA = listSetNew(destroyBFiledataPA, compareNamesBPA);
sentFinalize = xmalloc ( nProcsCollNode * sizeof ( sentFinalize ));
sentFinalize = (bool*) xmalloc ( nProcsCollNode * sizeof ( sentFinalize ));
for ( ;; )
{
......
......@@ -91,7 +91,7 @@ collDefBufferSizes()
xassert(rxWin != NULL);
nstreams = reshCountType ( &streamOps );
streamIndexList = xmalloc ( nstreams * sizeof ( streamIndexList[0] ));
streamIndexList = (int*) xmalloc( nstreams * sizeof ( streamIndexList[0] ));
reshGetResHListOfType ( nstreams, streamIndexList, &streamOps );
for ( streamNo = 0; streamNo < nstreams; streamNo++ )
{
......@@ -173,7 +173,7 @@ serverWinCreate(void)
rxWin = xcalloc(nProcsModel, sizeof (rxWin[0]));
size_t totalBufferSize = collDefBufferSizes();
rxWin[0].buffer = xmalloc(totalBufferSize);
rxWin[0].buffer = (unsigned char*) xmalloc(totalBufferSize);
size_t ofs = 0;
for ( modelID = 1; modelID < nProcsModel; modelID++ )
{
......@@ -266,7 +266,7 @@ resizeVarGatherBuf(int vlistID, int varID, double **buf, int *bufSize)
{
int size = vlistInqVarSize(vlistID, varID);
if (size <= *bufSize) ; else
*buf = xrealloc(*buf, (*bufSize = size) * sizeof (buf[0][0]));
*buf = (double*) xrealloc(*buf, (*bufSize = size) * sizeof (buf[0][0]));
}
static void
......@@ -285,9 +285,8 @@ gatherArray(int root, int nProcsModel, int headerIdx,
for (unsigned i = 0; i < 3; ++i)
varShapeXt[i] = varShape[i];
int varSize = varShape[0] * varShape[1] * varShape[2];
struct Xt_offset_ext *partExts
= xmalloc(nProcsModel * sizeof (partExts[0]));
Xt_idxlist *part = xmalloc(nProcsModel * sizeof (part[0]));
struct Xt_offset_ext *partExts = (struct Xt_offset_ext*) xmalloc(nProcsModel * sizeof (partExts[0]));
Xt_idxlist *part = (Xt_idxlist*) xmalloc(nProcsModel * sizeof (part[0]));
MPI_Comm commCalc = commInqCommCalc();
{
int nmiss_ = 0;
......@@ -497,7 +496,7 @@ inventorizeStream(struct streamMapping *streamMap, int numStreamIDs,
int sizeStreamMap = *sizeStreamMap_;
if (numStreamIDs < sizeStreamMap) ; else
{
streamMap = xrealloc(streamMap,
streamMap = (struct streamMapping*) xrealloc(streamMap,
(sizeStreamMap *= 2)
* sizeof (streamMap[0]));
*sizeStreamMap_ = sizeStreamMap;
......@@ -514,9 +513,7 @@ inventorizeStream(struct streamMapping *streamMap, int numStreamIDs,
int vlistID = streamInqVlist(streamID);
int nvars = vlistNvars(vlistID);
streamMap[numStreamIDs].numVars = nvars;
streamMap[numStreamIDs].varMap
= xmalloc(sizeof (streamMap[numStreamIDs].varMap[0])
* nvars);
streamMap[numStreamIDs].varMap = (int*) xmalloc(sizeof (streamMap[numStreamIDs].varMap[0]) * nvars);
for (int i = 0; i < nvars; ++i)
streamMap[numStreamIDs].varMap[i] = -1;
}
......@@ -540,8 +537,7 @@ buildStreamMap(struct winHeaderEntry *winDict)
int oldStreamIdx = CDI_UNDEFID;
int filetype = CDI_UNDEFID;
int sizeStreamMap = 16;
struct streamMapping *streamMap
= xmalloc(sizeStreamMap * sizeof (streamMap[0]));
struct streamMapping *streamMap = (struct streamMapping *) xmalloc(sizeStreamMap * sizeof (streamMap[0]));
int numDataEntries = winDict[0].specific.headerSize.numDataEntries;
int numStreamIDs = 0;
/* find streams written on this process */
......@@ -578,7 +574,7 @@ buildStreamMap(struct winHeaderEntry *winDict)
{
int *streamIDs, *streamIsWritten;
int numTotalStreamIDs = streamSize();
streamIDs = xmalloc(2 * sizeof (streamIDs[0]) * (size_t)numTotalStreamIDs);
streamIDs = (int*) xmalloc(2 * sizeof (streamIDs[0]) * (size_t)numTotalStreamIDs);
streamGetIndexList(numTotalStreamIDs, streamIDs);
streamIsWritten = streamIDs + numTotalStreamIDs;
for (int i = 0; i < numTotalStreamIDs; ++i)
......@@ -597,7 +593,7 @@ buildStreamMap(struct winHeaderEntry *winDict)
free(streamIDs);
}
/* sort written streams by streamID */
streamMap = xrealloc(streamMap, sizeof (streamMap[0]) * numStreamIDs);
streamMap = (struct streamMapping*) xrealloc(streamMap, sizeof (streamMap[0]) * numStreamIDs);
qsort(streamMap, numStreamIDs, sizeof (streamMap[0]), smCmpStreamID);
return (struct streamMap){ .entries = streamMap, .numEntries = numStreamIDs };
}
......@@ -647,8 +643,7 @@ buildWrittenVars(struct streamMapping *mapping, int **varIsWritten_,
{
int nvars = mapping->numVars;
int *varMap = mapping->varMap;
int *varIsWritten = *varIsWritten_
= xrealloc(*varIsWritten_, sizeof (*varIsWritten) * nvars);
int *varIsWritten = *varIsWritten_ = (int*) xrealloc(*varIsWritten_, sizeof (*varIsWritten) * nvars);
for (int varID = 0; varID < nvars; ++varID)
varIsWritten[varID] = ((varMap[varID] != -1)
?myCollRank+1 : 0);
......@@ -795,7 +790,7 @@ static void readGetBuffers()
xt_idxlist_delete(preRedistChunk);
xt_idxlist_delete(preWriteChunk);
xt_xmap_delete(xmap);
writeBuf = xrealloc(writeBuf,
writeBuf = (double*) xrealloc(writeBuf,
sizeof (double)
* PPM_extents_size(3, varChunk));
xt_redist_s_exchange1(redist, data, writeBuf);
......@@ -1064,7 +1059,7 @@ void IOServer(void (*postCommSetupActions)(void))
numPioPrimes = PPM_prime_factorization_32((uint32_t)commInqSizeColl(),
&pioPrimes);
#elif defined (HAVE_LIBNETCDF)
cdiSerialOpenFileCount = xcalloc(sizeof (cdiSerialOpenFileCount[0]),
cdiSerialOpenFileCount = (int*) xcalloc(sizeof (cdiSerialOpenFileCount[0]),
commInqSizeColl());
namespaceSwitchSet(NSSWITCH_STREAM_OPEN_BACKEND,
NSSW_FUNC(cdiPioStreamCDFOpenWrap));
......@@ -1107,7 +1102,7 @@ void IOServer(void (*postCommSetupActions)(void))
int streamNo;
int * resHs;