diff --git a/fortran/grib_fortran.c b/fortran/grib_fortran.c index f8a3fc08a..e3ce24556 100644 --- a/fortran/grib_fortran.c +++ b/fortran/grib_fortran.c @@ -2761,36 +2761,20 @@ int grib_f_get_real4(int* gid, char* key, float* val, int len){ return grib_f_get_real4_( gid, key, val, len); } -int grib_f_get_real4_array_(int* gid, char* key, float *val, int* size, int len) +int grib_f_get_real4_array_(int* gid, char* key, float *val, int* size, int len) { grib_handle *h = get_handle(*gid); int err = GRIB_SUCCESS; char buf[1024]; size_t lsize = *size; - double* val8 = NULL; - size_t i; - if(!h) return GRIB_INVALID_GRIB; - - if(*size) - val8 = (double*)grib_context_malloc(h->context,(*size)*(sizeof(double))); - else - val8 = (double*)grib_context_malloc(h->context,sizeof(double)); - - if(!val8) return GRIB_OUT_OF_MEMORY; - - err = grib_get_double_array(h, cast_char(buf,key,len), val8, &lsize); - if (err) { - grib_context_free(h->context,val8); - return err; + if(!h){ + return GRIB_INVALID_GRIB; + }else{ + err = grib_get_float_array(h, cast_char(buf,key,len), val, &lsize); + *size = lsize; + return err; } - - for(i=0;icontext,val8); - - return err; } int grib_f_get_real4_array__(int* gid, char* key, float* val, int* size, int len){ return grib_f_get_real4_array_( gid, key, val, size, len); @@ -2800,7 +2784,7 @@ int grib_f_get_real4_array(int* gid, char* key, float* val, int* size, int len){ } /*****************************************************************************/ -int grib_f_set_force_real4_array_(int* gid, char* key, float*val, int* size, int len) +int grib_f_set_force_real4_array_(int* gid, char* key, float* val, int* size, int len) { grib_handle *h = get_handle(*gid); int err = GRIB_SUCCESS;