Build code with -Wcast-qual, -Wcast-align and -Wsign-compare.
--HG-- extra : convert_revision : d489ad995bb69850cba5a352f3ac85b74a54b5cf
This commit is contained in:
parent
ae1fb7b50c
commit
bd3484fa6b
9 changed files with 16 additions and 10 deletions
|
@ -207,7 +207,7 @@ repoidx_addpkg(const char *file, const char *filename, const char *pkgdir)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
prop_dictionary_set_uint64(newpkgd, "filename-size",
|
prop_dictionary_set_uint64(newpkgd, "filename-size",
|
||||||
st.st_size);
|
(uint64_t)st.st_size);
|
||||||
/*
|
/*
|
||||||
* Add dictionary into the index and update package count.
|
* Add dictionary into the index and update package count.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -118,7 +118,7 @@ show_pkg_info(prop_dictionary_t dict)
|
||||||
printf("Configuration files:\n");
|
printf("Configuration files:\n");
|
||||||
sep = " ";
|
sep = " ";
|
||||||
(void)xbps_callback_array_iter_in_dict(dict, "conf_files",
|
(void)xbps_callback_array_iter_in_dict(dict, "conf_files",
|
||||||
list_strings_sep_in_array, (void *)sep);
|
list_strings_sep_in_array, __UNCONST(sep));
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ show_pkg_info(prop_dictionary_t dict)
|
||||||
printf("Permanent directories:\n");
|
printf("Permanent directories:\n");
|
||||||
sep = " ";
|
sep = " ";
|
||||||
(void)xbps_callback_array_iter_in_dict(dict, "keep_dirs",
|
(void)xbps_callback_array_iter_in_dict(dict, "keep_dirs",
|
||||||
list_strings_sep_in_array, (void *)sep);
|
list_strings_sep_in_array, __UNCONST(sep));
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,10 @@
|
||||||
|
|
||||||
#define ARCHIVE_READ_BLOCKSIZE 2048
|
#define ARCHIVE_READ_BLOCKSIZE 2048
|
||||||
|
|
||||||
|
#ifndef __UNCONST
|
||||||
|
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* from lib/cmpver.c */
|
/* from lib/cmpver.c */
|
||||||
int xbps_cmpver_packages(const char *, const char *);
|
int xbps_cmpver_packages(const char *, const char *);
|
||||||
int xbps_cmpver_versions(const char *, const char *);
|
int xbps_cmpver_versions(const char *, const char *);
|
||||||
|
@ -105,7 +109,8 @@ bool xbps_add_obj_to_dict(prop_dictionary_t, prop_object_t,
|
||||||
bool xbps_add_obj_to_array(prop_array_t, prop_object_t);
|
bool xbps_add_obj_to_array(prop_array_t, prop_object_t);
|
||||||
|
|
||||||
int xbps_callback_array_iter_in_dict(prop_dictionary_t,
|
int xbps_callback_array_iter_in_dict(prop_dictionary_t,
|
||||||
const char *, int (*fn)(prop_object_t, void *, bool *),
|
const char *,
|
||||||
|
int (*fn)(prop_object_t, void *, bool *),
|
||||||
void *);
|
void *);
|
||||||
int xbps_callback_array_iter_in_repolist(int (*fn)(prop_object_t,
|
int xbps_callback_array_iter_in_repolist(int (*fn)(prop_object_t,
|
||||||
void *, bool *), void *);
|
void *, bool *), void *);
|
||||||
|
|
|
@ -241,7 +241,7 @@ xbps_cmpver_packages(const char *pkg1, const char *pkg2)
|
||||||
|
|
||||||
/* Shortcut check for equality before invoking the parsing routines. */
|
/* Shortcut check for equality before invoking the parsing routines. */
|
||||||
if (result == 0 && (ve1 - v1 != ve2 - v2 ||
|
if (result == 0 && (ve1 - v1 != ve2 - v2 ||
|
||||||
strncasecmp(v1, v2, ve1 - v1) != 0)) {
|
strncasecmp(v1, v2, (size_t)ve1 - (size_t)v1) != 0)) {
|
||||||
/* Loop over different components (the parts separated by dots).
|
/* Loop over different components (the parts separated by dots).
|
||||||
* If any component differs, we have the basis for an inequality. */
|
* If any component differs, we have the basis for an inequality. */
|
||||||
while(result == 0 && (v1 < ve1 || v2 < ve2)) {
|
while(result == 0 && (v1 < ve1 || v2 < ve2)) {
|
||||||
|
|
|
@ -70,7 +70,7 @@ pfcexec(const char *path, const char *file, const char **argv)
|
||||||
_exit(127);
|
_exit(127);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)execvp(file, (char ** const)argv);
|
(void)execvp(file, (char ** const)__UNCONST(argv));
|
||||||
_exit(127);
|
_exit(127);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
case -1:
|
case -1:
|
||||||
|
|
|
@ -106,7 +106,7 @@ xbps_humanize_number(char *buf, size_t len, int64_t bytes,
|
||||||
|
|
||||||
if (scale & (HN_AUTOSCALE | HN_GETSCALE)) {
|
if (scale & (HN_AUTOSCALE | HN_GETSCALE)) {
|
||||||
/* See if there is additional columns can be used. */
|
/* See if there is additional columns can be used. */
|
||||||
for (max = 100, i = len - baselen; i-- > 0;)
|
for (max = 100, i = (int)(len - baselen); i-- > 0;)
|
||||||
max *= 10;
|
max *= 10;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -140,7 +140,7 @@ xbps_requiredby_pkg_remove(const char *pkgname)
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = xbps_callback_array_iter_in_dict(dict, "packages",
|
rv = xbps_callback_array_iter_in_dict(dict, "packages",
|
||||||
remove_pkg_from_reqby, (void *)pkgname);
|
remove_pkg_from_reqby, __UNCONST(pkgname));
|
||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
if (!prop_dictionary_externalize_to_file(dict, plist))
|
if (!prop_dictionary_externalize_to_file(dict, plist))
|
||||||
rv = errno;
|
rv = errno;
|
||||||
|
|
|
@ -371,8 +371,8 @@ SHA256_End(SHA256_CTX *ctx, uint8_t *buffer)
|
||||||
SHA256_Final(digest, ctx);
|
SHA256_Final(digest, ctx);
|
||||||
|
|
||||||
for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
|
for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
|
||||||
*buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
|
*buffer++ = (uint8_t)sha2_hex_digits[(*d & 0xf0) >> 4];
|
||||||
*buffer++ = sha2_hex_digits[*d & 0x0f];
|
*buffer++ = (uint8_t)sha2_hex_digits[*d & 0x0f];
|
||||||
d++;
|
d++;
|
||||||
}
|
}
|
||||||
*buffer = (char) 0;
|
*buffer = (char) 0;
|
||||||
|
|
1
vars.mk
1
vars.mk
|
@ -12,4 +12,5 @@ CPPFLAGS += -I$(TOPDIR)/include -D_BSD_SOURCE -D_XOPEN_SOURCE=600
|
||||||
CPPFLAGS += -D_GNU_SOURCE
|
CPPFLAGS += -D_GNU_SOURCE
|
||||||
WARNFLAGS ?= -pedantic -std=c99 -Wall -Wextra -Werror -Wshadow -Wformat=2
|
WARNFLAGS ?= -pedantic -std=c99 -Wall -Wextra -Werror -Wshadow -Wformat=2
|
||||||
WARNFLAGS += -Wmissing-declarations -Wcomment -Wunused-macros -Wendif-labels
|
WARNFLAGS += -Wmissing-declarations -Wcomment -Wunused-macros -Wendif-labels
|
||||||
|
WARNFLAGS += -Wcast-qual -Wcast-align -Wsign-conversion
|
||||||
CFLAGS += $(WARNFLAGS) -O2 -fPIC -DPIC
|
CFLAGS += $(WARNFLAGS) -O2 -fPIC -DPIC
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue