mirror of https://github.com/ecmwf/eccodes.git
Better error messages
This commit is contained in:
parent
1aa8016a54
commit
3ce066b60a
|
@ -193,7 +193,10 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
}
|
||||
range = (1 << bits_per_value) - 1 - max_level_value;
|
||||
if ((max_level_value <= 0) || (number_of_level_values <= 0) || (max_level_value > number_of_level_values) || (range <= 0)) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "parameters are invalid: max_level_value=%ld(>0, <=number_of_level_values), number_of_level_values=%ld(>0, >=max_level_value), range=%ld(>0)", max_level_value, number_of_level_values, range);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||
"data_run_length_packing: parameters are invalid: max_level_value=%ld(>0, <=number_of_level_values), "
|
||||
"number_of_level_values=%ld(>0, >=max_level_value), range=%ld(>0)",
|
||||
max_level_value, number_of_level_values, range);
|
||||
return GRIB_DECODING_ERROR;
|
||||
}
|
||||
if (decimal_scale_factor > 127) {
|
||||
|
@ -215,7 +218,10 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
i = 0;
|
||||
while (i < number_of_compressed_values) {
|
||||
if (compressed_values[i] > max_level_value) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "numberOfValues mismatch: i=%ld, compressed_values[i]=%ld, max_level_value=%ld", i, compressed_values[i], max_level_value);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||
"data_run_length_packing: numberOfValues mismatch: i=%d, "
|
||||
"compressed_values[i]=%ld, max_level_value=%ld",
|
||||
i, compressed_values[i], max_level_value);
|
||||
break;
|
||||
}
|
||||
v = compressed_values[i++];
|
||||
|
@ -227,7 +233,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
i++;
|
||||
}
|
||||
if (n > number_of_values) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "numberOfValues mismatch: n=%ld, number_of_values=%ld", n, number_of_values);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "data_run_length_packing: numberOfValues mismatch: n=%ld, number_of_values=%ld",
|
||||
n, number_of_values);
|
||||
break;
|
||||
}
|
||||
for (k = 0; k < n; k++) {
|
||||
|
@ -238,7 +245,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
grib_context_free(a->context, levels);
|
||||
grib_context_free(a->context, compressed_values);
|
||||
if (j != number_of_values) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "numberOfValues mismatch: j=%ld, number_of_values=%ld", j, number_of_values);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "data_run_length_packing: numberOfValues mismatch: j=%ld, number_of_values=%ld",
|
||||
j, number_of_values);
|
||||
return GRIB_DECODING_ERROR;
|
||||
}
|
||||
return err;
|
||||
|
|
Loading…
Reference in New Issue