Commit 3006d239 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Change internal checksums to uint32_t.

parent e1b85556
#include <inttypes.h>
#include "cdi_cksum.h" #include "cdi_cksum.h"
double cdiCheckSum(int type, int count, void * buffer) uint32_t cdiCheckSum(int type, int count, void * buffer)
{ {
return 0.0; return 0U;
} }
#ifndef CDI_CKSUM_H_ #ifndef CDI_CKSUM_H_
#define CDI_CKSUM_H_ #define CDI_CKSUM_H_
double cdiCheckSum(int type, int count, void *data); #include <inttypes.h>
uint32_t cdiCheckSum(int type, int count, void *data);
#endif #endif
...@@ -717,7 +717,7 @@ streamGetPackSize(void * voidP, void *context) ...@@ -717,7 +717,7 @@ streamGetPackSize(void * voidP, void *context)
stream_t * streamP = ( stream_t * ) voidP; stream_t * streamP = ( stream_t * ) voidP;
int packBufferSize int packBufferSize
= serializeGetSize(streamNint, DATATYPE_INT, context) = serializeGetSize(streamNint, DATATYPE_INT, context)
+ serializeGetSize(2, DATATYPE_FLT64, context) + serializeGetSize(2, DATATYPE_UINT32, context)
+ serializeGetSize((int)strlen(streamP->filename) + 1, + serializeGetSize((int)strlen(streamP->filename) + 1,
DATATYPE_TXT, context) DATATYPE_TXT, context)
+ serializeGetSize(1, DATATYPE_FLT64, context); + serializeGetSize(1, DATATYPE_FLT64, context);
...@@ -731,7 +731,6 @@ streamPack(void * streamptr, void * packBuffer, int packBufferSize, ...@@ -731,7 +731,6 @@ streamPack(void * streamptr, void * packBuffer, int packBufferSize,
{ {
stream_t * streamP = ( stream_t * ) streamptr; stream_t * streamP = ( stream_t * ) streamptr;
int intBuffer[streamNint]; int intBuffer[streamNint];
double d;
intBuffer[0] = streamP->self; intBuffer[0] = streamP->self;
intBuffer[1] = streamP->filetype; intBuffer[1] = streamP->filetype;
...@@ -746,13 +745,13 @@ streamPack(void * streamptr, void * packBuffer, int packBufferSize, ...@@ -746,13 +745,13 @@ streamPack(void * streamptr, void * packBuffer, int packBufferSize,
intBuffer[10] = cdiHaveMissval; intBuffer[10] = cdiHaveMissval;
serializePack(intBuffer, streamNint, DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); serializePack(intBuffer, streamNint, DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_INT, streamNint, intBuffer); uint32_t d = cdiCheckSum(DATATYPE_INT, streamNint, intBuffer);
serializePack(&d, 1, DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); serializePack(&d, 1, DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context);
serializePack(&cdiDefaultMissval, 1, DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); serializePack(&cdiDefaultMissval, 1, DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context);
serializePack(streamP->filename, intBuffer[2], DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context); serializePack(streamP->filename, intBuffer[2], DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_TXT, intBuffer[2], &streamP->filename); d = cdiCheckSum(DATATYPE_TXT, intBuffer[2], &streamP->filename);
serializePack(&d, 1, DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); serializePack(&d, 1, DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context);
} }
struct streamAssoc struct streamAssoc
...@@ -760,13 +759,13 @@ streamUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -760,13 +759,13 @@ streamUnpack(char * unpackBuffer, int unpackBufferSize,
int * unpackBufferPos, int nspTarget, void *context) int * unpackBufferPos, int nspTarget, void *context)
{ {
int intBuffer[streamNint], streamID; int intBuffer[streamNint], streamID;
double d; uint32_t d;
char filename[CDI_MAX_NAME]; char filename[CDI_MAX_NAME];
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
intBuffer, streamNint, DATATYPE_INT, context); intBuffer, streamNint, DATATYPE_INT, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_INT, streamNint, intBuffer) == d); xassert(cdiCheckSum(DATATYPE_INT, streamNint, intBuffer) == d);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
...@@ -774,7 +773,7 @@ streamUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -774,7 +773,7 @@ streamUnpack(char * unpackBuffer, int unpackBufferSize,
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&filename, intBuffer[2], DATATYPE_TXT, context); &filename, intBuffer[2], DATATYPE_TXT, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(d == cdiCheckSum(DATATYPE_TXT, intBuffer[2], filename)); xassert(d == cdiCheckSum(DATATYPE_TXT, intBuffer[2], filename));
streamID = streamOpenWrite ( filename, intBuffer[1] ); streamID = streamOpenWrite ( filename, intBuffer[1] );
xassert ( streamID >= 0 && xassert ( streamID >= 0 &&
......
...@@ -4398,7 +4398,7 @@ gridTxCode () ...@@ -4398,7 +4398,7 @@ gridTxCode ()
} }
enum { gridNint = 27, enum { gridNint = 27,
gridNdouble = 25, gridNdouble = 24,
gridNstrings= 8, gridNstrings= 8,
gridHasMaskFlag = 1 << 0, gridHasMaskFlag = 1 << 0,
gridHasGMEMaskFlag = 1 << 1, gridHasGMEMaskFlag = 1 << 1,
...@@ -4435,13 +4435,13 @@ gridGetPackSize(void * voidP, void *context) ...@@ -4435,13 +4435,13 @@ gridGetPackSize(void * voidP, void *context)
int packBuffSize = 0, count; int packBuffSize = 0, count;
packBuffSize += serializeGetSize(gridNint, DATATYPE_INT, context) packBuffSize += serializeGetSize(gridNint, DATATYPE_INT, context)
+ serializeGetSize(1, DATATYPE_FLT64, context); + serializeGetSize(1, DATATYPE_UINT32, context);
if (gridP->rowlon) if (gridP->rowlon)
{ {
xassert(gridP->nrowlon); xassert(gridP->nrowlon);
packBuffSize += serializeGetSize(gridP->nrowlon, DATATYPE_INT, context) packBuffSize += serializeGetSize(gridP->nrowlon, DATATYPE_INT, context)
+ serializeGetSize( 1, DATATYPE_FLT64, context); + serializeGetSize( 1, DATATYPE_UINT32, context);
} }
packBuffSize += serializeGetSize(gridNdouble, DATATYPE_FLT64, context); packBuffSize += serializeGetSize(gridNdouble, DATATYPE_FLT64, context);
...@@ -4453,7 +4453,8 @@ gridGetPackSize(void * voidP, void *context) ...@@ -4453,7 +4453,8 @@ gridGetPackSize(void * voidP, void *context)
else else
count = gridP->xsize; count = gridP->xsize;
xassert(count); xassert(count);
packBuffSize += serializeGetSize(count + 1, DATATYPE_FLT64, context); packBuffSize += serializeGetSize(count, DATATYPE_FLT64, context)
+ serializeGetSize(1, DATATYPE_UINT32, context);
} }
if (gridP->yvals) if (gridP->yvals)
...@@ -4463,14 +4464,16 @@ gridGetPackSize(void * voidP, void *context) ...@@ -4463,14 +4464,16 @@ gridGetPackSize(void * voidP, void *context)
else else
count = gridP->ysize; count = gridP->ysize;
xassert(count); xassert(count);
packBuffSize += serializeGetSize(count + 1, DATATYPE_FLT64, context); packBuffSize += serializeGetSize(count, DATATYPE_FLT64, context)
+ serializeGetSize(1, DATATYPE_UINT32, context);
} }
if (gridP->area) if (gridP->area)
{ {
xassert(gridP->size); xassert(gridP->size);
packBuffSize += packBuffSize +=
serializeGetSize(gridP->size + 1, DATATYPE_FLT64, context); serializeGetSize(gridP->size, DATATYPE_FLT64, context)
+ serializeGetSize(1, DATATYPE_UINT32, context);
} }
if (gridP->xbounds) if (gridP->xbounds)
...@@ -4482,7 +4485,8 @@ gridGetPackSize(void * voidP, void *context) ...@@ -4482,7 +4485,8 @@ gridGetPackSize(void * voidP, void *context)
count = gridP->xsize; count = gridP->xsize;
xassert(count); xassert(count);
packBuffSize packBuffSize
+= serializeGetSize(gridP->nvertex * count + 1, DATATYPE_FLT64, context); += (serializeGetSize(gridP->nvertex * count, DATATYPE_FLT64, context)
+ serializeGetSize(1, DATATYPE_UINT32, context));
} }
if (gridP->ybounds) if (gridP->ybounds)
...@@ -4494,18 +4498,19 @@ gridGetPackSize(void * voidP, void *context) ...@@ -4494,18 +4498,19 @@ gridGetPackSize(void * voidP, void *context)
count = gridP->ysize; count = gridP->ysize;
xassert(count); xassert(count);
packBuffSize packBuffSize
+= serializeGetSize(gridP->nvertex * count + 1, DATATYPE_FLT64, context); += (serializeGetSize(gridP->nvertex * count, DATATYPE_FLT64, context)
+ serializeGetSize(1, DATATYPE_UINT32, context));
} }
packBuffSize += packBuffSize +=
serializeGetSize(gridNstrings * CDI_MAX_NAME , DATATYPE_TXT, context) serializeGetSize(gridNstrings * CDI_MAX_NAME , DATATYPE_TXT, context)
+ serializeGetSize(1, DATATYPE_FLT64, context); + serializeGetSize(1, DATATYPE_UINT32, context);
if (gridP->reference) if (gridP->reference)
{ {
packBuffSize += serializeGetSize(1, DATATYPE_INT, context) packBuffSize += serializeGetSize(1, DATATYPE_INT, context)
+ serializeGetSize(strlen(gridP->reference) + 1, DATATYPE_TXT, context) + serializeGetSize(strlen(gridP->reference) + 1, DATATYPE_TXT, context)
+ serializeGetSize(1, DATATYPE_FLT64, context); + serializeGetSize(1, DATATYPE_UINT32, context);
} }
if (gridP->mask) if (gridP->mask)
...@@ -4513,14 +4518,14 @@ gridGetPackSize(void * voidP, void *context) ...@@ -4513,14 +4518,14 @@ gridGetPackSize(void * voidP, void *context)
xassert(gridP->size); xassert(gridP->size);
packBuffSize packBuffSize
+= serializeGetSize(gridP->size, DATATYPE_UCHAR, context) += serializeGetSize(gridP->size, DATATYPE_UCHAR, context)
+ serializeGetSize(1, DATATYPE_FLT64, context); + serializeGetSize(1, DATATYPE_UINT32, context);
} }
if (gridP->mask_gme) if (gridP->mask_gme)
{ {
xassert(gridP->size); xassert(gridP->size);
packBuffSize += serializeGetSize(gridP->size, DATATYPE_UCHAR, context) packBuffSize += serializeGetSize(gridP->size, DATATYPE_UCHAR, context)
+ serializeGetSize( 1, DATATYPE_FLT64, context); + serializeGetSize(1, DATATYPE_UINT32, context);
} }
return packBuffSize; return packBuffSize;
...@@ -4532,8 +4537,8 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4532,8 +4537,8 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
int * unpackBufferPos, int nspTarget, void *context) int * unpackBufferPos, int nspTarget, void *context)
{ {
grid_t * gridP; grid_t * gridP;
uint32_t d;
int memberMask, size; int memberMask, size;
double d;
char charBuffer[gridNstrings * CDI_MAX_NAME]; char charBuffer[gridNstrings * CDI_MAX_NAME];
gridInit(); gridInit();
...@@ -4545,7 +4550,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4545,7 +4550,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
intBuffer, gridNint, DATATYPE_INT, context); intBuffer, gridNint, DATATYPE_INT, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_INT, gridNint, intBuffer) == d); xassert(cdiCheckSum(DATATYPE_INT, gridNint, intBuffer) == d);
xassert(namespaceAdaptKey(intBuffer[0], nspTarget) == gridP->self); xassert(namespaceAdaptKey(intBuffer[0], nspTarget) == gridP->self);
...@@ -4585,7 +4590,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4585,7 +4590,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->rowlon, gridP->nrowlon , DATATYPE_INT, context); gridP->rowlon, gridP->nrowlon , DATATYPE_INT, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_INT, gridP->nrowlon, gridP->rowlon) == d); xassert(cdiCheckSum(DATATYPE_INT, gridP->nrowlon, gridP->rowlon) == d);
} }
...@@ -4593,8 +4598,9 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4593,8 +4598,9 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
double doubleBuffer[gridNdouble]; double doubleBuffer[gridNdouble];
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
doubleBuffer, gridNdouble, DATATYPE_FLT64, context); doubleBuffer, gridNdouble, DATATYPE_FLT64, context);
xassert(doubleBuffer[24] serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
== cdiCheckSum(DATATYPE_FLT, gridNdouble, doubleBuffer)); &d, 1, DATATYPE_UINT32, context);
xassert(d == cdiCheckSum(DATATYPE_FLT, gridNdouble, doubleBuffer));
gridP->xfirst = doubleBuffer[0]; gridP->xfirst = doubleBuffer[0];
gridP->yfirst = doubleBuffer[1]; gridP->yfirst = doubleBuffer[1];
...@@ -4633,7 +4639,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4633,7 +4639,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->xvals, size, DATATYPE_FLT64, context); gridP->xvals, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_FLT, size, gridP->xvals) == d ); xassert(cdiCheckSum(DATATYPE_FLT, size, gridP->xvals) == d );
} }
...@@ -4648,7 +4654,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4648,7 +4654,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->yvals, size, DATATYPE_FLT64, context); gridP->yvals, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_FLT, size, gridP->yvals) == d); xassert(cdiCheckSum(DATATYPE_FLT, size, gridP->yvals) == d);
} }
...@@ -4659,7 +4665,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4659,7 +4665,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->area, size, DATATYPE_FLT64, context); gridP->area, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_FLT, size, gridP->area) == d); xassert(cdiCheckSum(DATATYPE_FLT, size, gridP->area) == d);
} }
...@@ -4675,7 +4681,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4675,7 +4681,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->xbounds, size, DATATYPE_FLT64, context); gridP->xbounds, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_FLT, size, gridP->xbounds) == d); xassert(cdiCheckSum(DATATYPE_FLT, size, gridP->xbounds) == d);
} }
...@@ -4691,14 +4697,14 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4691,14 +4697,14 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->ybounds, size, DATATYPE_FLT64, context); gridP->ybounds, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_FLT, size, gridP->ybounds) == d); xassert(cdiCheckSum(DATATYPE_FLT, size, gridP->ybounds) == d);
} }
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
charBuffer, gridNstrings * CDI_MAX_NAME, DATATYPE_TXT, context); charBuffer, gridNstrings * CDI_MAX_NAME, DATATYPE_TXT, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(d == cdiCheckSum(DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer)); xassert(d == cdiCheckSum(DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer));
...@@ -4720,7 +4726,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4720,7 +4726,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->reference, referenceSize, DATATYPE_TXT, context); gridP->reference, referenceSize, DATATYPE_TXT, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_TXT, referenceSize, gridP->reference) == d); xassert(cdiCheckSum(DATATYPE_TXT, referenceSize, gridP->reference) == d);
} }
...@@ -4731,7 +4737,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4731,7 +4737,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->mask, gridP->size, DATATYPE_UCHAR, context); gridP->mask, gridP->size, DATATYPE_UCHAR, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_TXT, gridP->size, gridP->mask) == d); xassert(cdiCheckSum(DATATYPE_TXT, gridP->size, gridP->mask) == d);
} }
...@@ -4742,7 +4748,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4742,7 +4748,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->mask_gme, gridP->size, DATATYPE_UCHAR, context); gridP->mask_gme, gridP->size, DATATYPE_UCHAR, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&d, 1, DATATYPE_FLT64, context); &d, 1, DATATYPE_UINT32, context);
xassert(cdiCheckSum(DATATYPE_TXT, gridP->size, gridP->mask_gme) == d); xassert(cdiCheckSum(DATATYPE_TXT, gridP->size, gridP->mask_gme) == d);
} }
} }
...@@ -4754,7 +4760,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4754,7 +4760,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
{ {
grid_t * gridP = ( grid_t * ) voidP; grid_t * gridP = ( grid_t * ) voidP;
int size; int size;
double d; uint32_t d;
char charBuffer[gridNstrings * CDI_MAX_NAME]; char charBuffer[gridNstrings * CDI_MAX_NAME];
{ {
...@@ -4791,7 +4797,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4791,7 +4797,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
serializePack(intBuffer, gridNint, DATATYPE_INT, serializePack(intBuffer, gridNint, DATATYPE_INT,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_INT, gridNint, intBuffer); d = cdiCheckSum(DATATYPE_INT, gridNint, intBuffer);
serializePack(&d, 1, DATATYPE_FLT64, serializePack(&d, 1, DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
} }
...@@ -4801,7 +4807,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4801,7 +4807,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
serializePack(gridP->rowlon, size, DATATYPE_INT, serializePack(gridP->rowlon, size, DATATYPE_INT,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_INT , size, gridP->rowlon); d = cdiCheckSum(DATATYPE_INT , size, gridP->rowlon);
serializePack(&d, 1, DATATYPE_FLT64, serializePack(&d, 1, DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
} }
...@@ -4832,10 +4838,12 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4832,10 +4838,12 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
doubleBuffer[21] = gridP->xpole; doubleBuffer[21] = gridP->xpole;
doubleBuffer[22] = gridP->ypole; doubleBuffer[22] = gridP->ypole;
doubleBuffer[23] = gridP->angle; doubleBuffer[23] = gridP->angle;
doubleBuffer[24] = cdiCheckSum(DATATYPE_FLT, gridNdouble - 1, doubleBuffer);
serializePack(doubleBuffer, gridNdouble, DATATYPE_FLT64, serializePack(doubleBuffer, gridNdouble, DATATYPE_FLT64,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_FLT, gridNdouble, doubleBuffer);
serializePack(&d, 1, DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context);
} }
if (gridP->xvals) if (gridP->xvals)
...@@ -4849,7 +4857,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4849,7 +4857,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
serializePack(gridP->xvals, size, DATATYPE_FLT64, serializePack(gridP->xvals, size, DATATYPE_FLT64,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_FLT, size, gridP->xvals); d = cdiCheckSum(DATATYPE_FLT, size, gridP->xvals);
serializePack(&d, 1, DATATYPE_FLT64, serializePack(&d, 1, DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
} }
...@@ -4863,7 +4871,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4863,7 +4871,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
serializePack(gridP->yvals, size, DATATYPE_FLT64, serializePack(gridP->yvals, size, DATATYPE_FLT64,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_FLT, size, gridP->yvals); d = cdiCheckSum(DATATYPE_FLT, size, gridP->yvals);
serializePack(&d, 1, DATATYPE_FLT64, serializePack(&d, 1, DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
} }
...@@ -4874,7 +4882,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4874,7 +4882,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
serializePack(gridP->area, gridP->size, DATATYPE_FLT64, serializePack(gridP->area, gridP->size, DATATYPE_FLT64,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_FLT, gridP->size, gridP->area); d = cdiCheckSum(DATATYPE_FLT, gridP->size, gridP->area);
serializePack(&d, 1, DATATYPE_FLT64, serializePack(&d, 1, DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
} }
...@@ -4890,7 +4898,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4890,7 +4898,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
serializePack(gridP->xbounds, size, DATATYPE_FLT64, serializePack(gridP->xbounds, size, DATATYPE_FLT64,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_FLT, size, gridP->xbounds); d = cdiCheckSum(DATATYPE_FLT, size, gridP->xbounds);
serializePack(&d, 1, DATATYPE_FLT64, serializePack(&d, 1, DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
} }
...@@ -4906,7 +4914,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4906,7 +4914,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
serializePack(gridP->ybounds, size, DATATYPE_FLT64, serializePack(gridP->ybounds, size, DATATYPE_FLT64,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_FLT, size, gridP->ybounds); d = cdiCheckSum(DATATYPE_FLT, size, gridP->ybounds);
serializePack(&d, 1, DATATYPE_FLT64, serializePack(&d, 1, DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
} }
...@@ -4922,7 +4930,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4922,7 +4930,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
serializePack( charBuffer, gridNstrings * CDI_MAX_NAME, DATATYPE_TXT, serializePack( charBuffer, gridNstrings * CDI_MAX_NAME, DATATYPE_TXT,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer); d = cdiCheckSum(DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer);
serializePack(&d, 1, DATATYPE_FLT64, serializePack(&d, 1, DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
if ( gridP->reference ) if ( gridP->reference )
...@@ -4933,7 +4941,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4933,7 +4941,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
serializePack(gridP->reference, size, DATATYPE_TXT, serializePack(gridP->reference, size, DATATYPE_TXT,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_TXT, size, gridP->reference); d = cdiCheckSum(DATATYPE_TXT, size, gridP->reference);
serializePack(&d, 1, DATATYPE_FLT64, serializePack(&d, 1, DATATYPE_UINT32,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
} }
...@@ -4943,7 +4951,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4943,7 +4951,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
serializePack(gridP->mask, size, DATATYPE_UCHAR, serializePack(gridP->mask, size, DATATYPE_UCHAR,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_TXT, size, gridP->mask); d = cdiCheckSum(DATATYPE_TXT, size, gridP->mask);
serializePack(&d, 1, DATATYPE_FLT64,