Commit 819811b8 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cgribexlib update.

parent 1b943d13
2017-01-?? Uwe Schulzweida
* using CGRIBEX library version 1.7.6
* Version 1.8.0 released
2016-11-04 Uwe Schulzweida
* Version 1.8.0rc4 released
......
......@@ -238,10 +238,10 @@ void gribClose(int fileID);
int gribRead(int fileID, unsigned char *buffer, size_t *buffersize);
int gribWrite(int fileID, unsigned char *buffer, size_t buffersize);
off_t gribGetPos(int fileID);
int gribGetSize(int fileID);
size_t gribGetSize(int fileID);
int gribCheckSeek(int fileID, long *offset, int *version);
int gribFileSeek(int fileID, long *offset);
int gribReadSize(int fileID);
size_t gribReadSize(int fileID);
int gribVersion(unsigned char *buffer, size_t buffersize);
int grib_info_for_grads(off_t recpos, long recsize, unsigned char *gribbuffer, int *intnum, float *fltnum, off_t *bignum);
......
/* Automatically generated by m214003 at 2016-06-03, do not edit */
/* Automatically generated by m214003 at 2016-11-04, do not edit */
/* CGRIBEXLIB_VERSION="1.7.5" */
/* CGRIBEXLIB_VERSION="1.7.6" */
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) || defined (__clang__)
#pragma GCC diagnostic push
......@@ -139,8 +139,8 @@ int correct_bdslen(int bdslen, long recsize, long gribpos);
/* param format: DDDCCCNNN */
void cdiDecodeParam(int param, int *pnum, int *pcat, int *pdis);
int cdiEncodeParam(int pnum, int pcat, int pdis);
void cdiDecodeParam(int param, int *dis, int *cat, int *num);
int cdiEncodeParam(int dis, int cat, int num);
/* date format: YYYYMMDD */
/* time format: hhmmss */
......@@ -3957,8 +3957,10 @@ read3ByteMSBFirst(void *fileptr)
return (int)((b1 << 16) + (b2 << 8) + b3);
}
int gribReadSize(int fileID)
size_t gribReadSize(int fileID)
{
size_t rgribsize = 0;
void *fileptr = filePtr(fileID);
off_t pos = fileGetPos(fileID);
......@@ -4009,6 +4011,7 @@ int gribReadSize(int fileID)
if ( CGRIBEX_Debug ) Message("bdssize = %d", bdssize);
gribsize = issize + pdssize + gdssize + bmssize + bdssize + essize;
rgribsize = (size_t) gribsize;
}
else if ( gribversion == 1 )
{
......@@ -4044,51 +4047,50 @@ int gribReadSize(int fileID)
bdssize = correct_bdslen(bdssize, gribsize, issize+pdssize+gdssize+bmssize);
if ( CGRIBEX_Debug ) Message("bdssize = %d", bdssize);
gribsize = issize+pdssize+gdssize+bmssize+bdssize+essize;
gribsize = issize + pdssize + gdssize + bmssize + bdssize + essize;
}
rgribsize = (size_t) gribsize;
}
else if ( gribversion == 2 )
{
int i;
/* we set gribsize the following way because it doesn't matter then
whether int is 4 or 8 bytes long - we don't have to care if the size
really fits: if it does not, the record can not be read at all */
gribsize = 0;
for ( i = 0; i < 8; i++ ) gribsize = (gribsize << 8) | filePtrGetc(fileptr);
rgribsize = 0;
for ( int i = 0; i < 8; i++ ) rgribsize = (rgribsize << 8) | filePtrGetc(fileptr);
}
else
{
gribsize = 0;
rgribsize = 0;
Warning("GRIB version %d unsupported!", gribversion);
}
if ( filePtrEOF(fileptr) ) gribsize = 0;
if ( filePtrEOF(fileptr) ) rgribsize = 0;
if ( CGRIBEX_Debug )
Message("gribsize = %d", gribsize);
if ( CGRIBEX_Debug ) Message("gribsize = %zu", rgribsize);
fileSetPos(fileID, pos, SEEK_SET);
return gribsize;
return rgribsize;
}
int gribGetSize(int fileID)
size_t gribGetSize(int fileID)
{
long offset;
int ierr = gribFileSeek(fileID, &offset); /* position file pointer after GRIB */
if ( ierr > 0 )
{
Warning("GRIB record not found!");
return (0);
return 0;
}
if ( ierr == -1 ) return 0;
else if ( ierr == 1 ) return 0;
int recSize = gribReadSize(fileID);
size_t recSize = gribReadSize(fileID);
if ( CGRIBEX_Debug ) Message("recsize = %d", recSize);
if ( CGRIBEX_Debug ) Message("recsize = %zu", recSize);
fileSetPos(fileID, (off_t) -4, SEEK_CUR);
......@@ -4109,7 +4111,7 @@ int gribRead(int fileID, unsigned char *buffer, size_t *buffersize)
if ( ierr == -1 ) { *buffersize = 0; return -1; }
else if ( ierr == 1 ) { *buffersize = 0; return -2; }
size_t recSize = (size_t)gribReadSize(fileID);
size_t recSize = gribReadSize(fileID);
size_t readSize = recSize;
if ( readSize > *buffersize )
......@@ -11222,7 +11224,7 @@ void encodeES(GRIBPACK *lGrib, long *gribLen, long bdsstart)
if ( z > JP23SET*120 )
{
fprintf(stderr, "Abort: GRIB record too large (max = %d)!\n", JP23SET*120);
fprintf(stderr, "Abort: GRIB1 record too large (size = %ld; max = %d)!\n", z, JP23SET*120);
exit(1);
}
......@@ -13823,7 +13825,7 @@ void encode_dummy(void)
(void) encode_array_unrolled_double(0, 0, 0, NULL, NULL, 0, 0, NULL);
(void) encode_array_unrolled_float(0, 0, 0, NULL, NULL, 0, 0, NULL);
}
static const char grb_libvers[] = "1.7.5" " of ""Jun 3 2016"" ""14:44:00";
static const char grb_libvers[] = "1.7.6" " of ""Nov 4 2016"" ""19:12:51";
const char *
cgribexLibraryVersion(void)
{
......
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