From ff49be7a3cd831fe157eb01546780c005cc6aed4 Mon Sep 17 00:00:00 2001 From: J. Ali Harlow Date: Sat, 23 Aug 2014 16:28:31 +0100 Subject: [PATCH] Fix compiler warnings --- configure.ac | 2 +- librazor/error.c | 2 +- librazor/importer.c | 2 +- librazor/iterator.c | 1 + librazor/lua.c | 6 +++--- librazor/razor.c | 4 +--- librazor/rpm.c | 4 ++-- librazor/transaction.c | 5 +---- librazor/util.c | 5 ++++- src/import-yum.c | 4 ++-- src/main.c | 2 ++ 11 files changed, 19 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index b7c9968..e4bb68a 100644 --- a/configure.ac +++ b/configure.ac @@ -118,7 +118,7 @@ if test "x$GCC" = "xyes"; then changequote(,)dnl case " $CFLAGS " in *[\ \ ]-Wall[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wall" ;; + *) CFLAGS="$CFLAGS -Wall -Wno-parentheses" ;; esac case " $CFLAGS " in diff --git a/librazor/error.c b/librazor/error.c index c847663..2ad1207 100644 --- a/librazor/error.c +++ b/librazor/error.c @@ -27,7 +27,7 @@ #include "razor.h" #include "razor-internal.h" -const char *razor_error_get_path_str(struct razor_error *error) +static const char *razor_error_get_path_str(struct razor_error *error) { if (error->path_str) return error->path_str; diff --git a/librazor/importer.c b/librazor/importer.c index 7eeff31..c4dc56c 100644 --- a/librazor/importer.c +++ b/librazor/importer.c @@ -434,7 +434,7 @@ build_file_tree(struct razor_importer *importer) struct import_entry *filenames; char *f, *end; uint32_t name, *r, s; - char rootname[256], dirname[256]; + char dirname[256]; struct import_directory *d, *last_root; struct array roots; struct razor_entry *e; diff --git a/librazor/iterator.c b/librazor/iterator.c index 1bf22e6..c77cbbf 100644 --- a/librazor/iterator.c +++ b/librazor/iterator.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "razor-internal.h" #include "razor.h" diff --git a/librazor/lua.c b/librazor/lua.c index f5299f1..58b2531 100644 --- a/librazor/lua.c +++ b/librazor/lua.c @@ -323,13 +323,13 @@ RAZOR_EXPORT void razor_set_lua_loader(const char *modname, void (*loader)()) end = razor_preload.loaders.data + razor_preload.loaders.size; for(ploader = razor_preload.loaders.data; ploader < end; ploader++) if (ploader->name == name) { - ploader->func = loader; + ploader->func = (lua_CFunction)loader; return; } ploader = array_add(&razor_preload.loaders, sizeof(*ploader)); ploader->name = name; - ploader->func = loader; + ploader->func = (lua_CFunction)loader; } RAZOR_EXPORT void (*razor_get_lua_loader(const char *modname))() @@ -345,7 +345,7 @@ RAZOR_EXPORT void (*razor_get_lua_loader(const char *modname))() end = razor_preload.loaders.data + razor_preload.loaders.size; for(ploader = razor_preload.loaders.data; ploader < end; ploader++) if (ploader->name == name) - return ploader->func; + return (void (*)())ploader->func; return 0; } diff --git a/librazor/razor.c b/librazor/razor.c index 6685192..9917649 100644 --- a/librazor/razor.c +++ b/librazor/razor.c @@ -1225,7 +1225,7 @@ razor_install_iterator_commit_set(struct razor_install_iterator *ii) { struct razor_merger *merger; struct razor_set *set; - struct razor_package *n, *nend, *npkgs, *s, *send, *spkgs; + struct razor_package *n, *nend, *s, *send; struct deque *done; size_t pos; char *npool, *spool; @@ -1237,12 +1237,10 @@ razor_install_iterator_commit_set(struct razor_install_iterator *ii) deque_shift(done); s = ii->set->packages.data; - spkgs = ii->set->packages.data; send = ii->set->packages.data + ii->set->packages.size; spool = ii->set->string_pool.data; n = ii->next->packages.data; - npkgs = ii->next->packages.data; nend = ii->next->packages.data + ii->next->packages.size; npool = ii->next->string_pool.data; diff --git a/librazor/rpm.c b/librazor/rpm.c index 59b7d8f..ff58f4a 100644 --- a/librazor/rpm.c +++ b/librazor/rpm.c @@ -1077,7 +1077,7 @@ installer_init(struct installer *installer) err = inflateInit2(&installer->stream, -MAX_WBITS); if (err != Z_OK) { sprintf(buffer, "%d", err); - s = razor_concat("inflateEnd error: ", s, NULL); + s = razor_concat("inflateEnd error: ", buffer, NULL); razor_atomic_abort(installer->atomic, s); free(s); return -1; @@ -1096,7 +1096,7 @@ installer_finish(struct installer *installer) if (err != Z_OK) { sprintf(buffer, "%d", err); - s = razor_concat("inflateEnd error: ", s, NULL); + s = razor_concat("inflateEnd error: ", buffer, NULL); razor_atomic_abort(installer->atomic, s); free(s); } diff --git a/librazor/transaction.c b/librazor/transaction.c index 7879be9..5e2a748 100644 --- a/librazor/transaction.c +++ b/librazor/transaction.c @@ -293,7 +293,7 @@ remove_matching_providers(struct razor_transaction *trans, const char *version) { struct razor_property *p; - struct razor_package *pkg, *pkgs; + struct razor_package *pkg; struct razor_package_iterator pkg_iter; struct razor_set *set; const char *n, *v; @@ -304,7 +304,6 @@ remove_matching_providers(struct razor_transaction *trans, else set = trans->upstream.set; - pkgs = (struct razor_package *) set->packages.data; type = ppi->p->flags & RAZOR_PROPERTY_TYPE_MASK; for (p = ppi->p; p < ppi->end && @@ -425,10 +424,8 @@ static void remove_obsoleted_packages(struct razor_transaction *trans) { struct razor_property *up; - struct razor_package *spkgs; struct prop_iter spi, upi; - spkgs = trans->system.set->packages.data; prop_iter_init(&spi, &trans->system); prop_iter_init(&upi, &trans->upstream); diff --git a/librazor/util.c b/librazor/util.c index 026b640..a09dcd1 100644 --- a/librazor/util.c +++ b/librazor/util.c @@ -244,7 +244,10 @@ void environment_add_variable(struct environment *env, void environment_set(struct environment *env) { int i, count; - char *s, *t; + char *s; +#ifndef WIN32 + char *t; +#endif uint32_t *r; if (!env->is_set) { diff --git a/src/import-yum.c b/src/import-yum.c index fb07544..fd0aa43 100644 --- a/src/import-yum.c +++ b/src/import-yum.c @@ -287,7 +287,7 @@ razor_set_create_from_yum(void) { struct yum_context ctx={0}; void *buf; - int len, ret; + int len; gzFile primary, filelists; XML_ParsingStatus status; @@ -325,7 +325,7 @@ razor_set_create_from_yum(void) XML_GetParsingStatus(ctx.current_parser, &status); switch (status.parsing) { case XML_SUSPENDED: - ret = XML_ResumeParser(ctx.current_parser); + XML_ResumeParser(ctx.current_parser); break; case XML_PARSING: case XML_INITIALIZED: diff --git a/src/main.c b/src/main.c index c5772a1..c307e89 100644 --- a/src/main.c +++ b/src/main.c @@ -411,6 +411,7 @@ command_what_provides(int argc, const char *argv[]) RAZOR_PROPERTY_PROVIDES); } +#ifdef HAVE_CURL static int show_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) @@ -423,6 +424,7 @@ show_progress(void *clientp, return 0; } +#endif /* HAVE_CURL */ static int download_if_missing(const char *url, const char *file) -- 1.7.1