]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Get rid of some warnings when compiling 64bit.
authorMartin Josefsson <gandalf@wlug.westbo.se>
Wed, 26 May 2004 16:04:48 +0000 (16:04 +0000)
committerMartin Josefsson <gandalf@wlug.westbo.se>
Wed, 26 May 2004 16:04:48 +0000 (16:04 +0000)
13 files changed:
extensions/libip6t_LOG.c
extensions/libipt_LOG.c
extensions/libipt_ULOG.c
extensions/libipt_owner.c
ip6tables-restore.c
ip6tables-save.c
ip6tables.c
iptables-restore.c
iptables-save.c
iptables.c
libiptc/libip4tc.c
libiptc/libip6tc.c
libiptc/libiptc.c

index 997e4393c59b30eb51a51f1c391ac5f3aa405666..74655af2baf38d59f3e38e76ed361f8e1c2b81ee 100644 (file)
@@ -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;
index f8c8e4bd33f37ab09ec065d0430a15d3b3254ca0..37185e751715aba278fde354841c49907054766a 100644 (file)
@@ -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;
index 5371911609a48842d7bd83c8be71ed28c6a4e7d8..5ced4628b2bafd44581dbc848fa495277d435ef5 100644 (file)
@@ -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
 }
 
index 9c92ab2a42e328278295c11a4f02612dee4b157c..9d112cf3b81d746859e190336b9b838f2fe92523 100644 (file)
@@ -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';
index cf23058111fa4db09bbf974a4d2b6a7a04c332fe..906f93eeff86b6def74a18049808e6b02db44749 100644 (file)
@@ -7,7 +7,7 @@
  *     Rusty Russell <rusty@linuxcare.com.au>
  * 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 <getopt.h>
@@ -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 */
index 50757a9258fdc1e0d9f7916a3ee45d2fc4e6fc7c..9deed33c8fa87ce8692227400683643b6b65ba2b 100644 (file)
@@ -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");
                        }
index 714632d2b72b49acc692b60eca183ed58ddb17ea..257f4eea39849a17ab98edee296d2bbd93bc160d 100644 (file)
@@ -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));
index 46590ca95af78b74d35e8ace40b47286002b1e41..e21cacc5beb625c714e615897b1e787a880895c6 100644 (file)
@@ -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 <getopt.h>
@@ -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 */
index 3f6e0745e38f7fb4c9a52c438c9d7737a78b868a..14314a5f3f1688ae9bb487a9e3872a009f5dbfac 100644 (file)
@@ -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");
                        }
index fab46430874aad963d5e7c67302e7a4ee8748ed4..951193e6f9b1fc1deaa950e7be1a27c029474dab 100644 (file)
@@ -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));
index 76a8281b8994cfaab112fa65d4d9412185f56544..d394315fc35c9d4daebb5f5d9ff1773f8dc7648b 100644 (file)
@@ -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 ");
index f7947db776815ee0d133b1a4061cf660d40228bf..6400ce3084ce57336abad130abbe7c21b0701ad9 100644 (file)
@@ -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 ");
index 3ff7e27459399f2e1931dfca50ec6baab1d864eb..b29111df7be435f6b58bc36a5ffd3bb93162d0fe 100644 (file)
@@ -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;