From 012a5048366fb661ce37287dcf6de60497f102dc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 14 Nov 2009 02:35:10 +0100 Subject: [PATCH] fix various compiler warnings --- avahi-client/client.c | 1 + avahi-common/strlst-test.c | 28 +++++++++++----------- avahi-common/timeval-test.c | 8 +++---- avahi-compat-libdns_sd/txt-test.c | 18 +++++++------- avahi-discover-standalone/main.c | 40 +++++++++++++++---------------- avahi-gobject/ga-entry-group.c | 2 +- 6 files changed, 49 insertions(+), 48 deletions(-) diff --git a/avahi-client/client.c b/avahi-client/client.c index 389a3d1..bb8c20f 100644 --- a/avahi-client/client.c +++ b/avahi-client/client.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "client.h" #include "internal.h" diff --git a/avahi-common/strlst-test.c b/avahi-common/strlst-test.c index 71f748d..b9a7baa 100644 --- a/avahi-common/strlst-test.c +++ b/avahi-common/strlst-test.c @@ -2,17 +2,17 @@ /*** This file is part of avahi. - + avahi is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + avahi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with avahi; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -37,7 +37,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { int r; a = avahi_string_list_new("prefix", "a", "b", NULL); - + a = avahi_string_list_add(a, "start"); a = avahi_string_list_add(a, "foo=99"); a = avahi_string_list_add(a, "bar"); @@ -50,18 +50,18 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { a = avahi_string_list_add_pair(a, "blubb", "blaa"); a = avahi_string_list_add_pair(a, "uxknurz", NULL); a = avahi_string_list_add_pair_arbitrary(a, "uxknurz2", (const uint8_t*) "blafasel\0oerks", 14); - + a = avahi_string_list_add(a, "end"); t = avahi_string_list_to_string(a); printf("--%s--\n", t); avahi_free(t); - + n = avahi_string_list_serialize(a, NULL, 0); size = avahi_string_list_serialize(a, data, sizeof(data)); assert(size == n); - printf("%u\n", size); + printf("%zu\n", size); for (t = (char*) data, n = 0; n < size; n++, t++) { if (*t <= 32) @@ -71,11 +71,11 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { } printf("\n"); - + assert(avahi_string_list_parse(data, size, &b) == 0); printf("equal: %i\n", avahi_string_list_equal(a, b)); - + t = avahi_string_list_to_string(b); printf("--%s--\n", t); avahi_free(t); @@ -92,12 +92,12 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { p = avahi_string_list_find(a, "seven"); assert(p); - - r = avahi_string_list_get_pair(p, &t, &v, NULL); + + r = avahi_string_list_get_pair(p, &t, &v, NULL); assert(r >= 0); assert(t); assert(v); - + printf("<%s>=<%s>\n", t, v); avahi_free(t); avahi_free(v); @@ -113,7 +113,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { printf("<%s>=<%s>\n", t, v); avahi_free(t); avahi_free(v); - + avahi_string_list_free(a); avahi_string_list_free(b); @@ -124,6 +124,6 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { assert(avahi_string_list_parse(data, size, &a) == 0); assert(!a); - + return 0; } diff --git a/avahi-common/timeval-test.c b/avahi-common/timeval-test.c index 92fcab2..553c37e 100644 --- a/avahi-common/timeval-test.c +++ b/avahi-common/timeval-test.c @@ -2,17 +2,17 @@ /*** This file is part of avahi. - + avahi is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + avahi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with avahi; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -39,7 +39,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { printf("%li.%li\n", a.tv_sec, a.tv_usec); - printf("%lli\n", avahi_timeval_diff(&a, &b)); + printf("%lli\n", (long long) avahi_timeval_diff(&a, &b)); return 0; } diff --git a/avahi-compat-libdns_sd/txt-test.c b/avahi-compat-libdns_sd/txt-test.c index 149a38c..cc220f3 100644 --- a/avahi-compat-libdns_sd/txt-test.c +++ b/avahi-compat-libdns_sd/txt-test.c @@ -2,17 +2,17 @@ /*** This file is part of avahi. - + avahi is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + avahi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with avahi; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -34,7 +34,7 @@ static void hexdump(const void* p, size_t size) { const uint8_t *c = p; assert(p); - printf("Dumping %u bytes from %p:\n", size, p); + printf("Dumping %zu bytes from %p:\n", size, p); while (size > 0) { unsigned i; @@ -87,10 +87,10 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { TXTRecordSetValue(&ref, "yeah", 0, NULL); hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref)); - + TXTRecordSetValue(&ref, "waldo", 6, "rocked"); hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref)); - + TXTRecordRemoveValue(&ref, "foo"); hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref)); @@ -99,7 +99,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { TXTRecordSetValue(&ref, "kawumm", 6, "bloerb"); hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref)); - + TXTRecordSetValue(&ref, "one", 1, "1"); hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref)); @@ -108,7 +108,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { TXTRecordSetValue(&ref, "three", 1, "3"); hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref)); - + assert(TXTRecordContainsKey(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), "two")); assert(!TXTRecordContainsKey(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), "four")); @@ -125,6 +125,6 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { hexdump(p, l); assert(TXTRecordGetItemAtIndex(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), 20, sizeof(k), k, &l, &p) == kDNSServiceErr_Invalid); - + TXTRecordDeallocate(&ref); } diff --git a/avahi-discover-standalone/main.c b/avahi-discover-standalone/main.c index 6f5a657..57e307d 100644 --- a/avahi-discover-standalone/main.c +++ b/avahi-discover-standalone/main.c @@ -2,17 +2,17 @@ /*** This file is part of avahi. - + avahi is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + avahi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with avahi; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -82,7 +82,7 @@ static struct Service *get_service(const gchar *service_type, const gchar *servi for (l = st->services; l; l = l->next) { struct Service *s = l->data; - + if (s->interface == interface && s->protocol == protocol && avahi_domain_equal(s->service_name, service_name) && @@ -104,17 +104,17 @@ static void free_service(struct Service *s) { avahi_s_service_resolver_free(service_resolver); service_resolver = NULL; } - + gtk_label_set_text(info_label, "Service removed"); } - + s->service_type->services = g_list_remove(s->service_type->services, s); if ((path = gtk_tree_row_reference_get_path(s->tree_ref))) { gtk_tree_model_get_iter(GTK_TREE_MODEL(tree_store), &iter, path); gtk_tree_path_free(path); } - + gtk_tree_store_remove(tree_store, &iter); gtk_tree_row_reference_free(s->tree_ref); @@ -141,7 +141,7 @@ static void service_browser_callback( GtkTreePath *path, *ppath; gchar iface[256]; char name[IF_NAMESIZE]; - + s = g_new(struct Service, 1); s->service_name = g_strdup(service_name); s->domain_name = g_strdup(domain_name); @@ -149,7 +149,7 @@ static void service_browser_callback( s->protocol = protocol; s->service_type = g_hash_table_lookup(service_type_hash_table, service_type); g_assert(s->service_type); - + s->service_type->services = g_list_prepend(s->service_type->services, s); ppath = gtk_tree_row_reference_get_path(s->service_type->tree_ref); @@ -167,7 +167,7 @@ static void service_browser_callback( gtk_tree_view_expand_row(tree_view, ppath, FALSE); gtk_tree_path_free(ppath); - + } else if (event == AVAHI_BROWSER_REMOVE) { struct Service* s; @@ -185,7 +185,7 @@ static void service_type_browser_callback( const char *domain, AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, AVAHI_GCC_UNUSED void * userdata) { - + struct ServiceType *st; GtkTreePath *path; GtkTreeIter iter; @@ -199,7 +199,7 @@ static void service_type_browser_callback( st = g_new(struct ServiceType, 1); st->service_type = g_strdup(service_type); st->services = NULL; - + gtk_tree_store_append(tree_store, &iter, NULL); gtk_tree_store_set(tree_store, &iter, 0, st->service_type, 1, "", 2, NULL, -1); @@ -229,7 +229,7 @@ static void update_label(struct Service *s, const gchar *hostname, const AvahiAd snprintf(address, sizeof(address), "n/a"); txt_s = g_strdup("n/a"); } - + snprintf(t, sizeof(t), "Service Type: %s\n" "Service Name: %s\n" @@ -253,12 +253,12 @@ static struct Service *get_service_on_cursor(void) { GtkTreePath *path; struct Service *s; GtkTreeIter iter; - + gtk_tree_view_get_cursor(tree_view, &path, NULL); if (!path) return NULL; - + gtk_tree_model_get_iter(GTK_TREE_MODEL(tree_store), &iter, path); gtk_tree_model_get(GTK_TREE_MODEL(tree_store), &iter, 2, &s, -1); gtk_tree_path_free(path); @@ -278,9 +278,9 @@ static void service_resolver_callback( const AvahiAddress *a, uint16_t port, AvahiStringList *txt, - AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, + AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, void* userdata) { - + struct Service *s; g_assert(r); @@ -301,7 +301,7 @@ static void service_resolver_callback( static void tree_view_on_cursor_changed(AVAHI_GCC_UNUSED GtkTreeView *tv, AVAHI_GCC_UNUSED gpointer userdata) { struct Service *s; - + if (!(s = get_service_on_cursor())) return; @@ -349,9 +349,9 @@ int main(int argc, char *argv[]) { gtk_tree_view_column_set_resizable(c = gtk_tree_view_get_column(tree_view, 0), TRUE); gtk_tree_view_column_set_sizing(c, GTK_TREE_VIEW_COLUMN_GROW_ONLY); gtk_tree_view_column_set_expand(c, TRUE); - + service_type_hash_table = g_hash_table_new((GHashFunc) avahi_domain_hash, (GEqualFunc) avahi_domain_equal); - + avahi_server_config_init(&config); config.publish_hinfo = config.publish_addresses = config.publish_domain = config.publish_workstation = FALSE; server = avahi_server_new(avahi_glib_poll_get(poll_api), &config, NULL, NULL, &error); diff --git a/avahi-gobject/ga-entry-group.c b/avahi-gobject/ga-entry-group.c index c4f2e37..0f0ab74 100644 --- a/avahi-gobject/ga-entry-group.c +++ b/avahi-gobject/ga-entry-group.c @@ -558,7 +558,7 @@ gboolean ga_entry_group_service_remove_key(GaEntryGroupService * service, GaEntryGroupServicePrivate *priv = (GaEntryGroupServicePrivate *) service; GaEntryGroupServiceEntry entry; - entry.value = key; + entry.value = (void*) key; entry.size = strlen(key); g_hash_table_remove(priv->entries, &entry); -- 2.39.2