Remove compiler warnings (using clang) and code clean up

This commit is contained in:
Shahram Najm 2015-12-18 18:01:56 +00:00
parent a4c48f0689
commit 2a168ac30d
13 changed files with 480 additions and 491 deletions

View File

@ -29,8 +29,8 @@ int main(int argc,char* argv[])
char* unitsPercent= NULL;
long longVal;
double doubleVal;
size_t values_len=0, desc_len=0, len=0;
int i, err=0;
size_t len=0;
int err=0;
int cnt=0;
char* infile = "../../data/bufr/syno_multi.bufr";

View File

@ -34,7 +34,6 @@ int main(int argc,char* argv[])
/* message handle. Required in all the eccodes calls acting on a message.*/
codes_handle* h=NULL;
long longVal;
int err=0, cnt=0;
int keyType;

View File

@ -31,8 +31,6 @@ int main(int argc,char* argv[])
codes_handle* h=NULL;
double *lat=NULL, *lon=NULL, *bscatter=NULL;
long longVal;
double doubleVal;
long numObs=0;
size_t len=0;
int i, err=0;

View File

@ -32,7 +32,7 @@ int main(int argc,char* argv[])
long longVal;
/*double doubleVal;*/
int i, err=0;
int err=0;
int cnt=0;
size_t size = 0;
char* infile = "../../data/bufr/syno_multi.bufr";

File diff suppressed because it is too large Load Diff

View File

@ -156,8 +156,6 @@ static void init_class(grib_accessor_class* c)
static grib_accessor* make_clone(grib_accessor* a,grib_section* s,int* err)
{
grib_accessor* operatorAccessor=NULL;
grib_action operatorCreator = {0, };
grib_accessor* the_clone=NULL;
grib_accessor* attribute=NULL;
grib_accessor_bufr_data_element* elementAccessor;

View File

@ -323,7 +323,6 @@ int grib_concept_apply(grib_accessor* a, const char* name)
grib_values values[1024];
grib_sarray* sa=NULL;
grib_concept_value* c=NULL;
grib_accessor_concept* self=(grib_accessor_concept*)a;
grib_concept_value* concepts = action_concept_get_concept(a);
grib_handle* h=grib_handle_of_accessor(a);
grib_action* act=a->creator;

View File

@ -578,8 +578,6 @@ static int read_BUFR(reader *r)
/* unsigned char tmp[65536];*/ /* Should be enough */
size_t length = 0;
long edition = 0;
size_t sec1len = 0;
size_t sec2len = 0;
int err = 0;
int i = 0 ,j;
size_t buflen=2048;
@ -1513,5 +1511,4 @@ int grib_count_in_file(grib_context* c, FILE* f,int* n)
rewind(f);
return err==GRIB_END_OF_FILE ? 0 : err;
}

View File

@ -119,11 +119,9 @@ int grib_init_accessor_from_handle(grib_loader* loader,grib_accessor* ga,grib_ar
g = h;
while(g)
{
if(g->values) {
if(copy_values(g,ga) == GRIB_SUCCESS) {
grib_context_log(h->context,GRIB_LOG_DEBUG, "Copying: setting %s to multi-set-value", ga->name);
return GRIB_SUCCESS;
}
if(copy_values(g,ga) == GRIB_SUCCESS) {
grib_context_log(h->context,GRIB_LOG_DEBUG, "Copying: setting %s to multi-set-value", ga->name);
return GRIB_SUCCESS;
}
g = g->main;
}

View File

@ -144,7 +144,6 @@ int grib_recompose_name(grib_handle* h, grib_accessor *observer, const char* una
int grib_accessor_print(grib_accessor* a,const char* name,int type,const char* format,const char* separator,int maxcols,int* newline,FILE* out)
{
size_t size=0;
char val[1024] = {0,};
char* sval=NULL;
char* p=NULL;
double* dval=0;
@ -256,7 +255,6 @@ int grib_accessor_print(grib_accessor* a,const char* name,int type,const char* f
int grib_accessors_list_print(grib_handle* h,grib_accessors_list* al,const char* name,int type,const char* format,const char* separator,int maxcols,int* newline,FILE* out)
{
size_t size=0,len=0,replen=0;
char val[1024] = {0,};
char* sval=NULL;
char* p=NULL;
double* dval=0;

View File

@ -13,7 +13,8 @@
***************************************************************************/
#include "grib_api_internal.h"
GRIB_INLINE static int grib_inline_strcmp(const char* a,const char* b) {
GRIB_INLINE static int grib_inline_strcmp(const char* a,const char* b)
{
if (*a != *b) return 1;
while((*a!=0 && *b!=0) && *(a) == *(b) ) {a++;b++;}
return (*a==0 && *b==0) ? 0 : 1;
@ -21,7 +22,8 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a,const char* b) {
#define SWAP(a,b) temp=(a);(a)=(b);(b)=temp;
int grib_set_expression(grib_handle* h, const char* name,grib_expression* e) {
int grib_set_expression(grib_handle* h, const char* name,grib_expression* e)
{
grib_accessor* a = grib_find_accessor(h, name);
int ret = GRIB_SUCCESS;
@ -39,7 +41,8 @@ int grib_set_expression(grib_handle* h, const char* name,grib_expression* e) {
return GRIB_NOT_FOUND;
}
int grib_set_expression_internal(grib_handle* h, const char* name,grib_expression* e) {
int grib_set_expression_internal(grib_handle* h, const char* name,grib_expression* e)
{
grib_accessor* a = grib_find_accessor(h, name);
int ret = GRIB_SUCCESS;
@ -53,7 +56,8 @@ int grib_set_expression_internal(grib_handle* h, const char* name,grib_expressio
return GRIB_NOT_FOUND;
}
int grib_set_long_internal(grib_handle* h, const char* name, long val) {
int grib_set_long_internal(grib_handle* h, const char* name, long val)
{
grib_context* c=h->context;
int ret = GRIB_SUCCESS;
grib_accessor* a =NULL;
@ -79,7 +83,8 @@ int grib_set_long_internal(grib_handle* h, const char* name, long val) {
return GRIB_NOT_FOUND;
}
int grib_set_long(grib_handle* h, const char* name, long val) {
int grib_set_long(grib_handle* h, const char* name, long val)
{
int ret = GRIB_SUCCESS;
grib_accessor* a =NULL;
size_t l = 1;
@ -102,7 +107,8 @@ int grib_set_long(grib_handle* h, const char* name, long val) {
return GRIB_NOT_FOUND;
}
int grib_set_double_internal(grib_handle* h, const char* name, double val) {
int grib_set_double_internal(grib_handle* h, const char* name, double val)
{
int ret = GRIB_SUCCESS;
grib_accessor* a =NULL;
size_t l = 1;
@ -134,7 +140,8 @@ struct grib_key_err {
grib_key_err* next;
};
int grib_copy_namespace(grib_handle* dest, const char* name, grib_handle* src) {
int grib_copy_namespace(grib_handle* dest, const char* name, grib_handle* src)
{
int *err=0;
int type;
size_t len;
@ -291,8 +298,8 @@ int grib_copy_namespace(grib_handle* dest, const char* name, grib_handle* src) {
return *err;
}
int grib_set_double(grib_handle* h, const char* name, double val) {
int grib_set_double(grib_handle* h, const char* name, double val)
{
int ret = GRIB_SUCCESS;
grib_accessor* a =NULL;
size_t l = 1;
@ -522,11 +529,13 @@ int grib_set_missing(grib_handle* h, const char* name)
return GRIB_NOT_FOUND;
}
int grib_is_missing_long(grib_accessor* a,long x) {
int grib_is_missing_long(grib_accessor* a,long x)
{
int ret = ( a==NULL || (a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING)) && (x==GRIB_MISSING_LONG) ? 1 : 0;
return ret;
}
int grib_is_missing_double(grib_accessor* a,double x) {
int grib_is_missing_double(grib_accessor* a,double x)
{
int ret = ( a==NULL || (a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING)) && (x==GRIB_MISSING_DOUBLE) ? 1 : 0;
return ret;
}
@ -561,7 +570,8 @@ int grib_is_defined(grib_handle* h, const char* name)
return (a ? 1 : 0);
}
int grib_set_flag(grib_handle *h,const char* name,unsigned long flag) {
int grib_set_flag(grib_handle *h,const char* name,unsigned long flag)
{
grib_accessor* a=grib_find_accessor(h,name);
if (!a) return GRIB_NOT_FOUND;
@ -795,7 +805,8 @@ int grib_get_long_internal(grib_handle* h, const char* name, long* val)
return ret;
}
int grib_is_in_dump(grib_handle* h, const char* name) {
int grib_is_in_dump(grib_handle* h, const char* name)
{
grib_accessor* a=grib_find_accessor(h, name);
if (a!=NULL && (a->flags & GRIB_ACCESSOR_FLAG_DUMP))
return 1;
@ -953,7 +964,6 @@ int grib_get_string_internal(grib_handle* h, const char* name, char* val, size_t
int grib_get_string(grib_handle* h, const char* name, char* val, size_t *length)
{
size_t len = 1;
grib_accessor* a = NULL;
grib_accessors_list* al=NULL;
int ret=0;
@ -1033,7 +1043,6 @@ int _grib_get_double_array_internal(grib_handle* h,grib_accessor* a,double* val,
}
return err;
}
else {
return GRIB_SUCCESS;
@ -1534,7 +1543,8 @@ void grib_print_values(grib_values* values,int count)
}
}
int grib_values_check(grib_handle* h, grib_values* values, int count) {
int grib_values_check(grib_handle* h, grib_values* values, int count)
{
int i=0;
long long_value;
double double_value;
@ -1595,7 +1605,8 @@ int grib_values_check(grib_handle* h, grib_values* values, int count) {
return 0;
}
int grib_key_equal(grib_handle* h1,grib_handle* h2,const char* key,int type,int *err) {
int grib_key_equal(grib_handle* h1,grib_handle* h2,const char* key,int type,int *err)
{
double d1,d2;
long l1,l2;
char s1[500]={0,};

View File

@ -145,7 +145,6 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
{
long length=0;
char tmp[1024];
size_t idlen=100;
int i,err=0;
grib_accessor* a=NULL;
grib_accessors_list* al=NULL;

View File

@ -622,14 +622,12 @@ static void grib_print_header(grib_runtime_options* options,grib_handle* h)
size_t strlenkey=0;
int width;
int written_to_dump = 0; /* boolean */
if (!options->print_keys || options->handle_count!=1)
if (options->handle_count!=1)
return;
grib_tools_set_print_keys(options,h,options->name_space);
if (options->print_keys
&& options->verbose
&& options->print_header) {
if (options->verbose && options->print_header) {
int j=0;
for (j=0;j<options->print_keys_count;j++) {
strlenkey=strlen(options->print_keys[j].name);