From c5a2851e96afd3e06785551ab90eb1157407e6cb Mon Sep 17 00:00:00 2001 From: gandalf Date: Wed, 26 May 2004 16:04:48 +0000 Subject: Get rid of some warnings when compiling 64bit. --- extensions/libip6t_LOG.c | 2 +- extensions/libipt_LOG.c | 2 +- extensions/libipt_ULOG.c | 10 +++++----- extensions/libipt_owner.c | 2 +- ip6tables-restore.c | 4 ++-- ip6tables-save.c | 4 ++-- ip6tables.c | 26 +++++++++++++------------- iptables-restore.c | 4 ++-- iptables-save.c | 4 ++-- iptables.c | 26 +++++++++++++------------- libiptc/libip4tc.c | 2 +- libiptc/libip6tc.c | 2 +- libiptc/libiptc.c | 6 +++--- 13 files changed, 47 insertions(+), 47 deletions(-) diff --git a/extensions/libip6t_LOG.c b/extensions/libip6t_LOG.c index 997e439..74655af 100644 --- a/extensions/libip6t_LOG.c +++ b/extensions/libip6t_LOG.c @@ -134,7 +134,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, if (strlen(optarg) > sizeof(loginfo->prefix) - 1) exit_error(PARAMETER_PROBLEM, "Maximum prefix length %u for --log-prefix", - sizeof(loginfo->prefix) - 1); + (unsigned int)sizeof(loginfo->prefix) - 1); strcpy(loginfo->prefix, optarg); *flags |= IP6T_LOG_OPT_PREFIX; diff --git a/extensions/libipt_LOG.c b/extensions/libipt_LOG.c index f8c8e4b..37185e7 100644 --- a/extensions/libipt_LOG.c +++ b/extensions/libipt_LOG.c @@ -134,7 +134,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, if (strlen(optarg) > sizeof(loginfo->prefix) - 1) exit_error(PARAMETER_PROBLEM, "Maximum prefix length %u for --log-prefix", - sizeof(loginfo->prefix) - 1); + (unsigned int)sizeof(loginfo->prefix) - 1); strcpy(loginfo->prefix, optarg); *flags |= IPT_LOG_OPT_PREFIX; diff --git a/extensions/libipt_ULOG.c b/extensions/libipt_ULOG.c index 5371911..5ced462 100644 --- a/extensions/libipt_ULOG.c +++ b/extensions/libipt_ULOG.c @@ -110,7 +110,7 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, if (strlen(optarg) > sizeof(loginfo->prefix) - 1) exit_error(PARAMETER_PROBLEM, "Maximum prefix length %u for --ulog-prefix", - sizeof(loginfo->prefix) - 1); + (unsigned int)sizeof(loginfo->prefix) - 1); strcpy(loginfo->prefix, optarg); *flags |= IPT_LOG_OPT_PREFIX; @@ -177,10 +177,10 @@ static void save(const struct ipt_ip *ip, printf("--ulog-qthreshold %llu ", loginfo->qthreshold); #else if (loginfo->copy_range) - printf("--ulog-cprange %d ", loginfo->copy_range); + printf("--ulog-cprange %u ", (unsigned int)loginfo->copy_range); if (loginfo->qthreshold != ULOG_DEFAULT_QTHRESHOLD) - printf("--ulog-qthreshold %d ", loginfo->qthreshold); + printf("--ulog-qthreshold %u ", (unsigned int)loginfo->qthreshold); #endif } @@ -196,7 +196,7 @@ print(const struct ipt_ip *ip, #ifdef KERNEL_64_USERSPACE_32 printf("copy_range %llu nlgroup ", loginfo->copy_range); #else - printf("copy_range %d nlgroup ", loginfo->copy_range); + printf("copy_range %u nlgroup ", (unsigned int)loginfo->copy_range); #endif print_groups(loginfo->nl_group); if (strcmp(loginfo->prefix, "") != 0) @@ -204,7 +204,7 @@ print(const struct ipt_ip *ip, #ifdef KERNEL_64_USERSPACE_32 printf("queue_threshold %llu ", loginfo->qthreshold); #else - printf("queue_threshold %d ", loginfo->qthreshold); + printf("queue_threshold %u ", (unsigned int)loginfo->qthreshold); #endif } diff --git a/extensions/libipt_owner.c b/extensions/libipt_owner.c index 9c92ab2..9d112cf 100644 --- a/extensions/libipt_owner.c +++ b/extensions/libipt_owner.c @@ -125,7 +125,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, case '5': check_inverse(optarg, &invert, &optind, 0); if(strlen(optarg) > sizeof(ownerinfo->comm)) - exit_error(PARAMETER_PROBLEM, "OWNER CMD `%s' too long, max %d characters", optarg, sizeof(ownerinfo->comm)); + exit_error(PARAMETER_PROBLEM, "OWNER CMD `%s' too long, max %u characters", optarg, (unsigned int)sizeof(ownerinfo->comm)); strncpy(ownerinfo->comm, optarg, sizeof(ownerinfo->comm)); ownerinfo->comm[sizeof(ownerinfo->comm)-1] = '\0'; diff --git a/ip6tables-restore.c b/ip6tables-restore.c index cf23058..906f93e 100644 --- a/ip6tables-restore.c +++ b/ip6tables-restore.c @@ -7,7 +7,7 @@ * Rusty Russell * This code is distributed under the terms of GNU GPL v2 * - * $Id: ip6tables-restore.c,v 1.20 2004/02/02 20:12:33 gandalf Exp $ + * $Id: ip6tables-restore.c,v 1.21 2004/02/02 20:14:56 gandalf Exp $ */ #include @@ -76,7 +76,7 @@ ip6tc_handle_t create_handle(const char *tablename, const char* modprobe) int parse_counters(char *string, struct ip6t_counters *ctr) { - return (sscanf(string, "[%llu:%llu]", &ctr->pcnt, &ctr->bcnt) == 2); + return (sscanf(string, "[%llu:%llu]", (unsigned long long *)&ctr->pcnt, (unsigned long long *)&ctr->bcnt) == 2); } /* global new argv and argc */ diff --git a/ip6tables-save.c b/ip6tables-save.c index 50757a9..9deed33 100644 --- a/ip6tables-save.c +++ b/ip6tables-save.c @@ -149,7 +149,7 @@ static void print_rule(const struct ip6t_entry *e, /* print counters */ if (counters) - printf("[%llu:%llu] ", e->counters.pcnt, e->counters.bcnt); + printf("[%llu:%llu] ", (unsigned long long)e->counters.pcnt, (unsigned long long)e->counters.bcnt); /* print chain name */ printf("-A %s ", chain); @@ -277,7 +277,7 @@ static int do_output(const char *tablename) struct ip6t_counters count; printf("%s ", ip6tc_get_policy(chain, &count, &h)); - printf("[%llu:%llu]\n", count.pcnt, count.bcnt); + printf("[%llu:%llu]\n", (unsigned long long)count.pcnt, (unsigned long long)count.bcnt); } else { printf("- [0:0]\n"); } diff --git a/ip6tables.c b/ip6tables.c index 714632d..257f4ee 100644 --- a/ip6tables.c +++ b/ip6tables.c @@ -889,8 +889,8 @@ parse_target(const char *targetname) if (strlen(targetname)+1 > sizeof(ip6t_chainlabel)) exit_error(PARAMETER_PROBLEM, - "Invalid target name `%s' (%i chars max)", - targetname, sizeof(ip6t_chainlabel)-1); + "Invalid target name `%s' (%u chars max)", + targetname, (unsigned int)sizeof(ip6t_chainlabel)-1); for (ptr = targetname; *ptr; ptr++) if (isspace(*ptr)) @@ -1063,7 +1063,7 @@ register_match6(struct ip6tables_match *me) if (me->size != IP6T_ALIGN(me->size)) { fprintf(stderr, "%s: match `%s' has invalid size %u.\n", - program_name, me->name, me->size); + program_name, me->name, (unsigned int)me->size); exit(1); } @@ -1093,7 +1093,7 @@ register_target6(struct ip6tables_target *me) if (me->size != IP6T_ALIGN(me->size)) { fprintf(stderr, "%s: target `%s' has invalid size %u.\n", - program_name, me->name, me->size); + program_name, me->name, (unsigned int)me->size); exit(1); } @@ -1116,17 +1116,17 @@ print_num(u_int64_t number, unsigned int format) number = (number + 500) / 1000; if (number > 9999) { number = (number + 500) / 1000; - printf(FMT("%4lluT ","%lluT "), number); + printf(FMT("%4lluT ","%lluT "), (unsigned long long)number); } - else printf(FMT("%4lluG ","%lluG "), number); + else printf(FMT("%4lluG ","%lluG "), (unsigned long long)number); } - else printf(FMT("%4lluM ","%lluM "), number); + else printf(FMT("%4lluM ","%lluM "), (unsigned long long)number); } else - printf(FMT("%4lluK ","%lluK "), number); + printf(FMT("%4lluK ","%lluK "), (unsigned long long)number); } else - printf(FMT("%5llu ","%llu "), number); + printf(FMT("%5llu ","%llu "), (unsigned long long)number); } else - printf(FMT("%8llu ","%llu "), number); + printf(FMT("%8llu ","%llu "), (unsigned long long)number); } @@ -1316,7 +1316,7 @@ print_firewall(const struct ip6t_entry *fw, target->print(&fw->ipv6, t, format & FMT_NUMERIC); } else if (t->u.target_size != sizeof(*t)) printf("[%u bytes of unknown target data] ", - t->u.target_size - sizeof(*t)); + (unsigned int)(t->u.target_size - sizeof(*t))); if (!(format & FMT_NONEWLINE)) fputc('\n', stdout); @@ -2026,12 +2026,12 @@ int do_command6(int argc, char *argv[], char **table, ip6tc_handle_t *handle) "-%c requires packet and byte counter", opt2char(OPT_COUNTERS)); - if (sscanf(pcnt, "%llu", &fw.counters.pcnt) != 1) + if (sscanf(pcnt, "%llu", (unsigned long long *)&fw.counters.pcnt) != 1) exit_error(PARAMETER_PROBLEM, "-%c packet counter not numeric", opt2char(OPT_COUNTERS)); - if (sscanf(bcnt, "%llu", &fw.counters.bcnt) != 1) + if (sscanf(bcnt, "%llu", (unsigned long long *)&fw.counters.bcnt) != 1) exit_error(PARAMETER_PROBLEM, "-%c byte counter not numeric", opt2char(OPT_COUNTERS)); diff --git a/iptables-restore.c b/iptables-restore.c index 46590ca..e21cacc 100644 --- a/iptables-restore.c +++ b/iptables-restore.c @@ -4,7 +4,7 @@ * * This code is distributed under the terms of GNU GPL v2 * - * $Id: iptables-restore.c,v 1.32 2004/02/01 21:46:04 gandalf Exp $ + * $Id: iptables-restore.c,v 1.33 2004/02/01 22:03:27 gandalf Exp $ */ #include @@ -73,7 +73,7 @@ iptc_handle_t create_handle(const char *tablename, const char* modprobe ) int parse_counters(char *string, struct ipt_counters *ctr) { - return (sscanf(string, "[%llu:%llu]", &ctr->pcnt, &ctr->bcnt) == 2); + return (sscanf(string, "[%llu:%llu]", (unsigned long long *)&ctr->pcnt, (unsigned long long *)&ctr->bcnt) == 2); } /* global new argv and argc */ diff --git a/iptables-save.c b/iptables-save.c index 3f6e074..14314a5 100644 --- a/iptables-save.c +++ b/iptables-save.c @@ -165,7 +165,7 @@ static void print_rule(const struct ipt_entry *e, /* print counters */ if (counters) - printf("[%llu:%llu] ", e->counters.pcnt, e->counters.bcnt); + printf("[%llu:%llu] ", (unsigned long long)e->counters.pcnt, (unsigned long long)e->counters.bcnt); /* print chain name */ printf("-A %s ", chain); @@ -284,7 +284,7 @@ static int do_output(const char *tablename) struct ipt_counters count; printf("%s ", iptc_get_policy(chain, &count, &h)); - printf("[%llu:%llu]\n", count.pcnt, count.bcnt); + printf("[%llu:%llu]\n", (unsigned long long)count.pcnt, (unsigned long long)count.bcnt); } else { printf("- [0:0]\n"); } diff --git a/iptables.c b/iptables.c index fab4643..951193e 100644 --- a/iptables.c +++ b/iptables.c @@ -829,8 +829,8 @@ parse_target(const char *targetname) if (strlen(targetname)+1 > sizeof(ipt_chainlabel)) exit_error(PARAMETER_PROBLEM, - "Invalid target name `%s' (%i chars max)", - targetname, sizeof(ipt_chainlabel)-1); + "Invalid target name `%s' (%u chars max)", + targetname, (unsigned int)sizeof(ipt_chainlabel)-1); for (ptr = targetname; *ptr; ptr++) if (isspace(*ptr)) @@ -1063,7 +1063,7 @@ register_match(struct iptables_match *me) if (me->size != IPT_ALIGN(me->size)) { fprintf(stderr, "%s: match `%s' has invalid size %u.\n", - program_name, me->name, me->size); + program_name, me->name, (unsigned int)me->size); exit(1); } @@ -1093,7 +1093,7 @@ register_target(struct iptables_target *me) if (me->size != IPT_ALIGN(me->size)) { fprintf(stderr, "%s: target `%s' has invalid size %u.\n", - program_name, me->name, me->size); + program_name, me->name, (unsigned int)me->size); exit(1); } @@ -1116,17 +1116,17 @@ print_num(u_int64_t number, unsigned int format) number = (number + 500) / 1000; if (number > 9999) { number = (number + 500) / 1000; - printf(FMT("%4lluT ","%lluT "), number); + printf(FMT("%4lluT ","%lluT "), (unsigned long long)number); } - else printf(FMT("%4lluG ","%lluG "), number); + else printf(FMT("%4lluG ","%lluG "), (unsigned long long)number); } - else printf(FMT("%4lluM ","%lluM "), number); + else printf(FMT("%4lluM ","%lluM "), (unsigned long long)number); } else - printf(FMT("%4lluK ","%lluK "), number); + printf(FMT("%4lluK ","%lluK "), (unsigned long long)number); } else - printf(FMT("%5llu ","%llu "), number); + printf(FMT("%5llu ","%llu "), (unsigned long long)number); } else - printf(FMT("%8llu ","%llu "), number); + printf(FMT("%8llu ","%llu "), (unsigned long long)number); } @@ -1314,7 +1314,7 @@ print_firewall(const struct ipt_entry *fw, target->print(&fw->ip, t, format & FMT_NUMERIC); } else if (t->u.target_size != sizeof(*t)) printf("[%u bytes of unknown target data] ", - t->u.target_size - sizeof(*t)); + (unsigned int)(t->u.target_size - sizeof(*t))); if (!(format & FMT_NONEWLINE)) fputc('\n', stdout); @@ -2027,12 +2027,12 @@ int do_command(int argc, char *argv[], char **table, iptc_handle_t *handle) "-%c requires packet and byte counter", opt2char(OPT_COUNTERS)); - if (sscanf(pcnt, "%llu", &fw.counters.pcnt) != 1) + if (sscanf(pcnt, "%llu", (unsigned long long *)&fw.counters.pcnt) != 1) exit_error(PARAMETER_PROBLEM, "-%c packet counter not numeric", opt2char(OPT_COUNTERS)); - if (sscanf(bcnt, "%llu", &fw.counters.bcnt) != 1) + if (sscanf(bcnt, "%llu", (unsigned long long *)&fw.counters.bcnt) != 1) exit_error(PARAMETER_PROBLEM, "-%c byte counter not numeric", opt2char(OPT_COUNTERS)); diff --git a/libiptc/libip4tc.c b/libiptc/libip4tc.c index 76a8281..d394315 100644 --- a/libiptc/libip4tc.c +++ b/libiptc/libip4tc.c @@ -145,7 +145,7 @@ dump_entry(STRUCT_ENTRY *e, const TC_HANDLE_T handle) printf("Flags: %02X\n", e->ip.flags); printf("Invflags: %02X\n", e->ip.invflags); printf("Counters: %llu packets, %llu bytes\n", - e->counters.pcnt, e->counters.bcnt); + (unsigned long long)e->counters.pcnt, (unsigned long long)e->counters.bcnt); printf("Cache: %08X ", e->nfcache); if (e->nfcache & NFC_ALTERED) printf("ALTERED "); if (e->nfcache & NFC_UNKNOWN) printf("UNKNOWN "); diff --git a/libiptc/libip6tc.c b/libiptc/libip6tc.c index f7947db..6400ce3 100644 --- a/libiptc/libip6tc.c +++ b/libiptc/libip6tc.c @@ -176,7 +176,7 @@ dump_entry(struct ip6t_entry *e, const ip6tc_handle_t handle) printf("Flags: %02X\n", e->ipv6.flags); printf("Invflags: %02X\n", e->ipv6.invflags); printf("Counters: %llu packets, %llu bytes\n", - e->counters.pcnt, e->counters.bcnt); + (unsigned long long)e->counters.pcnt, (unsigned long long)e->counters.bcnt); printf("Cache: %08X ", e->nfcache); if (e->nfcache & NFC_ALTERED) printf("ALTERED "); if (e->nfcache & NFC_UNKNOWN) printf("UNKNOWN "); diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c index 3ff7e27..b29111d 100644 --- a/libiptc/libiptc.c +++ b/libiptc/libiptc.c @@ -1,4 +1,4 @@ -/* Library which manipulates firewall rules. Version $Revision: 1.45 $ */ +/* Library which manipulates firewall rules. Version $Revision: 1.46 $ */ /* Architecture of firewall rules is as follows: * @@ -134,8 +134,8 @@ entry2index(const TC_HANDLE_T h, const STRUCT_ENTRY *seek) if (ENTRY_ITERATE(h->entries.entrytable, h->entries.size, get_number, seek, &pos) == 0) { - fprintf(stderr, "ERROR: offset %i not an entry!\n", - (char *)seek - (char *)h->entries.entrytable); + fprintf(stderr, "ERROR: offset %u not an entry!\n", + (unsigned int)((char *)seek - (char *)h->entries.entrytable)); abort(); } return pos; -- cgit v1.2.3