mirror of https://github.com/ecmwf/eccodes.git
Indentation
This commit is contained in:
parent
9cfdcf506e
commit
4a725d1ee9
|
@ -79,14 +79,14 @@ static void init_class(grib_action_class* c)
|
|||
/* new GCC compiler v4.5.0 complains function is defined but not used*/
|
||||
static void check_sections(grib_section *s,grib_handle* h)
|
||||
{
|
||||
grib_accessor *a = s?s->block->first:NULL;
|
||||
if(s) Assert(s->h == h);
|
||||
while(a)
|
||||
{
|
||||
Assert(grib_handle_of_accessor(a) == h);
|
||||
check_sections(a->sub_section,h);
|
||||
a = a->next;
|
||||
}
|
||||
grib_accessor *a = s?s->block->first:NULL;
|
||||
if(s) Assert(s->h == h);
|
||||
while(a)
|
||||
{
|
||||
Assert(grib_handle_of_accessor(a) == h);
|
||||
check_sections(a->sub_section,h);
|
||||
a = a->next;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -137,156 +137,159 @@ static void init_class(grib_accessor_class* c)
|
|||
|
||||
static void init(grib_accessor* a, const long len , grib_arguments* arg )
|
||||
{
|
||||
a->length = len;
|
||||
Assert(a->length>=0);
|
||||
a->length = len;
|
||||
Assert(a->length>=0);
|
||||
}
|
||||
|
||||
static int value_count(grib_accessor* a,long* count){
|
||||
*count=1;
|
||||
return 0;
|
||||
static int value_count(grib_accessor* a,long* count)
|
||||
{
|
||||
*count=1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static size_t string_length(grib_accessor* a){
|
||||
return a->length;
|
||||
static size_t string_length(grib_accessor* a)
|
||||
{
|
||||
return a->length;
|
||||
}
|
||||
|
||||
static void dump(grib_accessor* a, grib_dumper* dumper)
|
||||
{
|
||||
grib_dump_string(dumper,a,NULL);
|
||||
grib_dump_string(dumper,a,NULL);
|
||||
}
|
||||
|
||||
static int get_native_type(grib_accessor* a){
|
||||
return GRIB_TYPE_STRING;
|
||||
static int get_native_type(grib_accessor* a)
|
||||
{
|
||||
return GRIB_TYPE_STRING;
|
||||
}
|
||||
|
||||
static int unpack_string(grib_accessor* a, char* val, size_t *len)
|
||||
{
|
||||
int i = 0;
|
||||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
int i = 0;
|
||||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
|
||||
if(len[0] < (a->length+1))
|
||||
{
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%d) for %s it contains %d values ", len[0], a->name , a->length+1 );
|
||||
len[0] = 0;
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
}
|
||||
if(len[0] < (a->length+1))
|
||||
{
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%d) for %s it contains %d values ", len[0], a->name , a->length+1 );
|
||||
len[0] = 0;
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
}
|
||||
|
||||
for ( i = 0; i < a->length; i++)
|
||||
val[i] = hand->buffer->data[a->offset+i];
|
||||
val[i] = 0;
|
||||
len[0] = i;
|
||||
return GRIB_SUCCESS;
|
||||
for ( i = 0; i < a->length; i++)
|
||||
val[i] = hand->buffer->data[a->offset+i];
|
||||
val[i] = 0;
|
||||
len[0] = i;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
static int pack_string(grib_accessor* a, const char* val, size_t *len)
|
||||
{
|
||||
int i = 0;
|
||||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
if(len[0] > (a->length)+1)
|
||||
{
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "pack_string: Wrong size (%d) for %s it contains %d values ", len[0], a->name , a->length+1 );
|
||||
len[0] = 0;
|
||||
return GRIB_BUFFER_TOO_SMALL;
|
||||
}
|
||||
int i = 0;
|
||||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
if(len[0] > (a->length)+1)
|
||||
{
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "pack_string: Wrong size (%d) for %s it contains %d values ", len[0], a->name , a->length+1 );
|
||||
len[0] = 0;
|
||||
return GRIB_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
for ( i = 0; i < a->length; i++)
|
||||
{
|
||||
if( i < len[0] )
|
||||
hand->buffer->data[a->offset+i] = val[i];
|
||||
else
|
||||
hand->buffer->data[a->offset+i] = 0;
|
||||
}
|
||||
for ( i = 0; i < a->length; i++)
|
||||
{
|
||||
if( i < len[0] )
|
||||
hand->buffer->data[a->offset+i] = val[i];
|
||||
else
|
||||
hand->buffer->data[a->offset+i] = 0;
|
||||
}
|
||||
|
||||
return GRIB_SUCCESS;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
static int pack_long(grib_accessor* a, const long* v, size_t *len){
|
||||
grib_context_log(a->context,GRIB_LOG_ERROR, " Should not pack %s as long", a->name);
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
static int pack_long(grib_accessor* a, const long* v, size_t *len)
|
||||
{
|
||||
grib_context_log(a->context,GRIB_LOG_ERROR, " Should not pack %s as long", a->name);
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int pack_double(grib_accessor* a, const double*v, size_t *len){
|
||||
grib_context_log(a->context,GRIB_LOG_ERROR, " Should not pack %s as double", a->name);
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
static int pack_double(grib_accessor* a, const double*v, size_t *len)
|
||||
{
|
||||
grib_context_log(a->context,GRIB_LOG_ERROR, " Should not pack %s as double", a->name);
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int unpack_long (grib_accessor* a, long* v, size_t *len)
|
||||
{
|
||||
char val[1024]={0,};
|
||||
size_t l = sizeof(val);
|
||||
size_t i =0;
|
||||
char *last = NULL;
|
||||
int err=grib_unpack_string (a , val, &l);
|
||||
|
||||
static int unpack_long (grib_accessor* a, long* v, size_t *len){
|
||||
if (err) return err;
|
||||
|
||||
char val[1024]={0,};
|
||||
size_t l = sizeof(val);
|
||||
size_t i =0;
|
||||
char *last = NULL;
|
||||
int err=grib_unpack_string (a , val, &l);
|
||||
i=0;
|
||||
while ( val[i]==' ' && val[i]!=0 && i<l-1) i++;
|
||||
|
||||
if (err) return err;
|
||||
if (val[i]==0) {
|
||||
*v=0;
|
||||
return 0;
|
||||
}
|
||||
if (val[i+1]==' ' && i<l-2) val[i+1]=0;
|
||||
|
||||
i=0;
|
||||
while ( val[i]==' ' && val[i]!=0 && i<l-1) i++;
|
||||
*v = strtol(val,&last,10);
|
||||
|
||||
if (val[i]==0) {
|
||||
*v=0;
|
||||
return 0;
|
||||
}
|
||||
if (val[i+1]==' ' && i<l-2) val[i+1]=0;
|
||||
|
||||
*v = strtol(val,&last,10);
|
||||
|
||||
grib_context_log(a->context,GRIB_LOG_DEBUG, " Casting string %s to long", a->name);
|
||||
return GRIB_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
static int unpack_double (grib_accessor* a, double*v, size_t *len){
|
||||
char val[1024];
|
||||
size_t l = sizeof(val);
|
||||
char *last = NULL;
|
||||
grib_unpack_string (a , val, &l);
|
||||
|
||||
*v = strtod(val,&last);
|
||||
|
||||
if(*last == 0)
|
||||
{
|
||||
grib_context_log(a->context,GRIB_LOG_DEBUG, " Casting string %s to long", a->name);
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int unpack_double (grib_accessor* a, double*v, size_t *len)
|
||||
{
|
||||
char val[1024];
|
||||
size_t l = sizeof(val);
|
||||
char *last = NULL;
|
||||
grib_unpack_string (a , val, &l);
|
||||
|
||||
static int compare(grib_accessor* a,grib_accessor* b) {
|
||||
int retval=0;
|
||||
char *aval=0;
|
||||
char *bval=0;
|
||||
int err=0;
|
||||
*v = strtod(val,&last);
|
||||
|
||||
size_t alen = 0;
|
||||
size_t blen = 0;
|
||||
long count=0;
|
||||
if(*last == 0)
|
||||
{
|
||||
grib_context_log(a->context,GRIB_LOG_DEBUG, " Casting string %s to long", a->name);
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
err=grib_value_count(a,&count);
|
||||
if (err) return err;
|
||||
alen=count;
|
||||
|
||||
err=grib_value_count(b,&count);
|
||||
if (err) return err;
|
||||
blen=count;
|
||||
|
||||
if (alen != blen) return GRIB_COUNT_MISMATCH;
|
||||
|
||||
aval=(char*)grib_context_malloc(a->context,alen*sizeof(char));
|
||||
bval=(char*)grib_context_malloc(b->context,blen*sizeof(char));
|
||||
|
||||
grib_unpack_string(a,aval,&alen);
|
||||
grib_unpack_string(b,bval,&blen);
|
||||
|
||||
retval = GRIB_SUCCESS;
|
||||
if (strcmp(aval,bval)) retval = GRIB_STRING_VALUE_MISMATCH;
|
||||
|
||||
grib_context_free(a->context,aval);
|
||||
grib_context_free(b->context,bval);
|
||||
|
||||
return retval;
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int compare(grib_accessor* a,grib_accessor* b)
|
||||
{
|
||||
int retval=0;
|
||||
char *aval=0;
|
||||
char *bval=0;
|
||||
int err=0;
|
||||
|
||||
size_t alen = 0;
|
||||
size_t blen = 0;
|
||||
long count=0;
|
||||
|
||||
err=grib_value_count(a,&count);
|
||||
if (err) return err;
|
||||
alen=count;
|
||||
|
||||
err=grib_value_count(b,&count);
|
||||
if (err) return err;
|
||||
blen=count;
|
||||
|
||||
if (alen != blen) return GRIB_COUNT_MISMATCH;
|
||||
|
||||
aval=(char*)grib_context_malloc(a->context,alen*sizeof(char));
|
||||
bval=(char*)grib_context_malloc(b->context,blen*sizeof(char));
|
||||
|
||||
grib_unpack_string(a,aval,&alen);
|
||||
grib_unpack_string(b,bval,&blen);
|
||||
|
||||
retval = GRIB_SUCCESS;
|
||||
if (strcmp(aval,bval)) retval = GRIB_STRING_VALUE_MISMATCH;
|
||||
|
||||
grib_context_free(a->context,aval);
|
||||
grib_context_free(b->context,bval);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -137,114 +137,115 @@ static void init_class(grib_accessor_class* c)
|
|||
|
||||
static void init(grib_accessor* a,const long l, grib_arguments* c)
|
||||
{
|
||||
grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a;
|
||||
int n = 0;
|
||||
grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a;
|
||||
int n = 0;
|
||||
|
||||
self->verifyingMonth = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
|
||||
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
||||
a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION;
|
||||
a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN;
|
||||
self->verifyingMonth = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
|
||||
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
||||
a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION;
|
||||
a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN;
|
||||
|
||||
self->number_of_elements=6;
|
||||
self->v=(double*)grib_context_malloc(a->context,
|
||||
sizeof(double)*self->number_of_elements);
|
||||
self->number_of_elements=6;
|
||||
self->v=(double*)grib_context_malloc(a->context,
|
||||
sizeof(double)*self->number_of_elements);
|
||||
|
||||
a->length=0;
|
||||
a->dirty=1;
|
||||
a->length=0;
|
||||
a->dirty=1;
|
||||
}
|
||||
|
||||
static int unpack_double (grib_accessor* a, double* val, size_t *len)
|
||||
{
|
||||
grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a;
|
||||
int ret = 0;
|
||||
char verifyingMonth[7]={0,};
|
||||
size_t slen=7;
|
||||
long year=0,month=0,date=0;
|
||||
long mdays[]={31,28,31,30,31,30,31,31,30,31,30,31};
|
||||
long days=0;
|
||||
grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a;
|
||||
int ret = 0;
|
||||
char verifyingMonth[7]={0,};
|
||||
size_t slen=7;
|
||||
long year=0,month=0,date=0;
|
||||
long mdays[]={31,28,31,30,31,30,31,31,30,31,30,31};
|
||||
long days=0;
|
||||
|
||||
if (!a->dirty) return GRIB_SUCCESS;
|
||||
if (!a->dirty) return GRIB_SUCCESS;
|
||||
|
||||
if((ret=grib_get_string(grib_handle_of_accessor(a),self->verifyingMonth,verifyingMonth,&slen))
|
||||
!= GRIB_SUCCESS) return ret;
|
||||
if((ret=grib_get_string(grib_handle_of_accessor(a),self->verifyingMonth,verifyingMonth,&slen))
|
||||
!= GRIB_SUCCESS) return ret;
|
||||
|
||||
date=atoi(verifyingMonth);
|
||||
year=date/100;
|
||||
month=date-year*100;
|
||||
if ( month == 2 ) {
|
||||
days=28;
|
||||
if (year%400 == 0 || ( year%4 == 0 && year%100 != 0) ) days=29;
|
||||
} else days=mdays[month-1];
|
||||
date=atoi(verifyingMonth);
|
||||
year=date/100;
|
||||
month=date-year*100;
|
||||
if ( month == 2 ) {
|
||||
days=28;
|
||||
if (year%400 == 0 || ( year%4 == 0 && year%100 != 0) ) days=29;
|
||||
} else days=mdays[month-1];
|
||||
|
||||
self->v[0]=year;
|
||||
self->v[1]=month;
|
||||
|
||||
self->v[2]=days;
|
||||
self->v[3]=24;
|
||||
self->v[4]=00;
|
||||
self->v[5]=00;
|
||||
self->v[0]=year;
|
||||
self->v[1]=month;
|
||||
|
||||
a->dirty=0;
|
||||
self->v[2]=days;
|
||||
self->v[3]=24;
|
||||
self->v[4]=00;
|
||||
self->v[5]=00;
|
||||
|
||||
val[0]=self->v[0];
|
||||
val[1]=self->v[1];
|
||||
val[2]=self->v[2];
|
||||
val[3]=self->v[3];
|
||||
val[4]=self->v[4];
|
||||
val[5]=self->v[5];
|
||||
a->dirty=0;
|
||||
|
||||
return ret;
|
||||
val[0]=self->v[0];
|
||||
val[1]=self->v[1];
|
||||
val[2]=self->v[2];
|
||||
val[3]=self->v[3];
|
||||
val[4]=self->v[4];
|
||||
val[5]=self->v[5];
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int value_count(grib_accessor* a,long *count)
|
||||
{
|
||||
grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a;
|
||||
*count=self->number_of_elements;
|
||||
return 0;
|
||||
grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a;
|
||||
*count=self->number_of_elements;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void destroy(grib_context* c,grib_accessor* a)
|
||||
{
|
||||
grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a;
|
||||
grib_context_free(c,self->v);
|
||||
grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a;
|
||||
grib_context_free(c,self->v);
|
||||
}
|
||||
|
||||
static int compare(grib_accessor* a, grib_accessor* b) {
|
||||
int retval = GRIB_SUCCESS;
|
||||
double *aval=0;
|
||||
double *bval=0;
|
||||
static int compare(grib_accessor* a, grib_accessor* b)
|
||||
{
|
||||
int retval = GRIB_SUCCESS;
|
||||
double *aval=0;
|
||||
double *bval=0;
|
||||
|
||||
long count=0;
|
||||
size_t alen = 0;
|
||||
size_t blen = 0;
|
||||
int err=0;
|
||||
long count=0;
|
||||
size_t alen = 0;
|
||||
size_t blen = 0;
|
||||
int err=0;
|
||||
|
||||
err=grib_value_count(a,&count);
|
||||
if (err) return err;
|
||||
alen=count;
|
||||
err=grib_value_count(a,&count);
|
||||
if (err) return err;
|
||||
alen=count;
|
||||
|
||||
err=grib_value_count(b,&count);
|
||||
if (err) return err;
|
||||
blen=count;
|
||||
err=grib_value_count(b,&count);
|
||||
if (err) return err;
|
||||
blen=count;
|
||||
|
||||
if (alen != blen) return GRIB_COUNT_MISMATCH;
|
||||
if (alen != blen) return GRIB_COUNT_MISMATCH;
|
||||
|
||||
aval=(double*)grib_context_malloc(a->context,alen*sizeof(double));
|
||||
bval=(double*)grib_context_malloc(b->context,blen*sizeof(double));
|
||||
aval=(double*)grib_context_malloc(a->context,alen*sizeof(double));
|
||||
bval=(double*)grib_context_malloc(b->context,blen*sizeof(double));
|
||||
|
||||
b->dirty=1;
|
||||
a->dirty=1;
|
||||
b->dirty=1;
|
||||
a->dirty=1;
|
||||
|
||||
grib_unpack_double(a,aval,&alen);
|
||||
grib_unpack_double(b,bval,&blen);
|
||||
grib_unpack_double(a,aval,&alen);
|
||||
grib_unpack_double(b,bval,&blen);
|
||||
|
||||
while (alen != 0) {
|
||||
if (*bval != *aval) retval = GRIB_DOUBLE_VALUE_MISMATCH;
|
||||
alen--;
|
||||
}
|
||||
while (alen != 0) {
|
||||
if (*bval != *aval) retval = GRIB_DOUBLE_VALUE_MISMATCH;
|
||||
alen--;
|
||||
}
|
||||
|
||||
grib_context_free(a->context,aval);
|
||||
grib_context_free(b->context,bval);
|
||||
grib_context_free(a->context,aval);
|
||||
grib_context_free(b->context,bval);
|
||||
|
||||
return retval;
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -132,96 +132,91 @@ static void init_class(grib_accessor_class* c)
|
|||
|
||||
/* END_CLASS_IMP */
|
||||
|
||||
|
||||
|
||||
|
||||
static void init(grib_accessor* a, const long len , grib_arguments* arg )
|
||||
{
|
||||
a->sub_section = grib_section_create(grib_handle_of_accessor(a),a);
|
||||
a->length = 0;
|
||||
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
||||
a->sub_section = grib_section_create(grib_handle_of_accessor(a),a);
|
||||
a->length = 0;
|
||||
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
||||
}
|
||||
|
||||
static void dump(grib_accessor* a, grib_dumper* dumper)
|
||||
{
|
||||
grib_dump_section(dumper,a,a->sub_section->block);
|
||||
grib_dump_section(dumper,a,a->sub_section->block);
|
||||
}
|
||||
|
||||
static long byte_count(grib_accessor* a)
|
||||
{
|
||||
|
||||
if( !a->length || grib_handle_of_accessor(a)->loader )
|
||||
{
|
||||
if(a->name[1]=='_') return 0;
|
||||
if( !a->length || grib_handle_of_accessor(a)->loader )
|
||||
{
|
||||
if(a->name[1]=='_') return 0;
|
||||
|
||||
/* printf("adjusting sizes SECTION %s is %ld %ld\n",a->name,(long)a->offset,(long)a->length); */
|
||||
grib_section_adjust_sizes(a->sub_section,grib_handle_of_accessor(a)->loader != NULL,0);
|
||||
/* printf(" SECTION %s is %ld %ld\n",a->name,(long)a->offset,(long)a->length); */
|
||||
}
|
||||
/* printf("adjusting sizes SECTION %s is %ld %ld\n",a->name,(long)a->offset,(long)a->length); */
|
||||
grib_section_adjust_sizes(a->sub_section,grib_handle_of_accessor(a)->loader != NULL,0);
|
||||
/* printf(" SECTION %s is %ld %ld\n",a->name,(long)a->offset,(long)a->length); */
|
||||
}
|
||||
|
||||
|
||||
/* printf("SECTION %s is %ld %d\n",a->name,a->length,a->sub_section->aclength != NULL); */
|
||||
|
||||
return a->length;
|
||||
/* printf("SECTION %s is %ld %d\n",a->name,a->length,a->sub_section->aclength != NULL); */
|
||||
return a->length;
|
||||
}
|
||||
|
||||
static long next_offset(grib_accessor* a)
|
||||
{
|
||||
return a->offset + byte_count(a);
|
||||
return a->offset + byte_count(a);
|
||||
}
|
||||
|
||||
static void destroy(grib_context* ct, grib_accessor* a)
|
||||
{
|
||||
grib_section_delete(ct,a->sub_section);
|
||||
grib_section_delete(ct,a->sub_section);
|
||||
}
|
||||
|
||||
static int get_native_type(grib_accessor* a){
|
||||
return GRIB_TYPE_SECTION;
|
||||
static int get_native_type(grib_accessor* a)
|
||||
{
|
||||
return GRIB_TYPE_SECTION;
|
||||
}
|
||||
|
||||
static grib_section* sub_section(grib_accessor* a){
|
||||
/* grib_accessor_section* self = (grib_accessor_section*)a; */
|
||||
return a->sub_section;
|
||||
static grib_section* sub_section(grib_accessor* a)
|
||||
{
|
||||
/* grib_accessor_section* self = (grib_accessor_section*)a; */
|
||||
return a->sub_section;
|
||||
}
|
||||
|
||||
|
||||
static void update_size(grib_accessor* a,size_t length)
|
||||
{
|
||||
size_t size = 1;
|
||||
long len = length;
|
||||
Assert(length <= 0x7fffffff);
|
||||
if(a->sub_section->aclength)
|
||||
{
|
||||
int e=grib_pack_long(a->sub_section->aclength,&len,&size);
|
||||
Assert( e == GRIB_SUCCESS);
|
||||
printf("update_length %s %ld %ld\n",a->sub_section->aclength->name,
|
||||
(long)a->sub_section->aclength->offset,
|
||||
(long)a->sub_section->aclength->length
|
||||
|
||||
size_t size = 1;
|
||||
long len = length;
|
||||
Assert(length <= 0x7fffffff);
|
||||
if(a->sub_section->aclength)
|
||||
{
|
||||
int e=grib_pack_long(a->sub_section->aclength,&len,&size);
|
||||
Assert( e == GRIB_SUCCESS);
|
||||
printf("update_length %s %ld %ld\n",a->sub_section->aclength->name,
|
||||
(long)a->sub_section->aclength->offset,
|
||||
(long)a->sub_section->aclength->length
|
||||
);
|
||||
}
|
||||
|
||||
);
|
||||
}
|
||||
a->sub_section->length = a->length = length;
|
||||
a->sub_section->padding = 0;
|
||||
|
||||
a->sub_section->length = a->length = length;
|
||||
a->sub_section->padding = 0;
|
||||
printf("update_size %s %ld\n",a->name,a->length);
|
||||
|
||||
printf("update_size %s %ld\n",a->name,a->length);
|
||||
|
||||
Assert(a->length>=0);
|
||||
Assert(a->length>=0);
|
||||
}
|
||||
|
||||
static grib_accessor* next(grib_accessor* a,int explore) {
|
||||
grib_accessor* next=NULL;
|
||||
if (explore) {
|
||||
next=a->sub_section->block->first;
|
||||
if (!next) next=a->next;
|
||||
} else {
|
||||
next=a->next;
|
||||
}
|
||||
if (!next) {
|
||||
if (a->parent->owner)
|
||||
next=a->parent->owner->cclass->next(a->parent->owner,0);
|
||||
}
|
||||
return next;
|
||||
static grib_accessor* next(grib_accessor* a,int explore)
|
||||
{
|
||||
grib_accessor* next=NULL;
|
||||
if (explore) {
|
||||
next=a->sub_section->block->first;
|
||||
if (!next) next=a->next;
|
||||
} else {
|
||||
next=a->next;
|
||||
}
|
||||
if (!next) {
|
||||
if (a->parent->owner)
|
||||
next=a->parent->owner->cclass->next(a->parent->owner,0);
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue