Change code to compile with -Wall -Wextra.

--HG--
extra : convert_revision : 992e1515458c6ee36cd481d1ba0ff8febf892d12
This commit is contained in:
Juan RP 2009-02-18 01:07:51 +01:00
parent 028cacdd2a
commit 3b18195a6a
8 changed files with 34 additions and 12 deletions

View file

@ -67,6 +67,8 @@ static int
list_pkgs_in_dict(prop_object_t obj, void *arg, bool *loop_done) list_pkgs_in_dict(prop_object_t obj, void *arg, bool *loop_done)
{ {
const char *pkgname, *version, *short_desc; const char *pkgname, *version, *short_desc;
(void)arg;
(void)*loop_done;
assert(prop_object_type(obj) == PROP_TYPE_DICTIONARY); assert(prop_object_type(obj) == PROP_TYPE_DICTIONARY);
@ -94,6 +96,8 @@ static int
show_missing_dep_cb(prop_object_t obj, void *arg, bool *loop_done) show_missing_dep_cb(prop_object_t obj, void *arg, bool *loop_done)
{ {
const char *pkgname, *version; const char *pkgname, *version;
(void)arg;
(void)loop_done;
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname);
prop_dictionary_get_cstring_nocopy(obj, "version", &version); prop_dictionary_get_cstring_nocopy(obj, "version", &version);
@ -170,11 +174,14 @@ main(int argc, char **argv)
if (strcasecmp(argv[0], "install") == 0) { if (strcasecmp(argv[0], "install") == 0) {
rv = xbps_install_binary_pkg(argv[1], root, flags); rv = xbps_install_binary_pkg(argv[1], root, flags);
if (rv != 0 && rv != EEXIST) { if (rv != 0 && rv != EEXIST) {
dict = xbps_get_pkg_deps_dictionary(); if (rv == ENOENT) {
if (dict == NULL && errno == ENOENT)
printf("Unable to locate %s in " printf("Unable to locate %s in "
"repository pool.\n", argv[1]); "repository pool.\n", argv[1]);
else if (dict && errno == ENOENT) exit(EXIT_FAILURE);
}
dict = xbps_get_pkg_deps_dictionary();
if (dict && errno == ENOENT)
show_missing_deps(dict, argv[1]); show_missing_deps(dict, argv[1]);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);

View file

@ -127,6 +127,9 @@ search_string_in_pkgs(prop_object_t obj, void *arg, bool *loop_done)
const char *repofile; const char *repofile;
char *plist; char *plist;
(void)arg;
(void)loop_done;
assert(prop_object_type(obj) == PROP_TYPE_STRING); assert(prop_object_type(obj) == PROP_TYPE_STRING);
/* Get the location of pkgindex file. */ /* Get the location of pkgindex file. */
@ -244,6 +247,9 @@ show_pkg_namedesc(prop_object_t obj, void *arg, bool *loop_done)
{ {
const char *pkgname, *desc, *ver, *string = arg; const char *pkgname, *desc, *ver, *string = arg;
(void)arg;
(void)loop_done;
assert(prop_object_type(obj) == PROP_TYPE_DICTIONARY); assert(prop_object_type(obj) == PROP_TYPE_DICTIONARY);
assert(string != NULL); assert(string != NULL);
@ -264,6 +270,8 @@ list_strings_in_array2(prop_object_t obj, void *arg, bool *loop_done)
static uint16_t count; static uint16_t count;
const char *sep; const char *sep;
(void)loop_done;
assert(prop_object_type(obj) == PROP_TYPE_STRING); assert(prop_object_type(obj) == PROP_TYPE_STRING);
if (arg == NULL) { if (arg == NULL) {
@ -286,6 +294,8 @@ list_strings_in_array2(prop_object_t obj, void *arg, bool *loop_done)
int int
list_strings_in_array(prop_object_t obj, void *arg, bool *loop_done) list_strings_in_array(prop_object_t obj, void *arg, bool *loop_done)
{ {
(void)arg;
(void)loop_done;
assert(prop_object_type(obj) == PROP_TYPE_STRING); assert(prop_object_type(obj) == PROP_TYPE_STRING);
printf("%s\n", prop_string_cstring_nocopy(obj)); printf("%s\n", prop_string_cstring_nocopy(obj));

View file

@ -27,7 +27,7 @@
#define _XBPS_INSTALL_H_ #define _XBPS_INSTALL_H_
/* From lib/install.c, lib/depends.c and lib/unpack.c */ /* From lib/install.c, lib/depends.c and lib/unpack.c */
int xbps_install_pkg_deps(prop_dictionary_t, const char *, int); int xbps_install_pkg_deps(const char *, const char *, int);
int xbps_install_binary_pkg(const char *, const char *, int); int xbps_install_binary_pkg(const char *, const char *, int);
int xbps_install_binary_pkg_fini(prop_dictionary_t, prop_dictionary_t, int xbps_install_binary_pkg_fini(prop_dictionary_t, prop_dictionary_t,
const char *, int); const char *, int);

View file

@ -591,15 +591,19 @@ find_pkg_deps_from_repo(prop_dictionary_t repo, prop_dictionary_t pkg,
} }
int int
xbps_install_pkg_deps(prop_dictionary_t pkg, const char *destdir, int flags) xbps_install_pkg_deps(const char *pkgname, const char *destdir, int flags)
{ {
prop_array_t required, missing; prop_array_t required, missing;
prop_object_t obj; prop_object_t obj;
prop_object_iterator_t iter; prop_object_iterator_t iter;
int rv = 0; int rv = 0;
assert(pkg != NULL); /*
* If origin object in chaindeps is not the same, bail out.
*/
obj = prop_dictionary_get(chaindeps, "origin");
if (obj == NULL || !prop_string_equals_cstring(obj, pkgname))
return EINVAL;
/* /*
* If there are missing deps, bail out. * If there are missing deps, bail out.
*/ */

View file

@ -166,7 +166,7 @@ install_binpkg_repo_cb(prop_object_t obj, void *arg, bool *cbloop_done)
/* /*
* Install all required dependencies and the package itself. * Install all required dependencies and the package itself.
*/ */
if ((rv = xbps_install_pkg_deps(pkgrd, destdir, cb->flags)) == 0) { if ((rv = xbps_install_pkg_deps(pkgname, destdir, cb->flags)) == 0) {
rv = xbps_install_binary_pkg_fini(repod, pkgrd, destdir, rv = xbps_install_binary_pkg_fini(repod, pkgrd, destdir,
cb->flags); cb->flags);
prop_object_release(repod); prop_object_release(repod);

View file

@ -104,7 +104,7 @@
/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/ /*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/
/* Hash constant words K for SHA-256: */ /* Hash constant words K for SHA-256: */
const static sha2_word32 K256[64] = { static const sha2_word32 K256[64] = {
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
@ -124,7 +124,7 @@ const static sha2_word32 K256[64] = {
}; };
/* Initial hash value H for SHA-256: */ /* Initial hash value H for SHA-256: */
const static sha2_word32 sha256_initial_hash_value[8] = { static const sha2_word32 sha256_initial_hash_value[8] = {
0x6a09e667UL, 0x6a09e667UL,
0xbb67ae85UL, 0xbb67ae85UL,
0x3c6ef372UL, 0x3c6ef372UL,

View file

@ -128,7 +128,8 @@ xbps_sort_pkg_deps(prop_dictionary_t chaindeps)
prop_object_iterator_t iter; prop_object_iterator_t iter;
struct sorted_dependency *sdep, *sdep2; struct sorted_dependency *sdep, *sdep2;
uint32_t maxprio = 0; uint32_t maxprio = 0;
size_t curidx = 0, indirdepscnt = 0, dirdepscnt = 0, cnt = 0; size_t indirdepscnt = 0, dirdepscnt = 0, cnt = 0;
ssize_t curidx = 0;
const char *curpkg, *rundep; const char *curpkg, *rundep;
char *pkgname; char *pkgname;
int rv = 0; int rv = 0;

View file

@ -10,4 +10,4 @@ INSTALL_STRIPPED ?= -s
LDFLAGS += -L$(TOPDIR)/lib -L$(PREFIX)/lib -lxbps LDFLAGS += -L$(TOPDIR)/lib -L$(PREFIX)/lib -lxbps
CPPFLAGS += -I$(TOPDIR)/include CPPFLAGS += -I$(TOPDIR)/include
CFLAGS += -Wstack-protector -fstack-protector-all CFLAGS += -Wstack-protector -fstack-protector-all
CFLAGS += -O2 -Wall -Werror -fPIC -DPIC CFLAGS += -O2 -Wall -Wextra -Werror -fPIC -DPIC