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)
{
const char *pkgname, *version, *short_desc;
(void)arg;
(void)*loop_done;
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)
{
const char *pkgname, *version;
(void)arg;
(void)loop_done;
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname);
prop_dictionary_get_cstring_nocopy(obj, "version", &version);
@ -170,11 +174,14 @@ main(int argc, char **argv)
if (strcasecmp(argv[0], "install") == 0) {
rv = xbps_install_binary_pkg(argv[1], root, flags);
if (rv != 0 && rv != EEXIST) {
dict = xbps_get_pkg_deps_dictionary();
if (dict == NULL && errno == ENOENT)
if (rv == ENOENT) {
printf("Unable to locate %s in "
"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]);
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;
char *plist;
(void)arg;
(void)loop_done;
assert(prop_object_type(obj) == PROP_TYPE_STRING);
/* 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;
(void)arg;
(void)loop_done;
assert(prop_object_type(obj) == PROP_TYPE_DICTIONARY);
assert(string != NULL);
@ -264,6 +270,8 @@ list_strings_in_array2(prop_object_t obj, void *arg, bool *loop_done)
static uint16_t count;
const char *sep;
(void)loop_done;
assert(prop_object_type(obj) == PROP_TYPE_STRING);
if (arg == NULL) {
@ -286,6 +294,8 @@ list_strings_in_array2(prop_object_t obj, void *arg, bool *loop_done)
int
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);
printf("%s\n", prop_string_cstring_nocopy(obj));

View File

@ -27,7 +27,7 @@
#define _XBPS_INSTALL_H_
/* 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_fini(prop_dictionary_t, prop_dictionary_t,
const char *, int);

View File

@ -591,15 +591,19 @@ find_pkg_deps_from_repo(prop_dictionary_t repo, prop_dictionary_t pkg,
}
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_object_t obj;
prop_object_iterator_t iter;
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.
*/

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.
*/
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,
cb->flags);
prop_object_release(repod);

View File

@ -104,7 +104,7 @@
/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/
/* Hash constant words K for SHA-256: */
const static sha2_word32 K256[64] = {
static const sha2_word32 K256[64] = {
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
@ -124,7 +124,7 @@ const static sha2_word32 K256[64] = {
};
/* 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,
0xbb67ae85UL,
0x3c6ef372UL,

View File

@ -128,7 +128,8 @@ xbps_sort_pkg_deps(prop_dictionary_t chaindeps)
prop_object_iterator_t iter;
struct sorted_dependency *sdep, *sdep2;
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;
char *pkgname;
int rv = 0;

View File

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