Commit e41775eb authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Cast result of Malloc().

parent b6344991
......@@ -34,9 +34,7 @@ int grbDecode(int filetype, int memtype, void *gribbuffer, size_t gribsize, void
#endif
#ifdef HAVE_LIBGRIB_API
{
void *datap = data;
if ( memtype == MEMTYPE_FLOAT )
datap = Malloc(datasize*sizeof(double));
void *datap = (memtype == MEMTYPE_FLOAT) ? Malloc(datasize*sizeof(double)) : data;
status = gribapiDecode(gribbuffer, gribsize, datap, datasize, unreduced, nmiss, missval, vlistID, varID);
......
......@@ -1713,7 +1713,7 @@ void cdfDefCharacter(stream_t *streamptr, int gridID, int gridindex, int xory, i
char axisname[CDI_MAX_NAME]; axisname[0] = 0;
char **cvals = (char **) Malloc(dimlen * sizeof(char *));
for ( size_t i = 0; i < dimlen; i++ )
cvals[i] = Malloc(strlen * sizeof(char) );
cvals[i] = (char*) Malloc(strlen * sizeof(char));
int ncaxisid;
if ( xory == 0 )
{
......
......@@ -646,7 +646,7 @@ void vlistCopyFlag(int vlistID2, int vlistID1)
for ( int levID = 0; levID < nlevs; ++levID )
if ( vars1[varID].levinfo[levID].flag )
{
cvals2[levID2] = Malloc((size_t)(clen2) * sizeof (char));
cvals2[levID2] = (char*) Malloc((size_t)(clen2) * sizeof(char));
memcpy(cvals2[levID2], cvals1[levID], clen2*sizeof(char));
levID2++;
}
......
......@@ -790,8 +790,8 @@ void zaxisDefCvals(int zaxisID, const char **cvals, int clen)
for ( int ilev = 0; ilev < size; ++ilev )
{
zaxisptr->cvals[ilev] = Malloc((size_t)clen*sizeof(char));
memcpy(zaxisptr->cvals[ilev],cvals[ilev], (size_t)clen*sizeof(char));
zaxisptr->cvals[ilev] = (char*) Malloc((size_t)clen*sizeof(char));
memcpy(zaxisptr->cvals[ilev], cvals[ilev], (size_t)clen*sizeof(char));
}
reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE);
}
......@@ -1046,19 +1046,18 @@ int zaxisInqCLen(int zaxisID)
int zaxisInqCVals(int zaxisID, char ***clevels)
{
int size = 0;
size_t clen = 0;
zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID);
if ( zaxisptr->cvals )
{
size = zaxisptr->size;
clen = zaxisptr->clength;
size_t clen = zaxisptr->clength;
if ( size && clen )
{
(*clevels) = Malloc(size*sizeof(char*));
(*clevels) = (char**) Malloc(size*sizeof(char*));
for ( int i = 0; i < size; i++ )
{
(*clevels)[i] = Malloc(clen*sizeof(char));
(*clevels)[i] = (char*) Malloc(clen*sizeof(char));
memcpy((*clevels)[i], zaxisptr->cvals[i], clen*sizeof(char));
}
}
......
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