Commit 99c1347f authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

added explicit casts, changed restrict keyword in gaussgrid.c guaw() and gaussaw() to __restrict__

parent 97bc304f
......@@ -108,7 +108,7 @@ void gawl(double *pfn, double *pl, double *pw, size_t kn)
}
static
void gauaw(size_t kn, double *restrict pl, double *restrict pw)
void gauaw(size_t kn, double *__restrict__ pl, double *__restrict__ pw)
{
/*
* 1.0 Initialize Fourier coefficients for ordinary Legendre polynomials
......@@ -288,7 +288,7 @@ void gauaw_old(double *pa, double *pw, int nlat)
}
#endif
void gaussaw(double *restrict pa, double *restrict pw, size_t nlat)
void gaussaw(double *__restrict__ pa, double *__restrict__ pw, size_t nlat)
{
//gauaw_old(pa, pw, nlat);
gauaw(nlat, pa, pw);
......
......@@ -176,7 +176,7 @@ int isTimeAxisUnits(const char *timeunits)
int status = FALSE;
size_t len = strlen(timeunits);
tu = xmalloc((len+1)*sizeof(char));
tu = (char *)xmalloc((len+1)*sizeof(char));
memcpy(tu, timeunits, (len+1) * sizeof(char));
ptu = tu;
......@@ -301,7 +301,7 @@ int setBaseTime(const char *timeunits, taxis_t *taxis)
int timeunit;
size_t len = strlen(timeunits);
tu = xmalloc((len+1) * sizeof (char));
tu = (char *)xmalloc((len+1) * sizeof (char));
memcpy(tu, timeunits, (len+1) * sizeof (char));
ptu = tu;
......@@ -636,7 +636,7 @@ void cdfCopyRecord(stream_t *streamptr2, stream_t *streamptr1)
int gridID = vlistInqVarGrid(vlistID1, ivarID);
int datasize = gridInqSize(gridID);
double *data = xmalloc((size_t)datasize * sizeof (double));
double *data = (double *)xmalloc((size_t)datasize * sizeof (double));
int nmiss;
cdfReadRecord(streamptr1, data, &nmiss);
......@@ -4003,7 +4003,7 @@ void transpose2dArrayDP(size_t inWidth, size_t inHeight, double* data)
{
const size_t cacheBlockSize = 256; // Purely an optimization parameter. Current value of 32 means we are handling 8kB blocks,
// which should be a decent compromise on many architectures.
double (*temp)[inWidth] = malloc(inHeight*sizeof(*temp));
double (*temp)[inWidth] = (double (*)[inWidth])malloc(inHeight*sizeof(*temp));
double (*out)[inHeight] = (double (*)[inHeight])data;
memcpy(temp, data, inHeight*sizeof(*temp));
/*
......@@ -4033,7 +4033,7 @@ void transpose2dArraySP(size_t inWidth, size_t inHeight, float* data)
{
const size_t cacheBlockSize = 256; // Purely an optimization parameter. Current value of 32 means we are handling 8kB blocks,
// which should be a decent compromise on many architectures.
float (*temp)[inWidth] = malloc(inHeight*sizeof(*temp));
float (*temp)[inWidth] = (float (*)[inWidth])malloc(inHeight*sizeof(*temp));
float (*out)[inHeight] = (float (*)[inHeight])data;
memcpy(temp, data, inHeight*sizeof(*temp));
/*
......
......@@ -357,7 +357,7 @@ The function @func{zaxisDefName} defines the name of a Z-axis.
*/
void zaxisDefName(int zaxisID, const char *name)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if ( name )
{
......@@ -383,7 +383,7 @@ The function @func{zaxisDefLongname} defines the longname of a Z-axis.
*/
void zaxisDefLongname(int zaxisID, const char *longname)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if ( longname )
{
......@@ -409,7 +409,7 @@ The function @func{zaxisDefUnits} defines the units of a Z-axis.
*/
void zaxisDefUnits(int zaxisID, const char *units)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if ( units )
{
......@@ -440,7 +440,7 @@ The function @func{zaxisInqName} returns the name of a Z-axis.
*/
void zaxisInqName(int zaxisID, char *name)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
strcpy(name, zaxisptr->name);
}
......@@ -465,7 +465,7 @@ The function @func{zaxisInqLongname} returns the longname of a Z-axis.
*/
void zaxisInqLongname(int zaxisID, char *longname)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
strcpy(longname, zaxisptr->longname);
}
......@@ -490,21 +490,21 @@ The function @func{zaxisInqUnits} returns the units of a Z-axis.
*/
void zaxisInqUnits(int zaxisID, char *units)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
strcpy(units, zaxisptr->units);
}
void zaxisInqStdname(int zaxisID, char *stdname)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
strcpy(stdname, zaxisptr->stdname);
}
void zaxisDefPrec(int zaxisID, int prec)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if (zaxisptr->prec != prec)
{
......@@ -516,7 +516,7 @@ void zaxisDefPrec(int zaxisID, int prec)
int zaxisInqPrec(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
return (zaxisptr->prec);
}
......@@ -524,7 +524,7 @@ int zaxisInqPrec(int zaxisID)
void zaxisDefPositive(int zaxisID, int positive)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if (zaxisptr->positive != positive)
{
......@@ -536,7 +536,7 @@ void zaxisDefPositive(int zaxisID, int positive)
int zaxisInqPositive(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
return (zaxisptr->positive);
}
......@@ -544,7 +544,7 @@ int zaxisInqPositive(int zaxisID)
void zaxisDefLtype(int zaxisID, int ltype)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if (zaxisptr->ltype != ltype)
{
......@@ -556,7 +556,7 @@ void zaxisDefLtype(int zaxisID, int ltype)
int zaxisInqLtype(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
return (zaxisptr->ltype);
}
......@@ -564,7 +564,7 @@ int zaxisInqLtype(int zaxisID)
void zaxisDefLtype2(int zaxisID, int ltype2)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if (zaxisptr->ltype2 != ltype2)
{
......@@ -576,7 +576,7 @@ void zaxisDefLtype2(int zaxisID, int ltype2)
int zaxisInqLtype2(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
return (zaxisptr->ltype2);
}
......@@ -597,7 +597,7 @@ The function @func{zaxisDefLevels} defines the levels of a Z-axis.
*/
void zaxisDefLevels(int zaxisID, const double *levels)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
int size = zaxisptr->size;
......@@ -625,7 +625,7 @@ The function @func{zaxisDefLevel} defines one level of a Z-axis.
*/
void zaxisDefLevel(int zaxisID, int levelID, double level)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if ( levelID >= 0 && levelID < zaxisptr->size )
zaxisptr->vals[levelID] = level;
......@@ -635,7 +635,7 @@ void zaxisDefLevel(int zaxisID, int levelID, double level)
void zaxisDefNlevRef(int zaxisID, const int nhlev)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if (zaxisptr->nhlev != nhlev)
{
......@@ -647,7 +647,7 @@ void zaxisDefNlevRef(int zaxisID, const int nhlev)
int zaxisInqNlevRef(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
return (zaxisptr->nhlev);
}
......@@ -668,7 +668,7 @@ The function @func{zaxisDefNumber} defines the reference number for a generalize
*/
void zaxisDefNumber(int zaxisID, const int number)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if (zaxisptr->number != number)
{
......@@ -694,7 +694,7 @@ The function @func{zaxisInqNumber} returns the reference number to a generalized
*/
int zaxisInqNumber(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
return (zaxisptr->number);
}
......@@ -715,7 +715,7 @@ The function @func{zaxisDefUUID} defines the UUID for a generalized Z-axis.
*/
void zaxisDefUUID(int zaxisID, const unsigned char uuid[CDI_UUID_SIZE])
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
memcpy(zaxisptr->uuid, uuid, CDI_UUID_SIZE);
reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE);
......@@ -739,7 +739,7 @@ The function @func{zaxisInqUUID} returns the UUID to a generalized Z-axis.
*/
void zaxisInqUUID(int zaxisID, unsigned char uuid[CDI_UUID_SIZE])
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
memcpy(uuid, zaxisptr->uuid, CDI_UUID_SIZE);
}
......@@ -762,7 +762,7 @@ The function @func{zaxisInqLevel} returns one level of a Z-axis.
double zaxisInqLevel(int zaxisID, int levelID)
{
double level = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if ( levelID >= 0 && levelID < zaxisptr->size )
level = zaxisptr->vals[levelID];
......@@ -773,7 +773,7 @@ double zaxisInqLevel(int zaxisID, int levelID)
double zaxisInqLbound(int zaxisID, int index)
{
double level = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if ( zaxisptr->lbounds )
if ( index >= 0 && index < zaxisptr->size )
......@@ -786,7 +786,7 @@ double zaxisInqLbound(int zaxisID, int index)
double zaxisInqUbound(int zaxisID, int index)
{
double level = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if ( zaxisptr->ubounds )
if ( index >= 0 && index < zaxisptr->size )
......@@ -798,7 +798,7 @@ double zaxisInqUbound(int zaxisID, int index)
const double *zaxisInqLevelsPtr(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
return ( zaxisptr->vals );
}
......@@ -821,7 +821,7 @@ The function @func{zaxisInqLevels} returns all levels of a Z-axis.
*/
void zaxisInqLevels(int zaxisID, double *levels)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
int size = zaxisptr->size;
for (int i = 0; i < size; i++ )
levels[i] = zaxisptr->vals[i];
......@@ -831,7 +831,7 @@ void zaxisInqLevels(int zaxisID, double *levels)
int zaxisInqLbounds(int zaxisID, double *lbounds)
{
int size = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if ( zaxisptr->lbounds )
{
......@@ -849,7 +849,7 @@ int zaxisInqLbounds(int zaxisID, double *lbounds)
int zaxisInqUbounds(int zaxisID, double *ubounds)
{
int size = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if ( zaxisptr->ubounds )
{
......@@ -867,7 +867,7 @@ int zaxisInqUbounds(int zaxisID, double *ubounds)
int zaxisInqWeights(int zaxisID, double *weights)
{
int size = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if ( zaxisptr->weights )
{
......@@ -885,7 +885,7 @@ int zaxisInqWeights(int zaxisID, double *weights)
int zaxisInqLevelID(int zaxisID, double level)
{
int levelID = CDI_UNDEFID;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
int size = zaxisptr->size;
for ( int i = 0; i < size; i++ )
......@@ -925,7 +925,7 @@ The valid CDI Z-axis types are @func{ZAXIS_GENERIC}, @func{ZAXIS_SURFACE},
*/
int zaxisInqType(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
return (zaxisptr->type);
}
......@@ -947,14 +947,14 @@ The function @func{zaxisInqSize} returns the size of a Z-axis.
*/
int zaxisInqSize(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
return (zaxisptr->size);
}
void cdiCheckZaxis(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if ( zaxisInqType(zaxisID) == ZAXIS_GENERIC )
{
......@@ -990,7 +990,7 @@ void cdiCheckZaxis(int zaxisID)
void zaxisDefVct(int zaxisID, int size, const double *vct)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
if ( zaxisptr->vct == 0 )
{
......@@ -1007,28 +1007,28 @@ void zaxisDefVct(int zaxisID, int size, const double *vct)
void zaxisInqVct(int zaxisID, double *vct)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
memcpy(vct, zaxisptr->vct, (size_t)zaxisptr->vctsize * sizeof (double));
}
int zaxisInqVctSize(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
return (zaxisptr->vctsize);
}
const double *zaxisInqVctPtr(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
return (zaxisptr->vct);
}
void zaxisDefLbounds(int zaxisID, const double *lbounds)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
size_t size = (size_t)zaxisptr->size;
......@@ -1046,7 +1046,7 @@ void zaxisDefLbounds(int zaxisID, const double *lbounds)
void zaxisDefUbounds(int zaxisID, const double *ubounds)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
size_t size = (size_t)zaxisptr->size;
......@@ -1064,7 +1064,7 @@ void zaxisDefUbounds(int zaxisID, const double *ubounds)
void zaxisDefWeights(int zaxisID, const double *weights)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
size_t size = (size_t)zaxisptr->size;
......@@ -1082,14 +1082,14 @@ void zaxisDefWeights(int zaxisID, const double *weights)
void zaxisChangeType(int zaxisID, int zaxistype)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
zaxisptr->type = zaxistype;
}
void zaxisResize(int zaxisID, int size)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
xassert(size >= 0);
......@@ -1103,13 +1103,13 @@ void zaxisResize(int zaxisID, int size)
int zaxisDuplicate(int zaxisID)
{
int zaxisIDnew;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
int zaxistype = zaxisInqType(zaxisID);
int zaxissize = zaxisInqSize(zaxisID);
zaxisIDnew = zaxisCreate(zaxistype, zaxissize);
zaxis_t *zaxisptrnew = reshGetVal(zaxisIDnew, &zaxisOps);
zaxis_t *zaxisptrnew = (zaxis_t *)reshGetVal(zaxisIDnew, &zaxisOps);
zaxis_copy(zaxisptrnew, zaxisptr);
......@@ -1270,7 +1270,7 @@ void zaxisPrintKernel ( zaxis_t * zaxisptr, int index, FILE * fp )
void zaxisPrint ( int zaxisID, int index )
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
zaxis_t *zaxisptr = (zaxis_t *)reshGetVal(zaxisID, &zaxisOps);
zaxisPrintKernel ( zaxisptr, index, stdout );
}
......
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