Refactoring

This commit is contained in:
Shahram Najm 2018-07-05 16:50:55 +01:00
parent 0bfc9fe5bf
commit ceac055533
4 changed files with 8 additions and 10 deletions

View File

@ -199,7 +199,6 @@ void encode_double_array_unrolled(int numBits, long packStart, long datasize,
{
U_BYTEORDER;
long i, j, z = *gz;
double tmp;
#ifdef _ARCH_PWR6
#define __UNROLL_DEPTH_2 8
#else

View File

@ -140,16 +140,17 @@ static void init(grib_accessor* a, const long len , grib_arguments* arg )
long sectionLength;
grib_accessor_raw *self =(grib_accessor_raw*)a;
grib_expression* e;
grib_handle* hand = grib_handle_of_accessor(a);
a->length=0;
self->totalLength = grib_arguments_get_name(grib_handle_of_accessor(a),arg,n++);
self->sectionLength = grib_arguments_get_name(grib_handle_of_accessor(a),arg,n++);
self->totalLength = grib_arguments_get_name(hand,arg,n++);
self->sectionLength = grib_arguments_get_name(hand,arg,n++);
e=grib_arguments_get_expression(grib_handle_of_accessor(a), arg,n++);
grib_expression_evaluate_long(grib_handle_of_accessor(a),e,&(self->relativeOffset));
if (err) grib_context_log(grib_handle_of_accessor(a)->context,GRIB_LOG_FATAL,"unable to evaluate relativeOffset");
e=grib_arguments_get_expression(hand, arg,n++);
err = grib_expression_evaluate_long(hand,e,&(self->relativeOffset));
if (err) grib_context_log(hand->context,GRIB_LOG_ERROR,"unable to evaluate relativeOffset");
grib_get_long(grib_handle_of_accessor(a),self->sectionLength,&sectionLength);
grib_get_long(hand,self->sectionLength,&sectionLength);
a->length=sectionLength-self->relativeOffset;
if (a->length<0) a->length=0;

View File

@ -313,7 +313,7 @@ int grib_encode_unsigned_longb(unsigned char* p, unsigned long val ,long *bitp,
{
unsigned long maxV = grib_power(nb,2);
if (val > maxV) {
fprintf(stderr, "grib_encode_unsigned_longb: Value=%ld, but number of bits=%ld!\n", val, nb);
fprintf(stderr, "grib_encode_unsigned_longb: Value=%lu, but number of bits=%ld!\n", val, nb);
Assert(0);
}
}

View File

@ -35,7 +35,6 @@ static void grib_db_delete_columns(grib_db* db);
static int grib_db_columns_resize(grib_db* db,size_t newsize);
static int grib_db_column_copy_from_handle(grib_handle* h,grib_db* db,int i);
static grib_db* grib_db_create_from_keys(grib_context* c,char** keys,int nkeys,int* err);
static grib_db* grib_db_create_from_keys(grib_context* c,char** keys,int nkeys,int* err);
static void grib_fieldset* grib_db_fieldset_create(grib_db* db, int* err);
static int grib_fieldset_compare(grib_fieldset* set,int* i,int* j);
static void grib_db_sort(grib_set* set, int beg, int theEnd);
@ -286,7 +285,6 @@ static grib_db* grib_db_create_from_keys(grib_context* c,char** keys,int nkeys,i
size_t msize=0,size=0;
int i=0;
int type=0;
grib_context* c=NULL;
int default_type=GRIB_TYPE_DOUBLE;
if (!c) c=grib_context_get_default( );