ECC-1467: Minor changes

This commit is contained in:
Eugen Betke 2023-03-08 16:13:17 +00:00
parent 58ee3be165
commit 8425eeb03c
7 changed files with 10 additions and 26 deletions

View File

@ -41,7 +41,6 @@ or edit "accessor.class" and rerun ./make_class.pl
static int get_native_type(grib_accessor*);
static int pack_double(grib_accessor*, const double* val, size_t* len);
template <typename T> static int unpack(grib_accessor*, T* val, size_t* len);
static int unpack_double(grib_accessor*, double* val, size_t* len);
static int unpack_float(grib_accessor*, float* val, size_t* len);
static int value_count(grib_accessor*, long*);

View File

@ -50,7 +50,6 @@ or edit "accessor.class" and rerun ./make_class.pl
*/
static int pack_double(grib_accessor*, const double* val, size_t* len);
template <typename T> static int unpack(grib_accessor* a, T* val, size_t* len);
static int unpack_double(grib_accessor*, double* val, size_t* len);
static int unpack_float(grib_accessor*, float* val, size_t* len);
static int value_count(grib_accessor*, long*);

View File

@ -11,7 +11,6 @@
* Enrico Fucile
****************************/
#include "grib_api_internal.h"
#include "grib_api_internal_cpp.h"
#define PRE_PROCESSING_NONE 0

View File

@ -53,7 +53,6 @@ or edit "accessor.class" and rerun ./make_class.pl
*/
static int pack_double(grib_accessor*, const double* val, size_t* len);
template <typename T> static int unpack(grib_accessor* a, T* val, size_t* len);
static int unpack_double(grib_accessor*, double* val, size_t* len);
static int unpack_float(grib_accessor*, float* val, size_t* len);
static int value_count(grib_accessor*, long*);

View File

@ -314,16 +314,6 @@ static int unpack_long(grib_accessor* a, long* v, size_t* len)
return GRIB_NOT_IMPLEMENTED;
}
template <typename T> inline T _strtod(const char* val, char** last);
template <> inline float _strtod(const char* val, char** last) {
double v = strtod(val, last);
assert(v <= std::numeric_limits<float>::max());
return v;
}
template <> inline double _strtod(const char* val, char** last) {
return strtod(val, last);
}
template <typename T>
static int unpack(grib_accessor* a, T* v, size_t* len)
{
@ -343,7 +333,6 @@ static int unpack(grib_accessor* a, T* v, size_t* len)
char* last = NULL;
grib_unpack_string(a, val, &l);
//*v = _strtod<T>(val, &last);
*v = strtod(val, &last);
if (*last == 0) { /* conversion of string to double worked */
grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting string %s to long", a->name);

View File

@ -12,7 +12,6 @@
* Enrico Fucile *
***************************************************************************/
#include "grib_api_internal_cpp.h"
#include "grib_value.h"
#include <float.h>

View File

@ -51,8 +51,8 @@ int main(int argc, char** argv)
fvalues = (float*)malloc(values_len * sizeof(float));
dvalues = (double*)malloc(values_len * sizeof(double));
CODES_CHECK(codes_get_double_array(h, "values", dvalues, &values_len), 0);
CODES_CHECK(codes_get_float_array(h, "values", fvalues, &values_len), 0);
CODES_CHECK(codes_get_double_array(h, "values", dvalues, &values_len), 0);
for (i = 0; i < values_len; i++) {
abs_error = fabs(dvalues[i] - (double)fvalues[i]);