From 9e9f4261abe887b1d98dedabd6b52dbc238d82bf Mon Sep 17 00:00:00 2001 From: ticktock35 Date: Mon, 15 Dec 2008 00:01:13 -0500 Subject: opkg: enable -Werror in libopkg and fix resulting build failures git-svn-id: http://opkg.googlecode.com/svn/trunk@52 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- diff --git a/libopkg/Makefile.am b/libopkg/Makefile.am index 4ea4fc5..f21ecb2 100644 --- a/libopkg/Makefile.am +++ b/libopkg/Makefile.am @@ -1,5 +1,5 @@ -ALL_CFLAGS=-g -O -Wall -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) +ALL_CFLAGS=-g -O -Wall -Werror -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) libopkg_includedir=$(includedir)/libopkg diff --git a/libopkg/file_util.c b/libopkg/file_util.c index da8a1cd..3ab1cc5 100644 --- a/libopkg/file_util.c +++ b/libopkg/file_util.c @@ -140,7 +140,7 @@ char *file_md5sum_alloc(const char *file_name) int i, err; FILE *file; - unsigned char *md5sum_hex; + char *md5sum_hex; unsigned char md5sum_bin[md5sum_bin_len]; md5sum_hex = malloc(md5sum_hex_len + 1); diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c index 8bb872c..8cda321 100644 --- a/libopkg/opkg_conf.c +++ b/libopkg/opkg_conf.c @@ -551,14 +551,14 @@ static int opkg_conf_parse_file(opkg_conf_t *conf, const char *filename, if (strcmp(type, "option") == 0) { opkg_conf_set_option(options, name, value); } else if (strcmp(type, "src") == 0) { - if (!nv_pair_list_find(pkg_src_list, name)) { + if (!nv_pair_list_find((nv_pair_list_t*) pkg_src_list, name)) { pkg_src_list_append (pkg_src_list, name, value, extra, 0); } else { opkg_message(conf, OPKG_ERROR, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n", name, value); } } else if (strcmp(type, "src/gz") == 0) { - if (!nv_pair_list_find(pkg_src_list, name)) { + if (!nv_pair_list_find((nv_pair_list_t*) pkg_src_list, name)) { pkg_src_list_append (pkg_src_list, name, value, extra, 1); } else { opkg_message(conf, OPKG_ERROR, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n", diff --git a/libopkg/opkg_configure.c b/libopkg/opkg_configure.c index ec7e5c8..94d37c2 100644 --- a/libopkg/opkg_configure.c +++ b/libopkg/opkg_configure.c @@ -16,7 +16,7 @@ */ #include "opkg.h" - +#include "sprintf_alloc.h" #include "opkg_configure.h" #include "opkg_state.h" diff --git a/libopkg/pkg.c b/libopkg/pkg.c index af2dd83..76bb61d 100644 --- a/libopkg/pkg.c +++ b/libopkg/pkg.c @@ -1159,10 +1159,10 @@ int pkg_version_satisfied(pkg_t *it, pkg_t *ref, const char *op) return 0; } -int pkg_name_version_and_architecture_compare(void *p1, void *p2) +int pkg_name_version_and_architecture_compare(const void *p1, const void *p2) { - const pkg_t *a = *(const pkg_t **)p1; - const pkg_t *b = *(const pkg_t **)p2; + const pkg_t *a = *(const pkg_t**) p1; + const pkg_t *b = *(const pkg_t**) p2; int namecmp; int vercmp; if (!a->name || !b->name) { @@ -1189,7 +1189,7 @@ int pkg_name_version_and_architecture_compare(void *p1, void *p2) return 0; } -int abstract_pkg_name_compare(void *p1, void *p2) +int abstract_pkg_name_compare(const void *p1, const void *p2) { const abstract_pkg_t *a = *(const abstract_pkg_t **)p1; const abstract_pkg_t *b = *(const abstract_pkg_t **)p2; diff --git a/libopkg/pkg.h b/libopkg/pkg.h index 0cb9ba1..de972b2 100644 --- a/libopkg/pkg.h +++ b/libopkg/pkg.h @@ -199,8 +199,8 @@ int pkg_merge(pkg_t *oldpkg, pkg_t *newpkg, int set_status); char *pkg_version_str_alloc(pkg_t *pkg); int pkg_compare_versions(const pkg_t *pkg, const pkg_t *ref_pkg); -int pkg_name_version_and_architecture_compare(void *a, void *b); -int abstract_pkg_name_compare(void *a, void *b); +int pkg_name_version_and_architecture_compare(const void *a, const void *b); +int abstract_pkg_name_compare(const void *a, const void *b); char * pkg_formatted_info(pkg_t *pkg ); char * pkg_formatted_field(pkg_t *pkg, const char *field ); diff --git a/libopkg/pkg_vec.c b/libopkg/pkg_vec.c index 2d22d91..690b7e6 100644 --- a/libopkg/pkg_vec.c +++ b/libopkg/pkg_vec.c @@ -101,7 +101,6 @@ pkg_t *pkg_vec_insert_merge(pkg_vec_t *vec, pkg_t *pkg, int set_status,opkg_conf void pkg_vec_insert(pkg_vec_t *vec, const pkg_t *pkg) { - int i; int found = 0; #if 0 @@ -132,10 +131,9 @@ int pkg_vec_contains(pkg_vec_t *vec, pkg_t *apkg) return 0; } -typedef int (*compare_fcn_t)(const void *, const void *); -void pkg_vec_sort(pkg_vec_t *vec, int (*compar)(pkg_t *, pkg_t *)) +void pkg_vec_sort(pkg_vec_t *vec, compare_fcn_t compar) { - qsort(vec->pkgs, vec->len, sizeof(pkg_t *), (compare_fcn_t)compar); + qsort(vec->pkgs, vec->len, sizeof(pkg_t *), compar); } int pkg_vec_clear_marks(pkg_vec_t *vec) @@ -191,7 +189,6 @@ void abstract_pkg_vec_free(abstract_pkg_vec_t *vec) */ void abstract_pkg_vec_insert(abstract_pkg_vec_t *vec, abstract_pkg_t *pkg) { - int i; #if 0 /* look for a duplicate pkg by name */ @@ -229,8 +226,8 @@ int abstract_pkg_vec_contains(abstract_pkg_vec_t *vec, abstract_pkg_t *apkg) return 0; } -void abstract_pkg_vec_sort(pkg_vec_t *vec, int (*compar)(abstract_pkg_t *, abstract_pkg_t *)) +void abstract_pkg_vec_sort(pkg_vec_t *vec, compare_fcn_t compar) { - qsort(vec->pkgs, vec->len, sizeof(pkg_t *), (compare_fcn_t)compar); + qsort(vec->pkgs, vec->len, sizeof(pkg_t *), compar); } diff --git a/libopkg/pkg_vec.h b/libopkg/pkg_vec.h index 2bc1631..8941c9b 100644 --- a/libopkg/pkg_vec.h +++ b/libopkg/pkg_vec.h @@ -47,7 +47,9 @@ pkg_t *pkg_vec_insert_merge(pkg_vec_t *vec, pkg_t *pkg, int set_status, opkg_con /* this one never munges pkg */ void pkg_vec_insert(pkg_vec_t *vec, const pkg_t *pkg); int pkg_vec_contains(pkg_vec_t *vec, pkg_t *apkg); -void pkg_vec_sort(pkg_vec_t *vec, int (*compar)(pkg_t *, pkg_t *)); + +typedef int (*compare_fcn_t)(const void *, const void *); +void pkg_vec_sort(pkg_vec_t *vec, compare_fcn_t compar); int pkg_vec_clear_marks(pkg_vec_t *vec); int pkg_vec_mark_if_matches(pkg_vec_t *vec, const char *pattern); @@ -57,6 +59,6 @@ void abstract_pkg_vec_free(abstract_pkg_vec_t *vec); void abstract_pkg_vec_insert(abstract_pkg_vec_t *vec, abstract_pkg_t *pkg); abstract_pkg_t * abstract_pkg_vec_get(abstract_pkg_vec_t *vec, int i); int abstract_pkg_vec_contains(abstract_pkg_vec_t *vec, abstract_pkg_t *apkg); -void abstract_pkg_vec_sort(pkg_vec_t *vec, int (*compar)(abstract_pkg_t *, abstract_pkg_t *)); +void abstract_pkg_vec_sort(pkg_vec_t *vec, compare_fcn_t compar); #endif -- cgit v0.9.1