mirror of https://github.com/ecmwf/eccodes.git
ECC-292
This commit is contained in:
parent
b8b6cd0c99
commit
23df9d1a84
|
@ -1,3 +1,4 @@
|
|||
integer, parameter,public :: GRIB_WRONG_BITMAP_SIZE = -66
|
||||
integer, parameter,public :: GRIB_OUT_OF_RANGE = -65
|
||||
integer, parameter,public :: GRIB_UNSUPPORTED_EDITION = -64
|
||||
integer, parameter,public :: GRIB_ATTRIBUTE_NOT_FOUND = -63
|
||||
|
|
|
@ -1206,6 +1206,7 @@ static int get_next_bitmap_descriptor_index_new_bitmap(grib_accessor_bufr_data_a
|
|||
|
||||
if (self->compressedData) {
|
||||
DebugAssert(i<self->nInputBitmap);
|
||||
if (i>=self->nInputBitmap) return GRIB_WRONG_BITMAP_SIZE;
|
||||
while (self->inputBitmap[i]==1) {
|
||||
self->bitmapCurrent++;
|
||||
self->bitmapCurrentElementsDescriptorsIndex++;
|
||||
|
@ -1215,7 +1216,7 @@ static int get_next_bitmap_descriptor_index_new_bitmap(grib_accessor_bufr_data_a
|
|||
i++;
|
||||
}
|
||||
} else {
|
||||
DebugAssert(i<self->nInputBitmap);
|
||||
if (i>=self->nInputBitmap) return GRIB_WRONG_BITMAP_SIZE;
|
||||
while (self->inputBitmap[i]==1) {
|
||||
self->bitmapCurrent++;
|
||||
self->bitmapCurrentElementsDescriptorsIndex++;
|
||||
|
|
|
@ -1650,5 +1650,7 @@ Error codes returned by the grib_api functions.
|
|||
#define GRIB_UNSUPPORTED_EDITION -64
|
||||
/** Value out of coding range */
|
||||
#define GRIB_OUT_OF_RANGE -65
|
||||
/** Size of bitmap is incorrect */
|
||||
#define GRIB_WRONG_BITMAP_SIZE -66
|
||||
/*! @}*/
|
||||
#endif
|
||||
|
|
|
@ -69,6 +69,7 @@ static const char *errors[] = {
|
|||
"Attribute not found.", /* -63 GRIB_ATTRIBUTE_NOT_FOUND */
|
||||
"Edition not supported.", /* -64 GRIB_UNSUPPORTED_EDITION */
|
||||
"Value out of coding range", /* -65 GRIB_OUT_OF_RANGE */
|
||||
"Size of bitmap is incorrect", /* -66 GRIB_WRONG_BITMAP_SIZE */
|
||||
"Value mismatch", /* 1 GRIB_VALUE_MISMATCH */
|
||||
"double values are different", /* 2 GRIB_DOUBLE_VALUE_MISMATCH */
|
||||
"long values are different", /* 3 GRIB_LONG_VALUE_MISMATCH */
|
||||
|
@ -88,33 +89,35 @@ static const char *errors[] = {
|
|||
|
||||
const char* grib_get_error_message(int code)
|
||||
{
|
||||
code = -code;
|
||||
if(code <0 || code >= NUMBER(errors)) {
|
||||
static char mess[80];
|
||||
sprintf(mess,"Unknown error %d",code);
|
||||
return mess;
|
||||
code = -code;
|
||||
if(code <0 || code >= NUMBER(errors)) {
|
||||
static char mess[80];
|
||||
sprintf(mess,"Unknown error %d",code);
|
||||
return mess;
|
||||
}
|
||||
return errors[code];
|
||||
return errors[code];
|
||||
}
|
||||
|
||||
void grib_check(const char* call,const char* file,int line,int e,const char* msg)
|
||||
{
|
||||
grib_context* c=grib_context_get_default();
|
||||
grib_context* c=grib_context_get_default();
|
||||
if(e) {
|
||||
if (file) {
|
||||
fprintf(stderr,"%s at line %d: %s failed: %s",
|
||||
file,line, call,grib_get_error_message(e));
|
||||
if (msg) fprintf(stderr," (%s)",msg);
|
||||
printf("\n");
|
||||
} else {
|
||||
grib_context_log(c,GRIB_LOG_ERROR,"%s",grib_get_error_message(e));
|
||||
}
|
||||
if (file) {
|
||||
fprintf(stderr,"%s at line %d: %s failed: %s",
|
||||
file,line, call,grib_get_error_message(e));
|
||||
if (msg) fprintf(stderr," (%s)",msg);
|
||||
printf("\n");
|
||||
} else {
|
||||
grib_context_log(c,GRIB_LOG_ERROR,"%s",grib_get_error_message(e));
|
||||
}
|
||||
exit(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void grib_fail(const char* expr,const char* file,int line,int silent) {
|
||||
if (!silent)
|
||||
fprintf(stderr,"%s at line %d: assertion failure Assert(%s)\n",file,line,expr);
|
||||
abort();
|
||||
if (!silent)
|
||||
fprintf(stderr,"%s at line %d: assertion failure Assert(%s)\n",file,line,expr);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
|
@ -71,3 +71,4 @@ GRIB_TOO_MANY_ATTRIBUTES Too many attributes. Increase MAX_ACCESSOR_ATTRIBU
|
|||
GRIB_ATTRIBUTE_NOT_FOUND Attribute not found.
|
||||
GRIB_UNSUPPORTED_EDITION Edition not supported.
|
||||
GRIB_OUT_OF_RANGE Value out of coding range
|
||||
GRIB_WRONG_BITMAP_SIZE Size of bitmap is incorrect
|
||||
|
|
Loading…
Reference in New Issue