Commit a9010525 authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

merged branch cdi-conversion_c++ into trunk

parents 3fa82ee1 73685001
......@@ -32,3 +32,4 @@ void basetimeInit(basetime_t *basetime)
* require-trailing-newline: t
* End:
*/
\ No newline at end of file
......@@ -842,10 +842,10 @@ void gridDefReference(int gridID, const char *reference);
int gridInqReference(int gridID, char *reference);
/* gridDefUUID: Define the UUID of an unstructured grid */
void gridDefUUID(int gridID, const unsigned char uuid[CDI_UUID_SIZE]);
void gridDefUUID(int gridID, const unsigned char *uuid);
/* gridInqUUID: Get the UUID of an unstructured grid */
void gridInqUUID(int gridID, unsigned char uuid[CDI_UUID_SIZE]);
void gridInqUUID(int gridID, unsigned char *uuid);
/* Lambert Conformal Conic grid (GRIB version) */
......
......@@ -367,10 +367,10 @@ void cdiStreamGetIndexList(unsigned numIDs, int IDs[]);
void cdiInitialize(void);
void uuid2str(const unsigned char *uuid, char *uuidstr);
int str2uuid(const char *uuidstr, unsigned char *uuid);
void uuid2str(const unsigned char uuid[], char uuidstr[]);
int str2uuid(const char *uuidstr, unsigned char uuid[]);
static inline int cdiUUIDIsNull(const unsigned char *uuid)
static inline int cdiUUIDIsNull(const unsigned char uuid[])
{
int isNull = 1;
for (size_t i = 0; i < CDI_UUID_SIZE; ++i)
......
......@@ -303,13 +303,13 @@ static int extInqData(extrec_t *extp, int prec, void *data)
int extInqDataSP(void *ext, float *data)
{
return (extInqData(ext, SINGLE_PRECISION, (void *) data));
return (extInqData((extrec_t *)ext, SINGLE_PRECISION, (void *) data));
}
int extInqDataDP(void *ext, double *data)
{
return (extInqData(ext, DOUBLE_PRECISION, (void *) data));
return (extInqData((extrec_t *)ext, DOUBLE_PRECISION, (void *) data));
}
......
......@@ -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
......
......@@ -2627,13 +2627,13 @@ The function @func{gridDuplicate} duplicates a horizontal Grid.
*/
int gridDuplicate(int gridID)
{
grid_t *gridptr = reshGetVal(gridID, &gridOps);
grid_t *gridptr = (grid_t *)reshGetVal(gridID, &gridOps);
int gridtype = gridInqType(gridID);
int gridsize = gridInqSize(gridID);
int gridIDnew = gridCreate(gridtype, gridsize);
grid_t *gridptrnew = reshGetVal(gridIDnew, &gridOps);
grid_t *gridptrnew = (grid_t *)reshGetVal(gridIDnew, &gridOps);
grid_copy(gridptrnew, gridptr);
......@@ -2669,7 +2669,7 @@ int gridDuplicate(int gridID)
{
size_t size = (size_t)(irregular ? gridsize : gridptr->ysize);
gridptrnew->yvals = xmalloc(size * sizeof (double));
gridptrnew->yvals = (double *)xmalloc(size * sizeof (double));
memcpy(gridptrnew->yvals, gridptr->yvals, size * sizeof (double));
}
......@@ -2678,7 +2678,7 @@ int gridDuplicate(int gridID)
size_t size = (size_t)(irregular ? gridsize : gridptr->xsize)
* (size_t)gridptr->nvertex;
gridptrnew->xbounds = xmalloc(size * sizeof (double));
gridptrnew->xbounds = (double *)xmalloc(size * sizeof (double));
memcpy(gridptrnew->xbounds, gridptr->xbounds, size * sizeof (double));
}
......@@ -2687,7 +2687,7 @@ int gridDuplicate(int gridID)
size_t size = (size_t)(irregular ? gridsize : gridptr->ysize)
* (size_t)gridptr->nvertex;
gridptrnew->ybounds = xmalloc(size * sizeof (double));
gridptrnew->ybounds = (double *)xmalloc(size * sizeof (double));
memcpy(gridptrnew->ybounds, gridptr->ybounds, size * sizeof (double));
}
......@@ -2695,7 +2695,7 @@ int gridDuplicate(int gridID)
{
size_t size = (size_t)gridsize;
gridptrnew->area = xmalloc(size * sizeof (double));
gridptrnew->area = (double *)xmalloc(size * sizeof (double));
memcpy(gridptrnew->area, gridptr->area, size * sizeof (double));
}
......@@ -2703,7 +2703,7 @@ int gridDuplicate(int gridID)
{
size_t size = (size_t)gridsize;
gridptrnew->mask = xmalloc(size * sizeof(mask_t));
gridptrnew->mask = (mask_t *)xmalloc(size * sizeof(mask_t));
memcpy(gridptrnew->mask, gridptr->mask, size * sizeof (mask_t));
}
......@@ -2711,7 +2711,7 @@ int gridDuplicate(int gridID)
{
size_t size = (size_t)gridsize;
gridptrnew->mask_gme = xmalloc(size * sizeof (mask_t));
gridptrnew->mask_gme = (mask_t *)xmalloc(size * sizeof (mask_t));
memcpy(gridptrnew->mask_gme, gridptr->mask_gme, size * sizeof(mask_t));
}
......@@ -2885,7 +2885,7 @@ void gridDefXbounds(int gridID, const double *xbounds)
Error("size undefined for gridID = %d", gridID);
if (gridptr->xbounds == NULL)
gridptr->xbounds = xmalloc(size * sizeof (double));
gridptr->xbounds = (double *)xmalloc(size * sizeof (double));
else if ( CDI_Debug )
Warning("values already defined!");
......@@ -2972,7 +2972,7 @@ void gridDefYbounds(int gridID, const double *ybounds)
Error("size undefined for gridID = %d", gridID);
if ( gridptr->ybounds == NULL )
gridptr->ybounds = xmalloc(size * sizeof (double));
gridptr->ybounds = (double *)xmalloc(size * sizeof (double));
else if ( CDI_Debug )
Warning("values already defined!");
......@@ -4454,7 +4454,7 @@ struct varDefGridSearchState
static enum cdiApplyRet
varDefGridSearch(int id, void *res, void *data)
{
struct varDefGridSearchState *state = data;
struct varDefGridSearchState *state = (struct varDefGridSearchState*)data;
(void)res;
if (gridCompare(id, state->queryKey) == 0)
{
......@@ -4495,7 +4495,8 @@ int varDefGrid(int vlistID, const grid_t *grid, int mode)
if ( ! griddefined )
{
struct varDefGridSearchState query = { .queryKey = grid };
struct varDefGridSearchState query;
query.queryKey = grid;// = { .queryKey = grid };
if ((gridglobdefined
= (cdiResHFilterApply(&gridOps, varDefGridSearch, &query)
== CDI_APPLY_STOP)))
......
......@@ -73,7 +73,7 @@ CdiInputFile* cdiInputFile_make(const char* path)
}
else
{
result = xmalloc(sizeof(*result));
result = (CdiInputFile *)xmalloc(sizeof(*result));
if(!cdiInputFile_condestruct(result, path))
{
//An error occured during construction, avoid a memory leak.
......@@ -87,7 +87,7 @@ CdiInputFile* cdiInputFile_make(const char* path)
{
openFileListSize *= 2;
if(openFileListSize < 16) openFileListSize = 16;
openFileList = xrealloc(openFileList, openFileListSize);
openFileList = (CdiInputFile **)xrealloc(openFileList, openFileListSize);
}
xassert(openFileCount < openFileListSize);
openFileList[openFileCount++] = result;
......@@ -101,7 +101,7 @@ CdiInputFile* cdiInputFile_make(const char* path)
int cdiInputFile_read(const CdiInputFile* me, off_t readPosition, size_t readSize, size_t* outActualReadSize, void* buffer)
{
char* byteBuffer = buffer;
char* byteBuffer = (char *)buffer;
size_t trash;
if(!outActualReadSize) outActualReadSize = &trash;
*outActualReadSize = 0;
......
......@@ -301,7 +301,7 @@ char* cdiIterator_serialize(CdiIterator* me)
const char *ftypeStr = fileType2String(me->filetype),
*advStr = me->isAdvanced ? kAdvancedString : kUnadvancedString;
char* result = xmalloc(strlen(ftypeStr) + 1 + strlen(advStr) + 1
char* result = (char *)xmalloc(strlen(ftypeStr) + 1 + strlen(advStr) + 1
+ strlen(subclassDescription) + 1);
sprintf(result, "%s %s %s", ftypeStr, advStr, subclassDescription);
free(subclassDescription);
......
......@@ -14,7 +14,7 @@ static CdiFallbackIterator* cdiFallbackIterator_condestruct(CdiFallbackIterator*
{
if(me) goto destruct;
me = xmalloc(sizeof(*me));
me = (CdiFallbackIterator *)xmalloc(sizeof(*me));
baseIterConstruct(&me->super, filetype);
me->streamId = streamOpenRead(path);
......@@ -90,7 +90,7 @@ char* cdiFallbackIterator_serialize(CdiIterator* super)
CdiFallbackIterator* me = (CdiFallbackIterator*)super;
char* escapedPath = cdiEscapeSpaces(me->path);
char* result = xmalloc(strlen(escapedPath)
char* result = (char *)xmalloc(strlen(escapedPath)
+ 5 * (3 * sizeof (int) * CHAR_BIT / 8 + 1) + 1);
sprintf(result, "%s %d %d %d %d %d", escapedPath, me->variableCount, me->curVariable, me->curLevelCount, me->curLevel, me->curTimestep);
free(escapedPath);
......@@ -99,7 +99,7 @@ char* cdiFallbackIterator_serialize(CdiIterator* super)
CdiFallbackIterator* cdiFallbackIterator_deserialize(const char* description)
{
CdiFallbackIterator* me = xmalloc(sizeof(*me));
CdiFallbackIterator* me = (CdiFallbackIterator *)xmalloc(sizeof(*me));
if(!me) goto fail;
description = baseIter_constructFromString(&me->super, description);
......@@ -186,7 +186,7 @@ char* cdiFallbackIterator_inqTime(CdiIterator* super, bool getEndTime)
int year, month, day, hour, minute, second;
cdiDecodeDate(date, &year, &month, &day);
cdiDecodeTime(time, &hour, &minute, &second);
char *result = xmalloc( 4+1 +2+1 +2+1 +2+1 +2+1 +2+4+1);
char *result = (char *)xmalloc( 4+1 +2+1 +2+1 +2+1 +2+1 +2+4+1);
sprintf(result, "%04d-%02d-%02dT%02d:%02d:%02d.000", year, month, day, hour, minute, second);
return result;
}
......
......@@ -248,7 +248,7 @@ const char *modelInqNamePtr(int modelID)
static int
modelCompareP(void *modelptr1, void *modelptr2)
{
model_t *model1 = modelptr1, *model2 = modelptr2;
model_t *model1 = (model_t *)modelptr1, *model2 = (model_t *)modelptr2;
int diff = (namespaceResHDecode(model1->instID).idx
!= namespaceResHDecode(model2->instID).idx)
| (model1->modelgribID != model2->modelgribID)
......
......@@ -56,7 +56,7 @@ static int activeNamespace = 0;
CDI_NETCDF_SWITCHES \
}
#if defined (SX)
#if defined (SX) || defined (__cplusplus)
static const union namespaceSwitchValue
defaultSwitches_[NUM_NAMESPACE_SWITCH] = defaultSwitches;
#endif
......@@ -184,15 +184,15 @@ namespaceNew()
xassert(newNamespaceID >= 0 && newNamespaceID < NUM_NAMESPACES);
++nNamespaces;
namespaces[newNamespaceID].resStage = STAGE_DEFINITION;
#if defined (SX)
#if defined (SX) || defined (__cplusplus)
memcpy(namespaces[newNamespaceID].switches,
defaultSwitches_,
sizeof (namespaces[newNamespaceID].switches));
#else
memcpy(namespaces[newNamespaceID].switches,
(union namespaceSwitchValue[NUM_NAMESPACE_SWITCH])defaultSwitches,
sizeof (namespaces[newNamespaceID].switches));
#endif
#else
memcpy(namespaces[newNamespaceID].switches,
(union namespaceSwitchValue[NUM_NAMESPACE_SWITCH])defaultSwitches,
sizeof (namespaces[newNamespaceID].switches));
#endif
reshListCreate(newNamespaceID);
NAMESPACE_UNLOCK();
return newNamespaceID;
......
......@@ -67,7 +67,7 @@ void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
case STREAM:
if (sizeAssociations == numAssociations)
associations
= xrealloc(associations,
= (struct streamAssoc *)xrealloc(associations,
sizeof (associations[0]) * (size_t)(sizeAssociations *= 2));
associations[numAssociations]
= streamUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
......
......@@ -53,12 +53,12 @@ serializeStrTabPack(const char **strTab, int numStr,
xassert(numStr >= 0);
for (size_t i = 0; i < (size_t)numStr; ++i)
{
size_t len = strlen(strTab[i]);
serializePack(&(int){(int)len}, 1, DATATYPE_INT,
int len = (int)strlen(strTab[i]);
serializePack(&len, 1, DATATYPE_INT,
buf, buf_size, position, context);
serializePack(strTab[i], (int)len, DATATYPE_TXT,
serializePack(strTab[i], len, DATATYPE_TXT,
buf, buf_size, position, context);
d ^= cdiCheckSum(DATATYPE_TXT, (int)len, strTab[i]);
d ^= cdiCheckSum(DATATYPE_TXT, len, strTab[i]);
}
serializePack(&d, 1, DATATYPE_UINT32,
buf, buf_size, position, context);
......
......@@ -918,7 +918,7 @@ cdiStreamCloseDefaultDelegate(stream_t *streamptr, int recordBufIsToBeDeleted)
{
fileClose(fileID);
if (recordBufIsToBeDeleted)
srvDelete(streamptr->record->exsep);
srvDelete((srvrec_t *)streamptr->record->exsep);
break;
}
#endif
......@@ -936,7 +936,7 @@ cdiStreamCloseDefaultDelegate(stream_t *streamptr, int recordBufIsToBeDeleted)
{
fileClose(fileID);
if (recordBufIsToBeDeleted)
iegDelete(streamptr->record->exsep);
iegDelete((iegrec_t *)streamptr->record->exsep);
break;
}
#endif
......@@ -1365,7 +1365,7 @@ void cdiStreamReadVar(int streamID, int varID, int memtype, void *data, int *nmi
case FILETYPE_GRB2:
{
if ( memtype == MEMTYPE_FLOAT ) Error("grbReadVar not implemented for memtype float!");
grbReadVarDP(streamptr, varID, data, nmiss);
grbReadVarDP(streamptr, varID, (double *)data, nmiss);
break;
}
#endif
......@@ -1373,7 +1373,7 @@ void cdiStreamReadVar(int streamID, int varID, int memtype, void *data, int *nmi
case FILETYPE_SRV:
{
if ( memtype == MEMTYPE_FLOAT ) Error("srvReadVar not implemented for memtype float!");
srvReadVarDP(streamptr, varID, data, nmiss);
srvReadVarDP(streamptr, varID, (double *)data, nmiss);
break;
}
#endif
......@@ -1381,7 +1381,7 @@ void cdiStreamReadVar(int streamID, int varID, int memtype, void *data, int *nmi
case FILETYPE_EXT:
{
if ( memtype == MEMTYPE_FLOAT ) Error("extReadVar not implemented for memtype float!");
extReadVarDP(streamptr, varID, data, nmiss);
extReadVarDP(streamptr, varID, (double *)data, nmiss);
break;
}
#endif
......@@ -1389,7 +1389,7 @@ void cdiStreamReadVar(int streamID, int varID, int memtype, void *data, int *nmi
case FILETYPE_IEG:
{
if ( memtype == MEMTYPE_FLOAT ) Error("iegReadVar not implemented for memtype float!");
iegReadVarDP(streamptr, varID, data, nmiss);
iegReadVarDP(streamptr, varID, (double *)data, nmiss);
break;
}
#endif
......@@ -1400,9 +1400,9 @@ void cdiStreamReadVar(int streamID, int varID, int memtype, void *data, int *nmi
case FILETYPE_NC4C:
{
if ( memtype == MEMTYPE_FLOAT )
cdfReadVarSP(streamptr, varID, data, nmiss);
cdfReadVarSP(streamptr, varID, (float *)data, nmiss);
else
cdfReadVarDP(streamptr, varID, data, nmiss);
cdfReadVarDP(streamptr, varID, (double *)data, nmiss);
break;
}
......@@ -1491,7 +1491,7 @@ void cdiStreamWriteVar_(int streamID, int varID, int memtype, const void *data,
case FILETYPE_SRV:
{
if ( memtype == MEMTYPE_FLOAT ) Error("srvWriteVar not implemented for memtype float!");
srvWriteVarDP(streamptr, varID, data);
srvWriteVarDP(streamptr, varID, (double *)data);
break;
}
#endif
......@@ -1499,7 +1499,7 @@ void cdiStreamWriteVar_(int streamID, int varID, int memtype, const void *data,
case FILETYPE_EXT:
{
if ( memtype == MEMTYPE_FLOAT ) Error("extWriteVar not implemented for memtype float!");
extWriteVarDP(streamptr, varID, data);
extWriteVarDP(streamptr, varID, (double *)data);
break;
}
#endif
......@@ -1507,7 +1507,7 @@ void cdiStreamWriteVar_(int streamID, int varID, int memtype, const void *data,
case FILETYPE_IEG:
{
if ( memtype == MEMTYPE_FLOAT ) Error("iegWriteVar not implemented for memtype float!");
iegWriteVarDP(streamptr, varID, data);
iegWriteVarDP(streamptr, varID, (double *)data);
break;
}
#endif
......@@ -1518,7 +1518,7 @@ void cdiStreamWriteVar_(int streamID, int varID, int memtype, const void *data,
case FILETYPE_NC4C:
{
if ( streamptr->accessmode == 0 ) cdfEndDef(streamptr);
cdf_write_var(streamptr, varID, memtype, data, nmiss);
cdf_write_var(streamptr, varID, memtype, (double *)data, nmiss);
break;
}
#endif
......@@ -1608,7 +1608,7 @@ int cdiStreamReadVarSlice(int streamID, int varID, int levelID, int memtype, voi
case FILETYPE_GRB2:
{
if ( memtype == MEMTYPE_FLOAT ) return 1;
grbReadVarSliceDP(streamptr, varID, levelID, data, nmiss);
grbReadVarSliceDP(streamptr, varID, levelID, (double *)data, nmiss);
break;
}
#endif
......@@ -1616,7 +1616,7 @@ int cdiStreamReadVarSlice(int streamID, int varID, int levelID, int memtype, voi
case FILETYPE_SRV:
{
if ( memtype == MEMTYPE_FLOAT ) return 1;
srvReadVarSliceDP(streamptr, varID, levelID, data, nmiss);
srvReadVarSliceDP(streamptr, varID, levelID, (double *)data, nmiss);
break;
}
#endif
......@@ -1624,7 +1624,7 @@ int cdiStreamReadVarSlice(int streamID, int varID, int levelID, int memtype, voi
case FILETYPE_EXT:
{
if ( memtype == MEMTYPE_FLOAT ) return 1;
extReadVarSliceDP(streamptr, varID, levelID, data, nmiss);
extReadVarSliceDP(streamptr, varID, levelID, (double *)data, nmiss);
break;
}
#endif
......@@ -1632,7 +1632,7 @@ int cdiStreamReadVarSlice(int streamID, int varID, int levelID, int memtype, voi
case FILETYPE_IEG:
{
if ( memtype == MEMTYPE_FLOAT ) return 1;
iegReadVarSliceDP(streamptr, varID, levelID, data, nmiss);
iegReadVarSliceDP(streamptr, varID, levelID, (double *)data, nmiss);
break;
}
#endif
......@@ -1643,9 +1643,9 @@ int cdiStreamReadVarSlice(int streamID, int varID, int levelID, int memtype, voi
case FILETYPE_NC4C:
{
if ( memtype == MEMTYPE_FLOAT )
cdfReadVarSliceSP(streamptr, varID, levelID, data, nmiss);
cdfReadVarSliceSP(streamptr, varID, levelID, (float *)data, nmiss);
else
cdfReadVarSliceDP(streamptr, varID, levelID, data, nmiss);
cdfReadVarSliceDP(streamptr, varID, levelID, (double *)data, nmiss);
break;
}
#endif
......@@ -1713,7 +1713,7 @@ void streamReadVarSliceF(int streamID, int varID, int levelID, float *data, int
// In case the file format does not support single precision reading,
// we fall back to double precision reading, converting the data on the fly.
size_t elementCount = (size_t)gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID));
double* conversionBuffer = malloc(elementCount * sizeof(*conversionBuffer));
double* conversionBuffer = (double *)malloc(elementCount * sizeof(*conversionBuffer));
streamReadVarSlice(streamID, varID, levelID, conversionBuffer, nmiss);
for (size_t i = elementCount; i--; ) data[i] = (float)conversionBuffer[i];
free(conversionBuffer);
......@@ -1752,7 +1752,7 @@ void cdiStreamWriteVarSlice(int streamID, int varID, int levelID, int memtype, c
case FILETYPE_SRV:
{
if ( memtype == MEMTYPE_FLOAT ) Error("srvWriteVarSlice not implemented for memtype float!");
srvWriteVarSliceDP(streamptr, varID, levelID, data);
srvWriteVarSliceDP(streamptr, varID, levelID, (double *)data);
break;
}
#endif
......@@ -1760,7 +1760,7 @@ void cdiStreamWriteVarSlice(int streamID, int varID, int levelID, int memtype, c
case FILETYPE_EXT:
{
if ( memtype == MEMTYPE_FLOAT ) Error("extWriteVarSlice not implemented for memtype float!");
extWriteVarSliceDP(streamptr, varID, levelID, data);
extWriteVarSliceDP(streamptr, varID, levelID, (double *)data);
break;
}
#endif
......@@ -1768,7 +1768,7 @@ void cdiStreamWriteVarSlice(int streamID, int varID, int levelID, int memtype, c
case FILETYPE_IEG:
{
if ( memtype == MEMTYPE_FLOAT ) Error("iegWriteVarSlice not implemented for memtype float!");
iegWriteVarSliceDP(streamptr, varID, levelID, data);
iegWriteVarSliceDP(streamptr, varID, levelID, (double *)data);
break;
}
#endif
......@@ -2134,7 +2134,7 @@ int streamInqFileID(int streamID)
void cdiDefAccesstype(int streamID, int type)
{
stream_t *streamptr = reshGetVal(streamID, &streamOps);
stream_t *streamptr = (stream_t *)reshGetVal(streamID, &streamOps);
if ( streamptr->accesstype == CDI_UNDEFID )
{
......@@ -2205,14 +2205,14 @@ void cdiStreamSetupVlist(stream_t *streamptr, int vlistID, int vlistIDorig)
}
void cdiStreamGetIndexList(unsigned numIDs, int IDs[numIDs])
void cdiStreamGetIndexList(unsigned numIDs, int *IDs)
{
reshGetResHListOfType(numIDs, IDs, &streamOps);
}
int streamInqNvars ( int streamID )
{
stream_t *streamptr = reshGetVal(streamID, &streamOps);
stream_t *streamptr = (stream_t *)reshGetVal(streamID, &streamOps);
return streamptr->nvars;
}
......
......@@ -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));
/*
......
......@@ -421,7 +421,7 @@ int extScanTimestep2(stream_t *streamptr)
cdi_create_records(streamptr, tsID);
nrecords = streamptr->tsteps[0].nallrecs;
streamptr->tsteps[1].recIDs = xmalloc((size_t)nrecords * sizeof (int));
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;
......
......@@ -21,7 +21,7 @@ void streamFCopyRecord(stream_t *streamptr2, stream_t *streamptr1,
if (fileSetPos(fileID1, recpos, SEEK_SET) != 0)
Error("Cannot seek input file for %s record copy!", container_name);
char *buffer = xmalloc(recsize);
char *buffer = (char *)xmalloc(recsize);
if (fileRead(fileID1, buffer, recsize) != recsize)
Error("Failed to read record from %s file for copying!", container_name);
......
......@@ -715,7 +715,7 @@ void grbCopyRecord(stream_t * streamptr2, stream_t * streamptr1)
/* round up recsize to next multiple of 8 */
size_t gribbuffersize = ((recsize + 7U) & ~7U);
unsigned char *gribbuffer = xmalloc(gribbuffersize);
unsigned char *gribbuffer = (unsigned char *)xmalloc(gribbuffersize);
if (fileRead(fileID1, gribbuffer, recsize) != recsize)
Error("Could not read GRIB record for copying!");
......
......@@ -411,7 +411,7 @@ void subtypeDestroyPtr(void *ptr)
/* Non-static wrapper function for "subtypeCompareP". */
int subtypeComparePtr(int s1_ID, subtype_t *s2)
{
subtype_t *subtype_ptr = reshGetVal(s1_ID, &subtypeOps);
subtype_t *subtype_ptr = (subtype_t *)reshGetVal(s1_ID, &subtypeOps);
if (subtype_ptr == NULL) Error("Internal error");
return subtypeCompareP(subtype_ptr,s2);
}
......@@ -420,7 +420,7 @@ int subtypeComparePtr(int s1_ID, subtype_t *s2)
/* Print-out subtype data structure together with its attributes.
Pointer version of this method. */
static void subtypePrintP(void * subtype_ptr, FILE * fp)
{ subtypePrintKernel(subtype_ptr, fp); }
{ subtypePrintKernel((subtype_t *)subtype_ptr, fp); }
......@@ -500,7 +500,7 @@ void subtypeDefGlobalDataP(subtype_t *subtype_ptr, int key, int val)
overwritten. */
void subtypeDefGlobalData(int subtypeID, int key, int val)
{
subtype_t *subtype_ptr = reshGetVal(subtypeID, &subtypeOps);
subtype_t *subtype_ptr = (subtype_t *)reshGetVal(subtypeID, &subtypeOps);
subtypeDefGlobalDataP(subtype_ptr, key, val);