libarchive: Avoid bogus conversion warning from PGI compiler
We cannot suppress PGI compiler warnings completely because even with the "-w" flag the compiler still writes a message containing "compilation completed with warnings" to stderr. A warning is triggered by expressions like test ? NULL : ptr_to_const_char test ? ".." : ptr_to_const_char that the PGI compiler handles incorrectly. It chooses the pointer type of the first option (either void* or char*) and warns about conversion of the second without a cast. Flip the expression logic to !test ? ptr_to_const_char : NULL !test ? ptr_to_const_char : ".." to help the compiler choose the proper result type.
This commit is contained in:
parent
9ccaeb10f9
commit
65b6e19a35
|
@ -41,9 +41,9 @@ _archive_set_option(struct archive *a,
|
||||||
|
|
||||||
archive_check_magic(a, magic, ARCHIVE_STATE_NEW, fn);
|
archive_check_magic(a, magic, ARCHIVE_STATE_NEW, fn);
|
||||||
|
|
||||||
mp = m != NULL && m[0] == '\0' ? NULL : m;
|
mp = m != NULL && m[0] != '\0' ? m : NULL;
|
||||||
op = o != NULL && o[0] == '\0' ? NULL : o;
|
op = o != NULL && o[0] != '\0' ? o : NULL;
|
||||||
vp = v != NULL && v[0] == '\0' ? NULL : v;
|
vp = v != NULL && v[0] != '\0' ? v : NULL;
|
||||||
|
|
||||||
if (op == NULL && vp == NULL)
|
if (op == NULL && vp == NULL)
|
||||||
return (ARCHIVE_OK);
|
return (ARCHIVE_OK);
|
||||||
|
|
|
@ -902,7 +902,7 @@ static const char *
|
||||||
_archive_filter_name(struct archive *_a, int n)
|
_archive_filter_name(struct archive *_a, int n)
|
||||||
{
|
{
|
||||||
struct archive_read_filter *f = get_filter(_a, n);
|
struct archive_read_filter *f = get_filter(_a, n);
|
||||||
return f == NULL ? NULL : f->name;
|
return f != NULL ? f->name : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t
|
static int64_t
|
||||||
|
|
|
@ -1095,7 +1095,7 @@ init_decompression(struct archive_read *a, struct _7zip *zip,
|
||||||
}
|
}
|
||||||
archive_set_error(&a->archive, err,
|
archive_set_error(&a->archive, err,
|
||||||
"Internal error initializing decompressor: %s",
|
"Internal error initializing decompressor: %s",
|
||||||
detail == NULL ? "??" : detail);
|
detail != NULL ? detail : "??");
|
||||||
zip->bzstream_valid = 0;
|
zip->bzstream_valid = 0;
|
||||||
return (ARCHIVE_FAILED);
|
return (ARCHIVE_FAILED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -698,7 +698,7 @@ static const char *
|
||||||
_archive_filter_name(struct archive *_a, int n)
|
_archive_filter_name(struct archive *_a, int n)
|
||||||
{
|
{
|
||||||
struct archive_write_filter *f = filter_lookup(_a, n);
|
struct archive_write_filter *f = filter_lookup(_a, n);
|
||||||
return f == NULL ? NULL : f->name;
|
return f != NULL ? f->name : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t
|
static int64_t
|
||||||
|
|
Loading…
Reference in New Issue