mirror of https://github.com/ecmwf/eccodes.git
ECC-1274: BUFR: duplicated/incorrect error messages during decode
This commit is contained in:
parent
82a4d1ff74
commit
97710440d4
|
@ -407,7 +407,7 @@ bufr_descriptor* accessor_bufr_elements_table_get_descriptor(grib_accessor* a, i
|
|||
v = (bufr_descriptor*)grib_context_malloc_clear(c, sizeof(bufr_descriptor));
|
||||
if (!v) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_bufr_descriptor_new unable to allocate %ld bytes\n", sizeof(bufr_descriptor));
|
||||
"accessor_bufr_elements_table_get_descriptor: unable to allocate %ld bytes\n", sizeof(bufr_descriptor));
|
||||
*err = GRIB_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -216,6 +216,7 @@ static int global_depth = -1;
|
|||
#endif
|
||||
|
||||
#define BUFR_DESCRIPTORS_ARRAY_USED_SIZE(v) ((v)->n)
|
||||
#define SILENT 1
|
||||
|
||||
static void __expand(grib_accessor* a, bufr_descriptors_array* unexpanded, bufr_descriptors_array* expanded,
|
||||
change_coding_params* ccp, int* err)
|
||||
|
@ -273,7 +274,7 @@ static void __expand(grib_accessor* a, bufr_descriptors_array* unexpanded, bufr_
|
|||
|
||||
inner_unexpanded = grib_bufr_descriptors_array_new(c, DESC_SIZE_INIT, DESC_SIZE_INCR);
|
||||
for (i = 0; i < size; i++) {
|
||||
vv = grib_bufr_descriptor_new(self->tablesAccessor, v[i], err);
|
||||
vv = grib_bufr_descriptor_new(self->tablesAccessor, v[i], !SILENT, err);
|
||||
inner_unexpanded = grib_bufr_descriptors_array_push(inner_unexpanded, vv);
|
||||
}
|
||||
grib_context_free(c, v);
|
||||
|
@ -396,7 +397,7 @@ static void __expand(grib_accessor* a, bufr_descriptors_array* unexpanded, bufr_
|
|||
DESCRIPTORS_POP_FRONT_OR_RETURN(unexpanded, u);
|
||||
size = 1;
|
||||
if (ccp->associatedFieldWidth && u->X != 31) {
|
||||
bufr_descriptor* au = grib_bufr_descriptor_new(self->tablesAccessor, 999999, err);
|
||||
bufr_descriptor* au = grib_bufr_descriptor_new(self->tablesAccessor, 999999, !SILENT, err);
|
||||
au->width = ccp->associatedFieldWidth;
|
||||
grib_bufr_descriptor_set_scale(au, 0);
|
||||
strcpy(au->shortName, "associatedField");
|
||||
|
@ -658,8 +659,12 @@ static int expand(grib_accessor* a)
|
|||
unexpanded_copy = grib_bufr_descriptors_array_new(c, unexpandedSize, DESC_SIZE_INCR);
|
||||
operator206yyy_width = 0;
|
||||
for (i = 0; i < unexpandedSize; i++) {
|
||||
bufr_descriptor* aDescriptor1 = grib_bufr_descriptor_new(self->tablesAccessor, u[i], &err);
|
||||
bufr_descriptor* aDescriptor2 = grib_bufr_descriptor_new(self->tablesAccessor, u[i], &err);
|
||||
bufr_descriptor *aDescriptor1, *aDescriptor2;
|
||||
/* ECC-1274: clear error and only issue msg once */
|
||||
err = 0;
|
||||
aDescriptor1 = grib_bufr_descriptor_new(self->tablesAccessor, u[i], SILENT, &err);
|
||||
err = 0;
|
||||
aDescriptor2 = grib_bufr_descriptor_new(self->tablesAccessor, u[i], !SILENT, &err);
|
||||
|
||||
/* ECC-433: Operator 206YYY */
|
||||
if (aDescriptor1->F == 2 && aDescriptor1->X == 6) {
|
||||
|
|
|
@ -171,7 +171,7 @@ grib_hash_array_value* grib_double_hash_array_value_new(grib_context* c, const c
|
|||
void grib_hash_array_value_delete(grib_context* c, grib_hash_array_value* v);
|
||||
|
||||
/* grib_bufr_descriptor.c */
|
||||
bufr_descriptor* grib_bufr_descriptor_new(grib_accessor* tables_accessor, int code, int* err);
|
||||
bufr_descriptor* grib_bufr_descriptor_new(grib_accessor* tables_accessor, int code, int silent, int* err);
|
||||
bufr_descriptor* grib_bufr_descriptor_clone(bufr_descriptor* d);
|
||||
int grib_bufr_descriptor_set_code(grib_accessor* tables_accessor, int code, bufr_descriptor* v);
|
||||
void grib_bufr_descriptor_set_reference(bufr_descriptor* v, long reference);
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
#include "grib_api_internal.h"
|
||||
|
||||
bufr_descriptor* grib_bufr_descriptor_new(grib_accessor* tables_accessor, int code, int* err)
|
||||
bufr_descriptor* grib_bufr_descriptor_new(grib_accessor* tables_accessor, int code, int silent, int* err)
|
||||
{
|
||||
bufr_descriptor* ret = accessor_bufr_elements_table_get_descriptor(tables_accessor, code, err);
|
||||
if (*err)
|
||||
if (!silent && *err)
|
||||
grib_context_log(tables_accessor->context, GRIB_LOG_ERROR,
|
||||
"unable to get descriptor %06d from table", code);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue