Fix uninitialised/unused variables

This commit is contained in:
Shahram Najm 2013-10-02 13:00:24 +01:00
parent 278b2f7e2e
commit b2c7633d15
3 changed files with 1110 additions and 1116 deletions

View File

@ -290,7 +290,7 @@ static int unpack_double(grib_accessor* a, double* values, size_t *len)
long orderOfSPD=0; long orderOfSPD=0;
long *SPD=0; long *SPD=0;
long numberOfValues=0; long numberOfValues=0;
long bias; long bias=0;
long y=0,z=0,w=0; long y=0,z=0,w=0;
size_t k,ngroups; size_t k,ngroups;
@ -350,7 +350,6 @@ static int unpack_double(grib_accessor* a, double* values, size_t *len)
if(ret != GRIB_SUCCESS) return ret; if(ret != GRIB_SUCCESS) return ret;
} }
X=grib_context_malloc_clear(a->parent->h->context,sizeof(long)*numberOfValues); X=grib_context_malloc_clear(a->parent->h->context,sizeof(long)*numberOfValues);
n=orderOfSPD; n=orderOfSPD;
@ -407,11 +406,9 @@ static int unpack_double(grib_accessor* a, double* values, size_t *len)
w+=y; w+=y;
X[i]=w; X[i]=w;
} }
break; break;
} }
if (self->values) { if (self->values) {
if (numberOfValues!=self->size) { if (numberOfValues!=self->size) {
grib_context_free(a->parent->h->context,self->values); grib_context_free(a->parent->h->context,self->values);
@ -575,7 +572,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
long maxA,minA; long maxA,minA;
long maxC,minC,offsetC; long maxC,minC,offsetC;
long maxAC,minAC; long maxAC,minAC;
long range,bias,maxSPD; long range,bias=0,maxSPD;
long firstOrderValuesMax,offset,groupLength,j,groupWidth,firstOrderValue,lengthOfSecondOrderValues; long firstOrderValuesMax,offset,groupLength,j,groupWidth,firstOrderValue,lengthOfSecondOrderValues;
long *groupLengths,*groupWidths,*firstOrderValues; long *groupLengths,*groupWidths,*firstOrderValues;
/* long groupLengths[MAX_NUMBER_OF_GROUPS],groupWidths[MAX_NUMBER_OF_GROUPS],firstOrderValues[MAX_NUMBER_OF_GROUPS]; */ /* long groupLengths[MAX_NUMBER_OF_GROUPS],groupWidths[MAX_NUMBER_OF_GROUPS],firstOrderValues[MAX_NUMBER_OF_GROUPS]; */
@ -584,7 +581,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
long startGroupLength=15; long startGroupLength=15;
long incrementGroupLength=3; long incrementGroupLength=3;
long minGroupLength=3; long minGroupLength=3;
long widthOfSPD,widthOfBias; long widthOfSPD=0,widthOfBias=0;
long *offsets; long *offsets;
long widthOfFirstOrderValues; long widthOfFirstOrderValues;
int computeGroupA=1; int computeGroupA=1;
@ -1132,7 +1129,6 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
} }
grib_buffer_replace(a, buffer, size,1,1); grib_buffer_replace(a, buffer, size,1,1);
grib_context_free(a->parent->h->context,buffer); grib_context_free(a->parent->h->context,buffer);
@ -1142,7 +1138,6 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
grib_context_free(a->parent->h->context,firstOrderValues); grib_context_free(a->parent->h->context,firstOrderValues);
return ret; return ret;
} }
static void destroy(grib_context* context,grib_accessor* a) static void destroy(grib_context* context,grib_accessor* a)
@ -1154,4 +1149,3 @@ static void destroy(grib_context* context,grib_accessor* a)
} }
} }

View File

@ -65,7 +65,7 @@ int grib_tool_init(grib_runtime_options* options)
size_t size=4; size_t size=4;
int ret=0; int ret=0;
double min=0,max=0; double min=0,max=0;
int i=0,idx=0; int i=0;
char* p=NULL; char* p=NULL;
options->print_header=0; options->print_header=0;
@ -128,7 +128,7 @@ int grib_tool_init(grib_runtime_options* options)
options->latlon_idx=-1; options->latlon_idx=-1;
max=options->distances[0]; max=options->distances[0];
for (i=0;i<4;i++) 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; min=max;
for (i=0;i<4;i++) { for (i=0;i<4;i++) {
if ((min >= options->distances[i]) && (options->mask_values[i] >= 0.5)) { if ((min >= options->distances[i]) && (options->mask_values[i] >= 0.5)) {

View File

@ -78,7 +78,7 @@ int grib_tool_init(grib_runtime_options* options) {
size_t size=4; size_t size=4;
int ret=0; int ret=0;
double min=0,max=0; double min=0,max=0;
int i=0,idx=0; int i=0;
char* p=NULL; char* p=NULL;
if (grib_options_on("j")) { if (grib_options_on("j")) {
options->verbose=0; options->verbose=0;
@ -140,7 +140,7 @@ int grib_tool_init(grib_runtime_options* options) {
options->latlon_idx=-1; options->latlon_idx=-1;
max=options->distances[0]; max=options->distances[0];
for (i=0;i<4;i++) 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; min=max;
for (i=0;i<4;i++) { for (i=0;i<4;i++) {
if ((min >= options->distances[i]) && (options->mask_values[i] >= 0.5)) { if ((min >= options->distances[i]) && (options->mask_values[i] >= 0.5)) {