Eliminate compiler warnings (and code error)

This commit is contained in:
Greg Sjaardema 2018-11-14 11:00:47 -07:00
parent 8cb325c33c
commit cd011cd1bb
4 changed files with 8 additions and 8 deletions

View File

@ -493,7 +493,7 @@ int
NC4_free_provenance(struct NCPROVENANCE* prov) NC4_free_provenance(struct NCPROVENANCE* prov)
{ {
if(prov == NULL) return NC_NOERR; if(prov == NULL) return NC_NOERR;
if(prov->propattr.properties != NULL); if(prov->propattr.properties != NULL)
nclistfreeall(prov->propattr.properties); nclistfreeall(prov->propattr.properties);
prov->propattr.properties = NULL; prov->propattr.properties = NULL;
free(prov); free(prov);

View File

@ -920,7 +920,7 @@ int ncstring_typ_tostring(const nctype_t *typ, safebuf_t *sfbf, const void *valp
int int
ncenum_typ_tostring(const nctype_t *typ, safebuf_t *sfbf, const void *valp) { ncenum_typ_tostring(const nctype_t *typ, safebuf_t *sfbf, const void *valp) {
char symbol[NC_MAX_NAME + 1]; char symbol[NC_MAX_NAME + 1];
long long val; long long val = 0;
switch (typ->base_tid) { switch (typ->base_tid) {
case NC_BYTE: case NC_BYTE:
@ -1215,7 +1215,7 @@ ncdouble_val_tostring(const ncvar_t *varp, safebuf_t *sfbf, const void *valp) {
* lose precision for values of type NC_INT64 or NC_UINT64 */ * lose precision for values of type NC_INT64 or NC_UINT64 */
static static
double to_double(const ncvar_t *varp, const void *valp) { double to_double(const ncvar_t *varp, const void *valp) {
double dd; double dd = 0.0;
switch (varp->type) { switch (varp->type) {
case NC_BYTE: case NC_BYTE:
dd = *(signed char *)valp; dd = *(signed char *)valp;

View File

@ -836,7 +836,7 @@ pr_att(
size_t type_size, nfields; size_t type_size, nfields;
nc_type base_nc_type; nc_type base_nc_type;
int class, i; int class, i;
void *data; void *data = NULL;
NC_CHECK( nc_inq_user_type(ncid, att.type, type_name, &type_size, NC_CHECK( nc_inq_user_type(ncid, att.type, type_name, &type_size,
&base_nc_type, &nfields, &class)); &base_nc_type, &nfields, &class));

View File

@ -553,10 +553,10 @@ retry: switch ((c=*p++)) {
case 'u': case 'u':
if(hcount == 2) { if(hcount == 2) {
snprintf(tmp,sizeof(tmp),"%hhu", snprintf(tmp,sizeof(tmp),"%hhu",
(unsigned int)va_arg(argv,unsigned int)); (unsigned char)va_arg(argv,unsigned int));
} else if(hcount == 1) { } else if(hcount == 1) {
snprintf(tmp,sizeof(tmp),"%hu", snprintf(tmp,sizeof(tmp),"%hu",
(unsigned int)va_arg(argv,unsigned int)); (unsigned short)va_arg(argv,unsigned int));
} else if(lcount == 2) { } else if(lcount == 2) {
snprintf(tmp,sizeof(tmp),"%llu", snprintf(tmp,sizeof(tmp),"%llu",
(unsigned long long)va_arg(argv,unsigned long long)); (unsigned long long)va_arg(argv,unsigned long long));
@ -572,10 +572,10 @@ retry: switch ((c=*p++)) {
case 'd': case 'd':
if(hcount == 2) { if(hcount == 2) {
snprintf(tmp,sizeof(tmp),"%hhd", snprintf(tmp,sizeof(tmp),"%hhd",
(signed int)va_arg(argv,signed int)); (signed char)va_arg(argv,signed int));
} else if(hcount == 1) { } else if(hcount == 1) {
snprintf(tmp,sizeof(tmp),"%hd", snprintf(tmp,sizeof(tmp),"%hd",
(signed int)va_arg(argv,signed int)); (signed short)va_arg(argv,signed int));
} else if(lcount == 2) { } else if(lcount == 2) {
snprintf(tmp,sizeof(tmp),"%lld", snprintf(tmp,sizeof(tmp),"%lld",
(signed long long)va_arg(argv,signed long long)); (signed long long)va_arg(argv,signed long long));