Add assertion and clean up indents

This commit is contained in:
Shahram Najm 2013-07-23 17:21:08 +01:00
parent 3d6ebcfaf3
commit 6c03d54a38
9 changed files with 1032 additions and 1030 deletions

View File

@ -9,10 +9,9 @@
*/
/**************************************
* Enrico Fucile
* This pertains to GRIB edition 2
**************************************/
#include "grib_api_internal.h"
/*
This is used by make_class.pl
@ -162,17 +161,15 @@ static void init(grib_accessor* a,const long l, grib_arguments* c)
self->eps = grib_arguments_get_name(a->parent->h,c,n++);
self->stepType = grib_arguments_get_name(a->parent->h,c,n++);
self->derivedForecast = grib_arguments_get_name(a->parent->h,c,n++);
}
static int unpack_long (grib_accessor* a, long* val, size_t *len)
static int unpack_long(grib_accessor* a, long* val, size_t *len)
{
grib_accessor_local_definition* self = (grib_accessor_local_definition*)a;
return grib_get_long(a->parent->h, self->grib2LocalSectionNumber,val);
}
static int pack_long(grib_accessor* a, const long* val, size_t *len)
{
grib_accessor_local_definition* self = (grib_accessor_local_definition*)a;
@ -190,6 +187,11 @@ static int pack_long(grib_accessor* a, const long* val, size_t *len)
int isInstant=0;
int tooEarly=0;
long derivedForecast=-1;
long editionNumber = 0;
if (grib_get_long(a->parent->h, "editionNumber", &editionNumber)==GRIB_SUCCESS) {
Assert(editionNumber == 2);
}
if (grib_get_long(a->parent->h, self->productDefinitionTemplateNumber,&productDefinitionTemplateNumber)!=GRIB_SUCCESS)
tooEarly=1;

View File

@ -153,16 +153,16 @@ static void dump_values(grib_dumper* d,grib_accessor* a)
if (values[i] == missing_value)
fprintf(self->dumper.out, "%s, ", "null");
else
fprintf(self->dumper.out,"%g, ",values[i]);
fprintf(self->dumper.out, "%g, ", values[i]);
count++;
}
if (count>cols) fprintf(self->dumper.out,"\n%-*s",tab," ");
if (values[i] == missing_value)
fprintf(self->dumper.out, "%s ","null");
else
fprintf(self->dumper.out,"%g ",values[i]);
fprintf(self->dumper.out, "%g ",values[i]);
if (more)
fprintf(self->dumper.out,"\n%-*s... %ld more values",tab," ",more);
fprintf(self->dumper.out, "\n%-*s... %ld more values", tab, " ", more);
tab=lens+mydepth+5;
fprintf(self->dumper.out,"\n%-*s] ",tab," ");

View File

@ -21,7 +21,7 @@ int grib_nearest_find(
double inlat, double inlon,
unsigned long flags,
double* outlats,double* outlons,
double* values,double* distances, int* indexes, size_t *len)
double* values, double* distances, int* indexes, size_t *len)
{
grib_nearest_class *c = nearest->cclass;
Assert( flags <= (GRIB_NEAREST_SAME_GRID|GRIB_NEAREST_SAME_DATA|GRIB_NEAREST_SAME_POINT) );