ECC-1414: Print error message when PNG is not enabled

This commit is contained in:
Shahram Najm 2022-06-22 14:53:05 +01:00
parent bf4018f5bd
commit 43bce2bc38
1 changed files with 18 additions and 6 deletions

View File

@ -742,19 +742,31 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array
#else
static int unpack_double(grib_accessor* a, double* val, size_t* len)
static void print_error_feature_not_enabled(grib_context* c)
{
grib_context_log(a->context, GRIB_LOG_ERROR,
grib_context_log(c, GRIB_LOG_ERROR,
"grib_accessor_data_png_packing: PNG support not enabled. "
"Please rebuild with -DENABLE_PNG=ON");
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
static int unpack_double(grib_accessor* a, double* val, size_t* len)
{
print_error_feature_not_enabled(a->context);
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
static int pack_double(grib_accessor* a, const double* val, size_t* len)
{
grib_context_log(a->context, GRIB_LOG_ERROR,
"grib_accessor_data_png_packing: PNG support not enabled. "
"Please rebuild with -DENABLE_PNG=ON");
print_error_feature_not_enabled(a->context);
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
static int unpack_double_element(grib_accessor* a, size_t idx, double* val)
{
print_error_feature_not_enabled(a->context);
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}
static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array)
{
print_error_feature_not_enabled(a->context);
return GRIB_FUNCTIONALITY_NOT_ENABLED;
}