mirror of https://github.com/ecmwf/eccodes.git
Remove compiler warnings
This commit is contained in:
parent
0bcd6672b4
commit
544359d19f
|
@ -106,7 +106,6 @@ grib_action* grib_action_create_write( grib_context* context, const char* name,i
|
|||
|
||||
static int execute(grib_action* act, grib_handle *h)
|
||||
{
|
||||
int ioerr = 0;
|
||||
grib_action_write* a = (grib_action_write*) act;
|
||||
int err = GRIB_SUCCESS;
|
||||
size_t size;
|
||||
|
@ -138,7 +137,6 @@ static int execute(grib_action* act, grib_handle *h)
|
|||
|
||||
if (h->gts_header) {
|
||||
if (fwrite(h->gts_header, 1, h->gts_header_len, of->handle) != h->gts_header_len) {
|
||||
ioerr = errno;
|
||||
grib_context_log(act->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR),
|
||||
"Error writing GTS header to %s", filename);
|
||||
return GRIB_IO_PROBLEM;
|
||||
|
@ -146,7 +144,6 @@ static int execute(grib_action* act, grib_handle *h)
|
|||
}
|
||||
|
||||
if (fwrite(buffer, 1, size, of->handle) != size) {
|
||||
ioerr = errno;
|
||||
grib_context_log(act->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR),
|
||||
"Error writing to %s", filename);
|
||||
return GRIB_IO_PROBLEM;
|
||||
|
@ -158,7 +155,6 @@ static int execute(grib_action* act, grib_handle *h)
|
|||
/* printf("XXX padding=%d size=%d padtomultiple=%d\n",padding,size,a->padtomultiple); */
|
||||
zeros = (char*)calloc(padding, 1);
|
||||
if (fwrite(zeros, 1, padding, of->handle) != padding) {
|
||||
ioerr = errno;
|
||||
grib_context_log(act->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR),
|
||||
"Error writing to %s", filename);
|
||||
free(zeros);
|
||||
|
@ -170,7 +166,6 @@ static int execute(grib_action* act, grib_handle *h)
|
|||
if (h->gts_header) {
|
||||
char gts_trailer[4] = { '\x0D', '\x0D', '\x0A', '\x03' };
|
||||
if (fwrite(gts_trailer, 1, 4, of->handle) != 4) {
|
||||
ioerr = errno;
|
||||
grib_context_log(act->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR),
|
||||
"Error writing GTS trailer to %s", filename);
|
||||
return GRIB_IO_PROBLEM;
|
||||
|
|
|
@ -231,7 +231,7 @@ static const char* concept_evaluate(grib_accessor* a)
|
|||
{
|
||||
int match = 0;
|
||||
const char* best = 0;
|
||||
const char* prev = 0;
|
||||
/* const char* prev = 0; */
|
||||
grib_concept_value* c = action_concept_get_concept(a);
|
||||
grib_handle* h=grib_handle_of_accessor(a);
|
||||
|
||||
|
@ -249,7 +249,7 @@ static const char* concept_evaluate(grib_accessor* a)
|
|||
if(e == NULL)
|
||||
{
|
||||
if(cnt >= match) {
|
||||
prev = (cnt > match) ? NULL : best;
|
||||
/* prev = (cnt > match) ? NULL : best; */
|
||||
match = cnt;
|
||||
best = c->name;
|
||||
}
|
||||
|
|
|
@ -237,7 +237,8 @@ static const unsigned char left_mask[8]={0,0x80,0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0x
|
|||
static const unsigned char right_mask[8]={0,0x80,0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe };
|
||||
|
||||
static unsigned char* bitmap_pop_line(unsigned char* bitmap,long* bitmap_len,int *bit_offset,
|
||||
long points_in_line,int *values_in_line) {
|
||||
long points_in_line,int *values_in_line)
|
||||
{
|
||||
unsigned char* p=bitmap;
|
||||
int m=0,bits=0;
|
||||
int bytes=0;
|
||||
|
@ -270,7 +271,8 @@ static unsigned char* bitmap_pop_line(unsigned char* bitmap,long* bitmap_len,int
|
|||
}
|
||||
|
||||
static int reverse_rows (unsigned long* data, long len, long number_along_parallel,
|
||||
unsigned char* bitmap,long bitmap_len){
|
||||
unsigned char* bitmap,long bitmap_len)
|
||||
{
|
||||
long count = 0;
|
||||
long i = 0;
|
||||
long left = 0;
|
||||
|
@ -341,11 +343,9 @@ static int reverse_rows (unsigned long* data, long len, long number_along_paral
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int spatial_difference (grib_context *c, unsigned long* vals, long len, long order, long* bias){
|
||||
|
||||
static int spatial_difference (grib_context *c, unsigned long* vals, long len, long order, long* bias)
|
||||
{
|
||||
long j = 3;
|
||||
|
||||
long *v = (long*)grib_context_malloc(c,(len)*sizeof(long));
|
||||
|
||||
for(j = 0; j< len;j++)
|
||||
|
@ -353,7 +353,6 @@ static int spatial_difference (grib_context *c, unsigned long* vals, long
|
|||
|
||||
Assert(order == 2);
|
||||
|
||||
|
||||
*bias=v[order];
|
||||
|
||||
for(j = order; j< len;j++){
|
||||
|
@ -372,10 +371,9 @@ static int spatial_difference (grib_context *c, unsigned long* vals, long
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int de_spatial_difference (grib_context *c, unsigned long* vals, long len, long order, long bias){
|
||||
|
||||
static int de_spatial_difference (grib_context *c, unsigned long* vals, long len, long order, long bias)
|
||||
{
|
||||
long j = 0;
|
||||
|
||||
long i_origin = 0;
|
||||
long i_first_diff = 0;
|
||||
long i_second_diff = 0;
|
||||
|
@ -544,43 +542,38 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
|
|||
|
||||
/* I have everything now start decoding */
|
||||
/*
|
||||
fprintf(stdout,"\n****************************************\n");
|
||||
fprintf(stdout," bits_per_value = %ld\n", bits_per_value);
|
||||
fprintf(stdout," reference_value = %g\n", reference_value);
|
||||
fprintf(stdout," binary_scale_factor = %ld\n", binary_scale_factor);
|
||||
fprintf(stdout," decimal_scale_factor = %ld\n", decimal_scale_factor);
|
||||
fprintf(stdout," n1 = %ld\n", n1);
|
||||
fprintf(stdout," n2 = %ld\n", n2);
|
||||
fprintf(stdout," p1 = %ld\n", p1);
|
||||
fprintf(stdout," p2 = %ld\n", p2);
|
||||
fprintf(stdout," matrix_values = %ld\n", matrix_values);
|
||||
fprintf(stdout," snd_bitmap = %ld\n", snd_bitmap);
|
||||
fprintf(stdout," snd_ordr_wdiff = %ld\n", snd_ordr_wdiff);
|
||||
fprintf(stdout," general_ext = %ld\n", general_ext);
|
||||
fprintf(stdout," boustrophedonic = %ld\n", boustrophedonic);
|
||||
fprintf(stdout," two_ordr_spd = %ld \n", two_ordr_spd);
|
||||
fprintf(stdout,"\n****************************************\n");
|
||||
fprintf(stdout," bits_per_value = %ld\n", bits_per_value);
|
||||
fprintf(stdout," reference_value = %g\n", reference_value);
|
||||
fprintf(stdout," binary_scale_factor = %ld\n", binary_scale_factor);
|
||||
fprintf(stdout," decimal_scale_factor = %ld\n", decimal_scale_factor);
|
||||
fprintf(stdout," n1 = %ld\n", n1);
|
||||
fprintf(stdout," n2 = %ld\n", n2);
|
||||
fprintf(stdout," p1 = %ld\n", p1);
|
||||
fprintf(stdout," p2 = %ld\n", p2);
|
||||
fprintf(stdout," matrix_values = %ld\n", matrix_values);
|
||||
fprintf(stdout," snd_bitmap = %ld\n", snd_bitmap);
|
||||
fprintf(stdout," snd_ordr_wdiff = %ld\n", snd_ordr_wdiff);
|
||||
fprintf(stdout," general_ext = %ld\n", general_ext);
|
||||
fprintf(stdout," boustrophedonic = %ld\n", boustrophedonic);
|
||||
fprintf(stdout," two_ordr_spd = %ld \n", two_ordr_spd);
|
||||
|
||||
fprintf(stdout," plus1_spd = %ld\n", plus1_spd);
|
||||
fprintf(stdout," plus1_spd = %ld\n", plus1_spd);
|
||||
|
||||
fprintf(stdout," n_sp_diff = %d\n", n_sp_diff);
|
||||
fprintf(stdout," width_widths = %ld\n", nbits_per_group_size);
|
||||
fprintf(stdout," width_lengths = %ld\n", nbits_per_width);
|
||||
fprintf(stdout," octet_start_group = %ld\n", octet_start_group);
|
||||
fprintf(stdout," width_spd_sp_desc = %ld\n", width_spd_sp_desc);
|
||||
fprintf(stdout," n_sp_diff = %d\n", n_sp_diff);
|
||||
fprintf(stdout," width_widths = %ld\n", nbits_per_group_size);
|
||||
fprintf(stdout," width_lengths = %ld\n", nbits_per_width);
|
||||
fprintf(stdout," octet_start_group = %ld\n", octet_start_group);
|
||||
fprintf(stdout," width_spd_sp_desc = %ld\n", width_spd_sp_desc);
|
||||
|
||||
|
||||
fprintf(stdout," offsetsection = %ld\n", offsetsection);
|
||||
|
||||
fprintf(stdout," offset w = %ld\n", octet_start_group + offsetsection);
|
||||
|
||||
fprintf(stdout,"\n****************************************\n");
|
||||
*/
|
||||
fprintf(stdout," offsetsection = %ld\n", offsetsection);
|
||||
fprintf(stdout," offset w = %ld\n", octet_start_group + offsetsection);
|
||||
fprintf(stdout,"\n****************************************\n");
|
||||
*/
|
||||
if(snd_bitmap || matrix_values)
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
|
||||
sec_val = (unsigned long*)grib_context_malloc(a->context,(n_vals)*sizeof(unsigned long));
|
||||
grib_context_free(a->context,sec_val);
|
||||
sec_val = (unsigned long*)grib_context_malloc(a->context,(n_vals)*sizeof(unsigned long));
|
||||
|
||||
buf_width_of_group += a->offset;
|
||||
buf_size_of_groups += offsetsection+(octet_start_group-1); /* -1 because of documented starting at 1(and not 0)*/
|
||||
|
@ -685,7 +678,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
|
|||
double reference_value;
|
||||
long binary_scale_factor;
|
||||
long bits_per_value;
|
||||
long bit_per_val_rectified_for_gribex;
|
||||
/*long bit_per_val_rectified_for_gribex;*/
|
||||
long decimal_scale_factor;
|
||||
long n1 = 0;
|
||||
long n2 = 0;
|
||||
|
@ -784,7 +777,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
|
|||
min *= d;
|
||||
max *= d;
|
||||
|
||||
bit_per_val_rectified_for_gribex = bits_per_value+8-bits_per_value%8;
|
||||
/*bit_per_val_rectified_for_gribex = bits_per_value+8-bits_per_value%8;*/
|
||||
if (grib_get_nearest_smaller_value(gh,self->reference_value,min,&reference_value)
|
||||
!=GRIB_SUCCESS) {
|
||||
grib_context_log(a->context,GRIB_LOG_ERROR,
|
||||
|
|
|
@ -414,6 +414,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
|
|||
reference_value,s,pscals,(maxv-hcount)*2,pval);
|
||||
i+=(maxv-hcount)*2;
|
||||
#else
|
||||
(void)pscals; /* suppress gcc warning */
|
||||
(void)pval; /* suppress gcc warning */
|
||||
for(lcount=hcount; lcount < maxv ; lcount++)
|
||||
{
|
||||
val[i++] = (double) ((grib_decode_unsigned_long(lres, &lpos,
|
||||
|
@ -440,11 +442,9 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
|
|||
grib_context_free(a->context,scals);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define MAXVAL(a,b) a>b?a:b
|
||||
|
||||
static double calculate_pfactor(grib_context *ctx,const double* spectralField, long fieldTruncation, long subsetTruncation)
|
||||
|
|
|
@ -235,7 +235,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
|
|||
long mmax = 0;
|
||||
long n_vals = 0;
|
||||
double *scals = NULL;
|
||||
double *pscals=NULL;
|
||||
/* double *pscals=NULL; */
|
||||
double dummy=0;
|
||||
|
||||
double s = 0;
|
||||
|
@ -380,7 +380,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
|
|||
sub_k--;
|
||||
}
|
||||
|
||||
pscals=scals+lup;
|
||||
/* pscals=scals+lup; */
|
||||
for(lcount=hcount; lcount < maxv ; lcount++)
|
||||
{
|
||||
val[i++] = (double) ((grib_decode_unsigned_long(lres, &lpos,
|
||||
|
@ -403,6 +403,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
|
|||
val[i++] *= d;
|
||||
}
|
||||
|
||||
(void)dummy; /* suppress gcc warning */
|
||||
grib_context_free(a->context,scals);
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -227,7 +227,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
|
|||
long mmax = 0;
|
||||
long n_vals = 0;
|
||||
double *scals = NULL;
|
||||
double *pscals=NULL;
|
||||
/* double *pscals=NULL; */
|
||||
double dummy=0;
|
||||
|
||||
double s = 0;
|
||||
|
@ -369,7 +369,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
|
|||
sub_k--;
|
||||
}
|
||||
|
||||
pscals=scals+lup;
|
||||
/* pscals=scals+lup; */
|
||||
for(lcount=hcount; lcount < maxv ; lcount++)
|
||||
{
|
||||
dummy = (double) ((grib_decode_unsigned_long(lres, &lpos,
|
||||
|
@ -392,6 +392,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
|
|||
val[i++] *= d;
|
||||
}
|
||||
|
||||
(void)dummy; /* suppress gcc warning */
|
||||
grib_context_free(a->context,scals);
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -266,7 +266,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
|
|||
double first = 0;
|
||||
double last = 0;
|
||||
long numberOfPoints = 0;
|
||||
long numberOfPointsInternal = 0;
|
||||
/* long numberOfPointsInternal = 0; */
|
||||
long scansPositively = 0;
|
||||
double directionIncrementDouble=0;
|
||||
|
||||
|
@ -298,7 +298,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
|
|||
directionIncrementGiven=1;
|
||||
numberOfPoints=GRIB_MISSING_LONG;
|
||||
} else {
|
||||
numberOfPointsInternal = 1+rint(fabs((last-first) / *val));
|
||||
/* numberOfPointsInternal = 1+rint(fabs((last-first) / *val)); */
|
||||
|
||||
directionIncrementDouble = rint (*val * (double)angleDivisor / (double)angleMultiplier);
|
||||
|
||||
|
|
|
@ -247,6 +247,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
|
|||
d=fabs(lats[0]-lats[1]);
|
||||
if ( !is_global ) {
|
||||
/*sub area*/
|
||||
(void)d;
|
||||
#if EFDEBUG
|
||||
printf("-------- subarea fabs(lat_first-lats[0])=%g d=%g\n",fabs(lat_first-lats[0]),d);
|
||||
printf("-------- subarea fabs(lat_last+lats[0])=%g d=%g\n",fabs(lat_last+lats[0]),d);
|
||||
|
@ -265,6 +266,8 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
|
|||
lon_first_row=((ilon_first)*360.0)/pl[j];
|
||||
lon_last_row=((ilon_last)*360.0)/pl[j];
|
||||
*val+=row_count;
|
||||
(void)lon_last_row;
|
||||
(void)lon_first_row;
|
||||
#if EFDEBUG
|
||||
printf(" ilon_first=%ld lon_first=%.10e ilon_last=%ld lon_last=%.10e count=%ld row_count=%ld\n",
|
||||
ilon_first,lon_first_row,ilon_last,lon_last_row,*val,row_count);
|
||||
|
|
|
@ -244,7 +244,8 @@ static int unpack_double (grib_accessor* a, double* val, size_t *len)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int value_count(grib_accessor* a,long* count) {
|
||||
static int value_count(grib_accessor* a,long* count)
|
||||
{
|
||||
grib_accessor_statistics_spectral* self = (grib_accessor_statistics_spectral*)a;
|
||||
*count= self->number_of_elements;
|
||||
return 0;
|
||||
|
@ -256,8 +257,9 @@ static void destroy(grib_context* c,grib_accessor* a)
|
|||
grib_context_free(c,self->v);
|
||||
}
|
||||
|
||||
static int compare(grib_accessor* a, grib_accessor* b) {
|
||||
int retval=0;
|
||||
static int compare(grib_accessor* a, grib_accessor* b)
|
||||
{
|
||||
int retval=GRIB_SUCCESS;
|
||||
double *aval=0;
|
||||
double *bval=0;
|
||||
|
||||
|
@ -296,5 +298,3 @@ static int compare(grib_accessor* a, grib_accessor* b) {
|
|||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
|
|||
long time = 0;
|
||||
long step = 0;
|
||||
long stepUnits = 0;
|
||||
long hours = 0, minutes=0, step_mins=0, tmp, tmp_hrs, tmp_mins;
|
||||
long hours = 0, minutes=0, step_mins=0, tmp, tmp_hrs;
|
||||
|
||||
if (self->year) {
|
||||
long year,month,day;
|
||||
|
@ -228,7 +228,6 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
|
|||
hours = time / 100;
|
||||
tmp = minutes + step_mins; /* add the step to our minutes */
|
||||
tmp_hrs = tmp/60; /* how many hours and mins is that? */
|
||||
tmp_mins = tmp%60;
|
||||
hours += tmp_hrs; /* increment hours */
|
||||
|
||||
date = grib_date_to_julian (date);
|
||||
|
|
|
@ -198,6 +198,8 @@ static void dump_values(grib_dumper* d,grib_accessor* a)
|
|||
depth-=2;
|
||||
fprintf(self->dumper.out,"\n%-*s}",depth," ");
|
||||
}
|
||||
|
||||
(void)err; /* TODO */
|
||||
}
|
||||
|
||||
|
||||
|
@ -277,7 +279,7 @@ static void dump_long(grib_dumper* d,grib_accessor* a,const char* comment)
|
|||
depth-=2;
|
||||
fprintf(self->dumper.out,"\n%-*s}",depth," ");
|
||||
}
|
||||
|
||||
(void)err; /* TODO */
|
||||
}
|
||||
|
||||
static void dump_bits(grib_dumper* d,grib_accessor* a,const char* comment)
|
||||
|
@ -386,6 +388,7 @@ static void dump_string_array(grib_dumper* d,grib_accessor* a,const char* commen
|
|||
}
|
||||
|
||||
grib_context_free(c,values);
|
||||
(void)err; /* TODO */
|
||||
}
|
||||
|
||||
static void dump_string(grib_dumper* d,grib_accessor* a,const char* comment)
|
||||
|
@ -438,6 +441,7 @@ static void dump_string(grib_dumper* d,grib_accessor* a,const char* comment)
|
|||
}
|
||||
|
||||
grib_context_free(c,value);
|
||||
(void)err; /* TODO */
|
||||
}
|
||||
|
||||
static void dump_bytes(grib_dumper* d,grib_accessor* a,const char* comment)
|
||||
|
|
|
@ -25,7 +25,6 @@ int grib_expression_native_type(grib_handle* h,grib_expression* g)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int grib_expression_evaluate_long(grib_handle* h,grib_expression* g,long* result)
|
||||
{
|
||||
grib_expression_class *c = g->cclass;
|
||||
|
@ -127,7 +126,6 @@ void grib_expression_free(grib_context* ctx,grib_expression* g)
|
|||
grib_context_free_persistent(ctx,g);
|
||||
}
|
||||
|
||||
|
||||
void grib_expression_add_dependency(grib_expression* e, grib_accessor* observer)
|
||||
{
|
||||
grib_expression_class *c = e->cclass;
|
||||
|
@ -144,7 +142,6 @@ void grib_expression_add_dependency(grib_expression* e, grib_accessor* observer)
|
|||
}
|
||||
|
||||
/*----------------------------------------*/
|
||||
|
||||
int grib_expression_set_value(grib_handle* h,grib_expression* g,grib_values* v)
|
||||
{
|
||||
char buffer[1024];
|
||||
|
@ -181,7 +178,6 @@ int grib_expression_set_value(grib_handle* h,grib_expression* g,grib_values* v)
|
|||
}
|
||||
|
||||
/*----------------------------------------*/
|
||||
|
||||
grib_arguments *grib_arguments_new(grib_context* c,grib_expression* g, grib_arguments* n)
|
||||
{
|
||||
grib_arguments* l = (grib_arguments*)grib_context_malloc_clear_persistent(c,sizeof(grib_arguments));
|
||||
|
@ -246,6 +242,7 @@ long grib_arguments_get_long(grib_handle* h,grib_arguments* args,int n)
|
|||
|
||||
e = args->expression;
|
||||
ret = grib_expression_evaluate_long(h,e,&lres);
|
||||
(void)ret;
|
||||
return lres;
|
||||
}
|
||||
|
||||
|
@ -261,8 +258,8 @@ double grib_arguments_get_double(grib_handle* h,grib_arguments* args,int n)
|
|||
|
||||
e = args->expression;
|
||||
ret = grib_expression_evaluate_double(h,e,&dres);
|
||||
(void)ret;
|
||||
return dres;
|
||||
|
||||
}
|
||||
|
||||
grib_expression* grib_arguments_get_expression(grib_handle* h,grib_arguments* args,int n)
|
||||
|
|
|
@ -126,6 +126,7 @@ static int evaluate_long(grib_expression* g,grib_handle *h,long* result)
|
|||
else
|
||||
*result=1;
|
||||
|
||||
(void)val;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
@ -421,12 +421,11 @@ static int grib_fieldset_compare(grib_fieldset* set,int* i,int* j)
|
|||
int idkey=0;
|
||||
grib_order_by* ob=0;
|
||||
int ii=0,jj=0;
|
||||
int *order=0,*filter=0;
|
||||
int *order=0;
|
||||
|
||||
if (!set || !set->order_by) return GRIB_INVALID_ARGUMENT;
|
||||
ob=set->order_by;
|
||||
order=set->order->el;
|
||||
filter=set->filter->el;
|
||||
|
||||
ii=*(set->filter->el+*(order+*i));
|
||||
jj=*(set->filter->el+*(order+*j));
|
||||
|
@ -514,7 +513,7 @@ static grib_order_by* grib_fieldset_new_order_by(grib_context* c,char* obstr)
|
|||
{
|
||||
char *t1=0,*t2=0,*p=0;
|
||||
int id=0;
|
||||
char *z=0,*zs=0;
|
||||
char *z=0;
|
||||
int mode,mode_default=GRIB_ORDER_BY_ASC;
|
||||
grib_order_by *ob,*sob;
|
||||
|
||||
|
@ -522,7 +521,6 @@ static grib_order_by* grib_fieldset_new_order_by(grib_context* c,char* obstr)
|
|||
|
||||
z=grib_context_strdup(c,obstr);
|
||||
if(!z) return 0;
|
||||
zs=z;
|
||||
grib_trim(&z);
|
||||
|
||||
if (strlen(z)==0) {return 0;}
|
||||
|
@ -592,7 +590,7 @@ int grib_fieldset_add(grib_fieldset* set,char* filename)
|
|||
int err=0;
|
||||
int i=0;
|
||||
grib_handle* h=0;
|
||||
int nkeys;
|
||||
/* int nkeys; */
|
||||
grib_file* file;
|
||||
double offset=0;
|
||||
long length=0;
|
||||
|
@ -601,7 +599,7 @@ int grib_fieldset_add(grib_fieldset* set,char* filename)
|
|||
if (!set || !filename ) return GRIB_INVALID_ARGUMENT;
|
||||
c=set->context;
|
||||
|
||||
nkeys=set->columns_size;
|
||||
/* nkeys=set->columns_size; */
|
||||
|
||||
file=grib_file_open(filename,"r",&err);
|
||||
if (!file || !file->handle) return err;
|
||||
|
|
|
@ -1330,7 +1330,6 @@ static void grib2_build_message ( grib_context* context,unsigned char* sections[
|
|||
{
|
||||
int i=0;
|
||||
char* theEnd="7777";
|
||||
unsigned char* sec0;
|
||||
unsigned char* p=0;
|
||||
size_t msglen=0;
|
||||
long bitp=64;
|
||||
|
@ -1339,7 +1338,7 @@ static void grib2_build_message ( grib_context* context,unsigned char* sections[
|
|||
*data=NULL;
|
||||
return;
|
||||
}
|
||||
sec0=sections[0];
|
||||
|
||||
for ( i=0;i<8;i++ ) msglen+= sections_len[i];
|
||||
msglen+=4;
|
||||
if ( *len<msglen ) msglen=*len;
|
||||
|
|
|
@ -1658,7 +1658,7 @@ grib_handle* grib_handle_new_from_index(grib_index* index,int *err)
|
|||
|
||||
grib_handle* codes_new_from_index(grib_index* index,int message_type,int *err)
|
||||
{
|
||||
grib_index_key* keys;
|
||||
/*grib_index_key* keys;*/
|
||||
grib_field_list *fieldset,*next;
|
||||
grib_handle* h=NULL;
|
||||
grib_context* c=NULL;
|
||||
|
@ -1706,7 +1706,7 @@ grib_handle* codes_new_from_index(grib_index* index,int message_type,int *err)
|
|||
|
||||
*err=GRIB_END_OF_INDEX;
|
||||
h=NULL;
|
||||
keys=index->keys;
|
||||
/*keys=index->keys;*/
|
||||
|
||||
if ((*err=grib_index_execute(index))==GRIB_SUCCESS) {
|
||||
|
||||
|
|
|
@ -472,9 +472,7 @@ grib_accessor* grib_find_accessor_fast(grib_handle* h, const char* name)
|
|||
while ( *p != '.' && *p != '\0' ) p++;
|
||||
if ( *p == '.' ) {
|
||||
int i=0,len=0;
|
||||
char* basename=NULL;
|
||||
char name_space[1024];
|
||||
basename=p+1;
|
||||
p--;
|
||||
i=0;
|
||||
len=p-name+1;
|
||||
|
|
|
@ -80,21 +80,18 @@ static void write_message(grib_handle* h,const char* str)
|
|||
const void *m; size_t s;
|
||||
char fname[1024]={0,};
|
||||
FILE* fh=NULL;
|
||||
int ioerr=0;
|
||||
|
||||
grib_get_message(h,&m,&s);
|
||||
sprintf(fname,"%s_%d.bufr",str,write_count);
|
||||
|
||||
fh= fopen(fname,"w");
|
||||
if(!fh) {
|
||||
ioerr=errno;
|
||||
grib_context_log(h->context,(GRIB_LOG_ERROR)|(GRIB_LOG_PERROR),
|
||||
"Error opening %s",fname);
|
||||
exit(GRIB_IO_PROBLEM);
|
||||
}
|
||||
|
||||
if(fwrite(m,1,s,fh) != s) {
|
||||
ioerr=errno;
|
||||
grib_context_log(h->context,(GRIB_LOG_ERROR)|(GRIB_LOG_PERROR),
|
||||
"Error writing to %s",fname);
|
||||
exit(GRIB_IO_PROBLEM);
|
||||
|
|
|
@ -109,7 +109,6 @@ grib_handle* merge(grib_handle* h1,grib_handle* h2) {
|
|||
long i,j,iscan,jscan,Ni,Nj,idj,idi;
|
||||
long Ni1,Nj1,Ni2,Nj2;
|
||||
grib_handle* h=NULL;
|
||||
grib_context* c;
|
||||
int err=0;
|
||||
/*
|
||||
int dump_flags= GRIB_DUMP_FLAG_CODED
|
||||
|
@ -118,7 +117,7 @@ grib_handle* merge(grib_handle* h1,grib_handle* h2) {
|
|||
| GRIB_DUMP_FLAG_READ_ONLY;
|
||||
|
||||
*/
|
||||
c=grib_context_get_default();
|
||||
|
||||
/* same products? */
|
||||
if (grib_key_equal(h1,h2,"md5Product",GRIB_TYPE_STRING,&err)==0 && err==0) {
|
||||
return NULL;
|
||||
|
|
|
@ -21,7 +21,7 @@ char buffer[SIZE];
|
|||
int main(int argc,char **argv)
|
||||
{
|
||||
FILE* in, *out, *bad;
|
||||
char *cin, *cout, *cbad;
|
||||
char *cout, *cbad;
|
||||
|
||||
size_t data_len = SIZE;
|
||||
long count = 0;
|
||||
|
@ -29,7 +29,6 @@ int main(int argc,char **argv)
|
|||
|
||||
if(argc != 3 && argc != 4) usage(argv[0]);
|
||||
|
||||
cin = argv[1];
|
||||
in = fopen(argv[1],"r");
|
||||
if(!in) {
|
||||
perror(argv[1]);
|
||||
|
|
|
@ -2099,7 +2099,6 @@ static void check_err(const int stat, const int line, const char *file)
|
|||
#define DIM_ID 1
|
||||
static int set_dimension(int ncid, const char *name, int n, int xtype, const char *units, const char *long_name)
|
||||
{
|
||||
|
||||
int var_id = 0;
|
||||
int stat = 0;
|
||||
int dim_id = DIM_ID;
|
||||
|
@ -2175,6 +2174,8 @@ static int def_latlon(int ncid, fieldset *fs)
|
|||
/* g->purge_header = TRUE; */
|
||||
release_field(g);
|
||||
|
||||
(void)var_id; /* suppress gcc warning */
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ char iobuf[1024*1024];
|
|||
static int grib_tool_without_orderby(grib_runtime_options* options)
|
||||
{
|
||||
int err=0;
|
||||
int nofail=0;
|
||||
/*int nofail=0;*/
|
||||
grib_failed *failed=NULL,*p=NULL;
|
||||
grib_handle* h=NULL;
|
||||
grib_context* c=NULL;
|
||||
|
@ -316,7 +316,7 @@ static int grib_tool_without_orderby(grib_runtime_options* options)
|
|||
infile->filter_handle_count=0;
|
||||
|
||||
grib_tool_new_file_action(options,infile);
|
||||
nofail=grib_options_on("f");
|
||||
/*nofail=grib_options_on("f");*/
|
||||
|
||||
while(!options->skip_all && ((h = grib_handle_new_from_file_x(c,infile->file,options->mode,
|
||||
options->headers_only,&err))
|
||||
|
@ -575,7 +575,6 @@ static int scan(grib_context* c,grib_runtime_options* options,const char* dir) {
|
|||
static int process(grib_context* c,grib_runtime_options* options,const char* path) {
|
||||
struct stat s;
|
||||
int stat_val=0;
|
||||
int ioerr=0;
|
||||
|
||||
#ifndef ECCODES_ON_WINDOWS
|
||||
stat_val = lstat(path,&s);
|
||||
|
@ -584,7 +583,6 @@ static int process(grib_context* c,grib_runtime_options* options,const char* pat
|
|||
#endif
|
||||
|
||||
if ( stat_val != 0 ) {
|
||||
ioerr=errno;
|
||||
grib_context_log(c,(GRIB_LOG_ERROR) | (GRIB_LOG_PERROR),"Cannot stat %s",path);
|
||||
return GRIB_IO_PROBLEM;
|
||||
}
|
||||
|
@ -953,7 +951,6 @@ void grib_tools_write_message(grib_runtime_options* options, grib_handle* h)
|
|||
size_t size;
|
||||
grib_file* of = NULL;
|
||||
int err = 0;
|
||||
int ioerr = 0;
|
||||
char filename[1024] = { 0, };
|
||||
Assert(options->outfile!=NULL && options->outfile->name!=NULL);
|
||||
|
||||
|
@ -970,7 +967,6 @@ void grib_tools_write_message(grib_runtime_options* options, grib_handle* h)
|
|||
of = grib_file_open(filename, "w", &err);
|
||||
|
||||
if (!of || !of->handle) {
|
||||
ioerr = errno;
|
||||
grib_context_log(h->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR),
|
||||
"unable to open file %s\n", filename);
|
||||
exit(GRIB_IO_PROBLEM);
|
||||
|
@ -978,7 +974,6 @@ void grib_tools_write_message(grib_runtime_options* options, grib_handle* h)
|
|||
|
||||
if (options->gts && h->gts_header) {
|
||||
if (fwrite(h->gts_header, 1, h->gts_header_len, of->handle) != h->gts_header_len) {
|
||||
ioerr = errno;
|
||||
grib_context_log(h->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR),
|
||||
"Error writing GTS header to %s", filename);
|
||||
exit(GRIB_IO_PROBLEM);
|
||||
|
@ -986,7 +981,6 @@ void grib_tools_write_message(grib_runtime_options* options, grib_handle* h)
|
|||
}
|
||||
|
||||
if (fwrite(buffer, 1, size, of->handle) != size) {
|
||||
ioerr = errno;
|
||||
grib_context_log(h->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR),
|
||||
"Error writing to %s", filename);
|
||||
exit(GRIB_IO_PROBLEM);
|
||||
|
@ -995,7 +989,6 @@ void grib_tools_write_message(grib_runtime_options* options, grib_handle* h)
|
|||
if (options->gts && h->gts_header) {
|
||||
char gts_trailer[4] = { '\x0D', '\x0D', '\x0A', '\x03' };
|
||||
if (fwrite(gts_trailer, 1, 4, of->handle) != 4) {
|
||||
ioerr = errno;
|
||||
grib_context_log(h->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR),
|
||||
"Error writing GTS trailer to %s", filename);
|
||||
exit(GRIB_IO_PROBLEM);
|
||||
|
|
|
@ -71,8 +71,8 @@ int grib_tool_before_getopt(grib_runtime_options* options) {
|
|||
}
|
||||
|
||||
/*
|
||||
The options have been parsed and the structure
|
||||
grib_runtime_options* options has been loaded.
|
||||
The options have been parsed and the structure
|
||||
grib_runtime_options* options has been loaded.
|
||||
Initialization and startup can be done here
|
||||
*/
|
||||
int grib_tool_init(grib_runtime_options* options) {
|
||||
|
@ -80,15 +80,15 @@ int grib_tool_init(grib_runtime_options* options) {
|
|||
size_t size=4;
|
||||
int ret=0;
|
||||
double min=0,max=0;
|
||||
int i=0,idx=0;
|
||||
int i=0;
|
||||
char* p=NULL;
|
||||
if (grib_options_on("j")) {
|
||||
options->verbose=0;
|
||||
json=1;
|
||||
}
|
||||
|
||||
|
||||
if (options->latlon) {
|
||||
|
||||
|
||||
lat = strtod(options->latlon,&end);
|
||||
if (*end != ',') {
|
||||
printf("ERROR: wrong latitude value\n");
|
||||
|
@ -142,7 +142,7 @@ int grib_tool_init(grib_runtime_options* options) {
|
|||
options->latlon_idx=-1;
|
||||
max=options->distances[0];
|
||||
for (i=0;i<4;i++)
|
||||
if (max<options->distances[i]) {max=options->distances[i];idx=i;}
|
||||
if (max<options->distances[i]) {max=options->distances[i];}
|
||||
min=max;
|
||||
for (i=0;i<4;i++) {
|
||||
if ((min >= options->distances[i]) && (options->mask_values[i] >= 0.5)) {
|
||||
|
|
Loading…
Reference in New Issue