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

Removed redundant cast.

parent 2ae99257
......@@ -578,7 +578,7 @@ void cdiAttUnpack(int cdiID, int varID, void *buf, int size, int *position, void
xabort("Unknown datatype encountered in attribute %s: %d\n",
attName, tempbuf[2]);
}
void *attData = (void *) Malloc(elemSize * (size_t)tempbuf[3]);
void *attData = Malloc(elemSize * (size_t)tempbuf[3]);
serializeUnpack(buf, size, position, attData, tempbuf[3], attVDt, context);
cdi_def_att(tempbuf[2], tempbuf[1], cdiID, varID, attName,
(size_t)tempbuf[3], (size_t)tempbuf[3] * elemSize, attData);
......
......@@ -249,7 +249,7 @@ void cdiDefVarKeyBytes(cdi_keys_t *keysp, int key, const unsigned char *bytes, i
}
if ( keyp->length == 0 )
{
keyp->v.s = (unsigned char *) malloc(length);
keyp->v.s = (unsigned char *) malloc((size_t) length);
keyp->length = length;
}
......
......@@ -43,7 +43,7 @@ int grbDecode(int filetype, int memtype, void *cgribexp, void *gribbuffer, size_
float *dataf = (float*) data;
double *datad = (double*) datap;
for ( size_t i = 0; i < datasize; ++i ) dataf[i] = (float) datad[i];
Free((void*)datap);
Free(datap);
}
}
#else
......
......@@ -2952,8 +2952,8 @@ void gridCompress(int gridID)
size_t nv = (size_t)gridptr->nvertex;
double *restrict area
= (double *)gridptr->vtable->inqAreaPtr(gridptr),
*restrict xvals = (double *)gridptr->vtable->inqXValsPtr((grid_t *)gridptr),
*restrict yvals = (double *)gridptr->vtable->inqYValsPtr((grid_t *)gridptr),
*restrict xvals = (double *)gridptr->vtable->inqXValsPtr(gridptr),
*restrict yvals = (double *)gridptr->vtable->inqYValsPtr(gridptr),
*restrict xbounds = (double *)gridptr->vtable->inqXBoundsPtr(gridptr),
*restrict ybounds = (double *)gridptr->vtable->inqYBoundsPtr(gridptr);
mask_t *restrict mask_gme = gridptr->mask_gme;
......
......@@ -322,7 +322,7 @@ int tableRead(const char *tablefile)
FILE *tablefp = fopen(tablefile, "r");
if ( tablefp == NULL ) return tableID;
char *tablename = (char* )strrchr(tablefile, '/');
char *tablename = strrchr(tablefile, '/');
if ( tablename == 0 ) tablename = (char *) tablefile;
else tablename++;
......
......@@ -28,43 +28,22 @@ void decode_julday(int calendar,
}
/* convert year, month, day into Julian calendar day */
// convert year, month, day into Julian calendar day
int64_t encode_julday(int calendar, int year, int month, int day)
{
int iy;
int im;
int ib;
if ( month <= 2 )
{
iy = year - 1;
im = month + 12;
}
else
{
iy = year;
im = month;
}
if ( iy < 0 )
ib = (int)((iy+1)/400) - (int)((iy+1)/100);
else
ib = (int)(iy/400) - (int)(iy/100);
int iy = (month <= 2) ? year - 1 : year;
int im = (month <= 2) ? month + 12 : month;
int ib = (iy < 0) ? ((iy+1)/400 - (iy+1)/100) : (iy/400 - iy/100);
if ( calendar == CALENDAR_STANDARD || calendar == CALENDAR_GREGORIAN )
{
if ( year > 1582 || (year == 1582 && (month > 10 || (month == 10 && day >= 15))) )
{
/*
** 15th October 1582 AD or later
*/
// 15th October 1582 AD or later
}
else
{
/*
** 4th October 1582 AD or earlier
*/
// 4th October 1582 AD or earlier
ib = -2;
}
}
......
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