Commit d203eb92 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Fix implicit conversions in {m|re}alloc calls.

* Also use library-internal wrapper.
parent 6490a28f
......@@ -153,7 +153,7 @@ reshListCreate(int namespaceID)
LIST_LOCK();
if (resHListSize <= namespaceID)
{
resHList = (struct resHList_t *)xrealloc(resHList, (namespaceID + 1) * sizeof (resHList[0]));
resHList = (struct resHList_t *)xrealloc(resHList, (size_t)(namespaceID + 1) * sizeof (resHList[0]));
for (int i = resHListSize; i <= namespaceID; ++i)
reshListClearEntry(i);
resHListSize = namespaceID + 1;
......
......@@ -256,9 +256,7 @@ static
int scanTimeUnit(const char *unitstr)
{
int timeunit = -1;
int len;
len = (int) strlen(unitstr);
size_t len = strlen(unitstr);
timeunit = get_timeunit(len, unitstr);
if ( timeunit == -1 )
Message("Unsupported TIMEUNIT: %s!", unitstr);
......
......@@ -854,7 +854,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
cdi_create_records(streamptr, tsID);
nrecords = streamptr->tsteps[tsID].nallrecs;
if ( nrecords ) streamptr->tsteps[1].recIDs = (int *) malloc(nrecords*sizeof(int));
if ( nrecords ) streamptr->tsteps[1].recIDs = (int *)xmalloc((size_t)nrecords * sizeof(int));
streamptr->tsteps[1].nrecs = 0;
for ( recID = 0; recID < nrecords; recID++ )
streamptr->tsteps[1].recIDs[recID] = -1;
......
......@@ -785,7 +785,7 @@ int varDefGrid(int vlistID, grid_t grid, int mode)
ngrids = gridSize();
if ( ngrids > 0 )
{
gridIndexList = (int*) malloc(ngrids*sizeof(int));
gridIndexList = (int*)xmalloc((size_t)ngrids * sizeof(int));
gridGetIndexList ( ngrids, gridIndexList );
for ( i = 0; i < ngrids; i++ )
{
......@@ -907,7 +907,7 @@ int varDefZaxis(int vlistID, int zaxistype, int nlevels, double *levels, int lbo
if ( nzaxis > 0 )
{
int *zaxisIndexList;
zaxisIndexList = (int *) malloc ( nzaxis * sizeof ( int ));
zaxisIndexList = (int *)xmalloc((size_t)nzaxis * sizeof (int));
zaxisGetIndexList ( nzaxis, zaxisIndexList );
for ( i = 0; i < nzaxis; i++ )
{
......
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