Compiler warnings

This commit is contained in:
Shahram Najm 2017-06-21 19:21:58 +01:00
parent ada6cb832e
commit fd81b9a736
16 changed files with 46 additions and 26 deletions

View File

@ -32,7 +32,7 @@ int main(int argc,char* argv[])
size_t len=0;
int err=0;
int cnt=0;
char* infile = "../../data/bufr/syno_multi.bufr";
const char* infile = "../../data/bufr/syno_multi.bufr";
in=fopen(infile,"r");
if (!in) {

View File

@ -40,7 +40,7 @@ int main(int argc,char* argv[])
double doubleVal;
int err=0;
int cnt=0;
char* infile = "../../data/bufr/syno_multi.bufr";
const char* infile = "../../data/bufr/syno_multi.bufr";
in=fopen(infile,"r");
if (!in) {

View File

@ -35,7 +35,7 @@ int main(int argc,char* argv[])
int err=0;
int cnt=0;
size_t size = 0;
char* infile = "../../data/bufr/syno_multi.bufr";
const char* infile = "../../data/bufr/syno_multi.bufr";
const void *buffer = NULL;
if (argc != 2) {

View File

@ -37,7 +37,7 @@ int main(int argc,char* argv[])
char stringVal[100]={0,};
int i,err=0;
int cnt=0;
char* infile = "../../data/bufr/synop_multi_subset.bufr";
const char* infile = "../../data/bufr/synop_multi_subset.bufr";
in=fopen(infile,"r");
if (!in) {

View File

@ -132,11 +132,11 @@ int main(int argc, char** argv)
{
/* Example of getting bytes */
char* name = "reservedNeedNotBePresent";
const char* name = "reservedNeedNotBePresent";
unsigned char* byte_val = NULL ;
size_t keySize = 0;
CODES_CHECK(codes_get_size(h, name, &keySize), 0);
byte_val = malloc(keySize*sizeof(char));
byte_val = (unsigned char*)malloc(keySize*sizeof(char));
GRIB_CHECK(codes_get_bytes(h, name, byte_val, &keySize), name);
}

View File

@ -40,7 +40,7 @@ int main(int argc, char *argv[])
CODES_KEYS_ITERATOR_SKIP_DUPLICATES;
/* Choose a namespace. E.g. "ls", "time", "parameter", "geography", "statistics" */
char* name_space="ls";
const char* name_space="ls";
/* name_space=NULL to get all the keys */
/* char* name_space=0; */

View File

@ -33,7 +33,7 @@ int main(int argc, char** argv)
long new_values[1024];
FILE* in = NULL;
char* filename = "../../data/satellite.grib";
const char* filename = "../../data/satellite.grib";
codes_handle *h = NULL;
in = fopen(filename,"r");

View File

@ -27,7 +27,7 @@ int main(int argc, char** argv)
int err = 0;
long parameterCategory=0,parameterNumber=0,discipline=0;
FILE* in = NULL;
char* filename = "../../data/multi.grib2";
const char* filename = "../../data/multi.grib2";
codes_handle *h = NULL;
/* turn on support for multi fields messages */

View File

@ -31,9 +31,9 @@ int main(int argc, char** argv)
size_t size=0;
FILE* in = NULL;
char* infile = "../../data/regular_latlon_surface.grib1";
const char* infile = "../../data/regular_latlon_surface.grib1";
FILE* out = NULL;
char* outfile = "out.precision.grib1";
const char* outfile = "out.precision.grib1";
codes_handle *h = NULL;
const void* buffer = NULL;
double* values1=NULL;

View File

@ -27,9 +27,9 @@ int main(int argc, char** argv)
size_t size=0;
FILE* in = NULL;
char* infile = "../../data/regular_latlon_surface.grib1";
const char* infile = "../../data/regular_latlon_surface.grib1";
FILE* out = NULL;
char* outfile = "out.set_bitmap_c.grib";
const char* outfile = "out.set_bitmap_c.grib";
codes_handle *h = NULL;
const void* buffer = NULL;
size_t values_len;

View File

@ -29,9 +29,9 @@ int main(int argc, char** argv)
size_t size=0;
FILE* in = NULL;
char* infile = "../../data/regular_latlon_surface.grib1";
const char* infile = "../../data/regular_latlon_surface.grib1";
FILE* out = NULL;
char* outfile = "out.set.grib1";
const char* outfile = "out.set.grib1";
codes_handle *h = NULL;
const void* buffer = NULL;
size_t str_len = 0; /* See the call to codes_set_string later */

View File

@ -24,9 +24,9 @@ int main(int argc, char** argv)
int err = 0, is_missing = 0;
FILE* in = NULL;
char* infile = "../../data/reduced_gaussian_pressure_level.grib2";
const char* infile = "../../data/reduced_gaussian_pressure_level.grib2";
FILE* out = NULL;
char* outfile = "out_surface_level.grib2";
const char* outfile = "out_surface_level.grib2";
codes_handle *h = NULL;
const void* buffer = NULL;
size_t size=0;

View File

@ -2953,7 +2953,7 @@ int grib_f_set_real8_array(int* gid, char* key, double *val, int* size, int len)
}
/*****************************************************************************/
int grib_f_get_string_array_(int* gid, char* key, char* val,int* nvals,int* slen,int len)
int grib_f_get_string_array_(int* gid, char* key, char* val,int* nvals,int* slen, int len)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
@ -3012,7 +3012,7 @@ int codes_f_bufr_copy_data(int* gid1,int* gid2){
/*****************************************************************************/
int grib_f_set_string_array_(int* gid, char* key, char* val,int* nvals,int* slen,int len)
int grib_f_set_string_array_(int* gid, char* key, char* val,int* nvals,int* slen, int len)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
@ -3027,7 +3027,7 @@ int grib_f_set_string_array_(int* gid, char* key, char* val,int* nvals,int* slen
cval=(char**)grib_context_malloc_clear(h->context,sizeof(char*)*lsize);
for (i=0;i<lsize;i++) {
cval[i]=grib_context_malloc_clear(c,sizeof(char)* (*slen+1));
cval[i]=(char*)grib_context_malloc_clear(c,sizeof(char)* (*slen+1));
cast_char_no_cut(cval[i],p,*slen);
rtrim( cval[i] ); /* trim spaces at end of string */
p+= *slen;

View File

@ -309,6 +309,14 @@ int grib_f_set_real8_array(int *gid, char *key, double *val, int *size, int len)
int grib_f_set_force_real8_array_(int *gid, char *key, double *val, int *size, int len);
int grib_f_set_force_real8_array__(int *gid, char *key, double *val, int *size, int len);
int grib_f_set_force_real8_array(int *gid, char *key, double *val, int *size, int len);
int grib_f_get_string_array(int* gid, char* key, char* val,int* nvals,int* slen,int len);
int grib_f_get_string_array_(int* gid, char* key, char* val,int* nvals,int* slen,int len);
int grib_f_get_string_array__(int* gid, char* key, char* val,int* nvals,int* slen,int len);
int grib_f_set_string_array(int* gid, char* key, char* val,int* nvals,int* slen, int len);
int grib_f_set_string_array_(int* gid, char* key, char* val,int* nvals,int* slen, int len);
int grib_f_set_string_array__(int* gid, char* key, char* val,int* nvals,int* slen, int len);
int grib_f_get_string_(int *gid, char *key, char *val, int len, int len2);
int grib_f_get_string__(int *gid, char *key, char *val, int len, int len2);
int grib_f_get_string(int *gid, char *key, char *val, int len, int len2);
@ -340,6 +348,10 @@ int grib_f_multi_append_(int *ingid, int *sec, int *mgid);
int grib_f_multi_append(int *ingid, int *sec, int *mgid);
int grib_f_multi_append__(int *ingid, int *sec, int *mgid);
int codes_f_bufr_copy_data(int* gid1,int* gid2);
int codes_f_bufr_copy_data_(int* gid1,int* gid2);
int codes_f_bufr_copy_data__(int* gid1,int* gid2);
int grib_f_set_definitions_path_(char *path, int len);
int grib_f_set_definitions_path__(char *path, int len);
int grib_f_set_definitions_path(char *path, int len);
@ -347,6 +359,14 @@ int grib_f_set_samples_path_(char *path, int len);
int grib_f_set_samples_path__(char *path, int len);
int grib_f_set_samples_path(char *path, int len);
int grib_f_julian_to_datetime(double* jd,long* year,long* month,long* day,long *hour,long *minute,long *second);
int grib_f_julian_to_datetime_(double* jd,long* year,long* month,long* day,long *hour,long *minute,long *second);
int grib_f_julian_to_datetime__(double* jd,long* year,long* month,long* day,long *hour,long *minute,long *second);
int grib_f_datetime_to_julian(long* year,long* month,long* day, long* hour,long* minute,long* second,double* jd);
int grib_f_datetime_to_julian_(long* year,long* month,long* day, long* hour,long* minute,long* second,double* jd);
int grib_f_datetime_to_julian__(long* year,long* month,long* day, long* hour,long* minute,long* second,double* jd);
#ifdef __cplusplus
}
#endif

View File

@ -528,7 +528,7 @@ static bufr_descriptors_array* expanded_descriptors_list_get(grib_context* c,con
c->expanded_descriptors=(grib_trie*)grib_trie_new(c);
return NULL;
}
expandedUnexpandedMapList=grib_trie_get(c->expanded_descriptors,key);
expandedUnexpandedMapList=(bufr_descriptors_map_list*)grib_trie_get(c->expanded_descriptors,key);
found=0;
while (expandedUnexpandedMapList) {
if (expandedUnexpandedMapList->unexpanded->n==size) {
@ -556,7 +556,7 @@ static void expanded_descriptor_list_push(grib_context* c,grib_trie* expanded_de
newdescriptorsList->expanded=expanded;
newdescriptorsList->unexpanded=unexpanded;
descriptorsList=grib_trie_get(expanded_descriptors,key);
descriptorsList=(bufr_descriptors_map_list*)grib_trie_get(expanded_descriptors,key);
if (descriptorsList) {
next=descriptorsList;
while(next->next) {

View File

@ -73,7 +73,7 @@ static int write_error=0;
static void new_keys_list()
{
grib_context* c = grib_context_get_default();
keys_list=grib_context_malloc_clear(c, sizeof(grib_string_list));
keys_list=(grib_string_list*)grib_context_malloc_clear(c, sizeof(grib_string_list));
if (!keys_list) {
fprintf(stderr, "Failed to allocate memory for keys list");
exit(1);
@ -586,7 +586,7 @@ static void save_error(grib_context* c,const char* key)
static char* double_as_string(grib_context* c, double v)
{
char* sval=grib_context_malloc_clear(c, sizeof(char)*40);
char* sval=(char*)grib_context_malloc_clear(c, sizeof(char)*40);
if (v == GRIB_MISSING_DOUBLE) sprintf(sval,"MISSING");
else sprintf(sval,"%.20e",v);
return sval;
@ -1069,7 +1069,7 @@ static int compare_attribute(grib_handle* handle1, grib_handle* handle2, grib_ru
{
int ret = 0;
grib_context* c = handle1->context;
char* fullname = grib_context_malloc_clear( c, sizeof(char)*(strlen(a->name)+strlen(prefix)+5) );
char* fullname = (char*)grib_context_malloc_clear( c, sizeof(char)*(strlen(a->name)+strlen(prefix)+5) );
sprintf(fullname, "%s->%s", prefix, a->name);
if (compare_values(options, handle1, handle2, fullname, GRIB_TYPE_UNDEFINED)) {
err++;
@ -1132,7 +1132,7 @@ static int compare_all_dump_keys(grib_handle* handle1, grib_handle* handle2, gri
/* Get full name of key, e.g. '#2#windSpeed' or 'blockNumber' */
rank = compute_bufr_key_rank(handle1, keys_list, xa->name);
if (rank != 0) {
prefix=grib_context_malloc_clear(context,sizeof(char)*(strlen(xa->name)+10));
prefix=(char*)grib_context_malloc_clear(context,sizeof(char)*(strlen(xa->name)+10));
dofree = 1;
sprintf(prefix,"#%d#%s", rank, xa->name);
} else {