From afbcfd0d627ccef47859bd3c8da5749301d83d26 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 28 Jan 2019 10:49:58 +0000 Subject: [PATCH] Clean up --- src/grib_accessor_class_g1verificationdate.c | 62 ++++++++++---------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/src/grib_accessor_class_g1verificationdate.c b/src/grib_accessor_class_g1verificationdate.c index 448fa8e47..5cc8177d3 100644 --- a/src/grib_accessor_class_g1verificationdate.c +++ b/src/grib_accessor_class_g1verificationdate.c @@ -137,53 +137,51 @@ static void init_class(grib_accessor_class* c) static void init(grib_accessor* a,const long l, grib_arguments* c) { - grib_accessor_g1verificationdate* self = (grib_accessor_g1verificationdate*)a; - int n = 0; + grib_accessor_g1verificationdate* self = (grib_accessor_g1verificationdate*)a; + int n = 0; - self->date = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++); - self->time = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++); - self->step = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++); + self->date = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++); + self->time = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++); + self->step = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; } static void dump(grib_accessor* a, grib_dumper* dumper) { - grib_dump_long(dumper,a,NULL); + grib_dump_long(dumper,a,NULL); } - static int unpack_long(grib_accessor* a, long* val, size_t *len) { - grib_accessor_g1verificationdate* self = (grib_accessor_g1verificationdate*)a; - int ret=0; - long date = 0; - long time = 0; - long cdate = 0; - long step = 0; - long vtime = 0; - long vdate = 0; - long vd = 0; + grib_accessor_g1verificationdate* self = (grib_accessor_g1verificationdate*)a; + int ret=0; + long date = 0; + long time = 0; + long cdate = 0; + long step = 0; + long vtime = 0; + long vdate = 0; + long vd = 0; - if ((ret=grib_get_long_internal(grib_handle_of_accessor(a), self->date,&date))!=GRIB_SUCCESS) return ret; - if ((ret=grib_get_long_internal(grib_handle_of_accessor(a), self->time,&time))!=GRIB_SUCCESS) return ret; - if ((ret=grib_get_long_internal(grib_handle_of_accessor(a), self->step,&step))!=GRIB_SUCCESS) return ret; + if ((ret=grib_get_long_internal(grib_handle_of_accessor(a), self->date,&date))!=GRIB_SUCCESS) return ret; + if ((ret=grib_get_long_internal(grib_handle_of_accessor(a), self->time,&time))!=GRIB_SUCCESS) return ret; + if ((ret=grib_get_long_internal(grib_handle_of_accessor(a), self->step,&step))!=GRIB_SUCCESS) return ret; - time /= 100; + time /= 100; - cdate = (long)grib_date_to_julian (date); - vtime = cdate * 24 + time + step; - vd = vtime / 24; - vdate = grib_julian_to_date (vd); + cdate = (long)grib_date_to_julian (date); + vtime = cdate * 24 + time + step; + vd = vtime / 24; + vdate = grib_julian_to_date (vd); - /* printf("\n********\n date %d, time %d, step %d, vdate: %d, cdate %d, vd %d\n********\n", date, time, step, vdate, cdate, vd); */ + /* printf("\n********\n date %d, time %d, step %d, vdate: %d, cdate %d, vd %d\n********\n", date, time, step, vdate, cdate, vd); */ - if(*len < 1) - return GRIB_ARRAY_TOO_SMALL; + if(*len < 1) + return GRIB_ARRAY_TOO_SMALL; - *val = vdate; + *val = vdate; - /* fprintf(stdout,"\n********\n %d cdate %d vd %d\n********\n", vdate, cdate, step); */ - return GRIB_SUCCESS; + /* fprintf(stdout,"\n********\n %d cdate %d vd %d\n********\n", vdate, cdate, step); */ + return GRIB_SUCCESS; } -