Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/dist/ntp Fix compile warnings in new code. Patches for thes...



details:   https://anonhg.NetBSD.org/src/rev/701212fc89e3
branches:  trunk
changeset: 485222:701212fc89e3
user:      simonb <simonb%NetBSD.org@localhost>
date:      Sat Apr 22 15:49:31 2000 +0000

description:
Fix compile warnings in new code.  Patches for these sent to the
ntp maintainer.

diffstat:

 dist/ntp/libntp/systime.c       |   6 +++---
 dist/ntp/ntpd/ntp_config.c      |   8 ++++----
 dist/ntp/ntpd/ntp_intres.c      |   6 ++++--
 dist/ntp/ntpd/ntp_request.c     |  18 +++++++++---------
 dist/ntp/ntpd/ntp_util.c        |   4 ++--
 dist/ntp/ntpd/refclock_oncore.c |   8 +++++---
 6 files changed, 27 insertions(+), 23 deletions(-)

diffs (206 lines):

diff -r a81f41ce3bc6 -r 701212fc89e3 dist/ntp/libntp/systime.c
--- a/dist/ntp/libntp/systime.c Sat Apr 22 15:34:05 2000 +0000
+++ b/dist/ntp/libntp/systime.c Sat Apr 22 15:49:31 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: systime.c,v 1.1.1.2 2000/04/22 14:53:00 simonb Exp $   */
+/*     $NetBSD: systime.c,v 1.2 2000/04/22 15:49:31 simonb Exp $       */
 
 /*
  * systime -- routines to fiddle a UNIX clock.
@@ -161,8 +161,8 @@
        /* casey - we need a posix type thang here */
        if (adjtime(&adjtv, &oadjtv) < 0)
        {
-               msyslog(LOG_ERR, "Can't adjust time (%d sec, %d usec): %m",
-                       adjtv.tv_sec, adjtv.tv_usec);
+               msyslog(LOG_ERR, "Can't adjust time (%ld sec, %ld usec): %m",
+                       (long)adjtv.tv_sec, (long)adjtv.tv_usec);
                return 0;
        } 
        else {
diff -r a81f41ce3bc6 -r 701212fc89e3 dist/ntp/ntpd/ntp_config.c
--- a/dist/ntp/ntpd/ntp_config.c        Sat Apr 22 15:34:05 2000 +0000
+++ b/dist/ntp/ntpd/ntp_config.c        Sat Apr 22 15:49:31 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ntp_config.c,v 1.1.1.2 2000/04/22 14:53:14 simonb Exp $        */
+/*     $NetBSD: ntp_config.c,v 1.2 2000/04/22 15:49:32 simonb Exp $    */
 
 /*
  * ntp_config.c - read and apply configuration information
@@ -710,7 +710,7 @@
        int ttl;
        keyid_t peerkey;
        char *peerkeystr;
-       keyid_t lpeerkey;
+       u_long lpeerkey;
        int peerflags;
        int hmode;
        struct sockaddr_in peeraddr;
@@ -1464,7 +1464,7 @@
 
                    case CONFIG_REQUESTKEY:
                        if (ntokens >= 2) {
-                               keyid_t rkey;
+                               u_long rkey;
 
                                if (!atouint(tokens[1], &rkey)) {
                                        msyslog(LOG_ERR,
@@ -1478,7 +1478,7 @@
 #ifdef DEBUG
                                        if (debug > 3)
                                            printf(
-                                                   "set info_auth_key to %08x\n", rkey);
+                                                   "set info_auth_key to %08lx\n", rkey);
 #endif
                                        info_auth_keyid = rkey;
                                }
diff -r a81f41ce3bc6 -r 701212fc89e3 dist/ntp/ntpd/ntp_intres.c
--- a/dist/ntp/ntpd/ntp_intres.c        Sat Apr 22 15:34:05 2000 +0000
+++ b/dist/ntp/ntpd/ntp_intres.c        Sat Apr 22 15:49:31 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ntp_intres.c,v 1.1.1.2 2000/04/22 14:53:16 simonb Exp $        */
+/*     $NetBSD: ntp_intres.c,v 1.2 2000/04/22 15:49:32 simonb Exp $    */
 
 /*
  * ripped off from ../ntpres/ntpres.c by Greg Troxel 4/2/92
@@ -448,6 +448,7 @@
        )
 {
        struct hostent *hp;
+       struct in_addr in;
 
        checkparent();          /* make sure our guy is still running */
 
@@ -475,7 +476,8 @@
                        msyslog(LOG_INFO, "findhostaddr: Resolving %x>",
                                entry->ce_peeraddr);
 #endif
-               hp = gethostbyaddr((const char *)entry->ce_peeraddr,
+               in.s_addr = entry->ce_peeraddr;
+               hp = gethostbyaddr((const char *)&in,
                                   sizeof entry->ce_peeraddr,
                                   AF_INET);
        }
diff -r a81f41ce3bc6 -r 701212fc89e3 dist/ntp/ntpd/ntp_request.c
--- a/dist/ntp/ntpd/ntp_request.c       Sat Apr 22 15:34:05 2000 +0000
+++ b/dist/ntp/ntpd/ntp_request.c       Sat Apr 22 15:49:31 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ntp_request.c,v 1.1.1.2 2000/04/22 14:53:20 simonb Exp $       */
+/*     $NetBSD: ntp_request.c,v 1.2 2000/04/22 15:49:33 simonb Exp $   */
 
 /*
  * ntp_request.c - respond to information requests
@@ -11,6 +11,8 @@
 #include <stdio.h>
 #include <signal.h>
 #include <sys/time.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
 #include "ntpd.h"
 #include "ntp_io.h"
@@ -537,10 +539,10 @@
        if (proc->sizeofitem != 0)
            if (proc->sizeofitem*INFO_NITEMS(inpkt->err_nitems)
                > sizeof(inpkt->data)) {
-                   msyslog(LOG_ERR, "sizeofitem(%d)*NITEMS(%d) > data: %d > %d",
+                   msyslog(LOG_ERR, "sizeofitem(%d)*NITEMS(%d) > data: %d > %ld",
                            proc->sizeofitem, INFO_NITEMS(inpkt->err_nitems),
                            proc->sizeofitem*INFO_NITEMS(inpkt->err_nitems),
-                           sizeof(inpkt->data));
+                           (long)sizeof(inpkt->data));
                    req_ack(srcadr, inter, inpkt, INFO_ERR_FMT);
                    return;
            }
@@ -1234,7 +1236,6 @@
        register struct info_dns_assoc *dp;
        register int items;
        struct sockaddr_in peeraddr;
-       int fl;
 
        /*
         * Do a check of everything to see that it looks
@@ -1273,7 +1274,6 @@
        while (items-- > 0) {
                u_short associd;
                size_t hnl;
-               char *cp;
                struct peer *peer;
                int bogon = 0;
 
@@ -1289,8 +1289,8 @@
                peeraddr.sin_addr.s_addr = dp->peeraddr;
                for (hnl = 0; dp->hostname[hnl] && hnl < sizeof dp->hostname; ++hnl) ;
                if (hnl >= sizeof dp->hostname) {
-                       msyslog(LOG_ERR, "dns_a: hnl (%d) >= %d",
-                               hnl, sizeof dp->hostname);
+                       msyslog(LOG_ERR, "dns_a: hnl (%ld) >= %ld",
+                               (long)hnl, (long)sizeof dp->hostname);
                        ++bogon;
                }
 
@@ -1433,7 +1433,7 @@
        if (flags & ~(SYS_FLAG_BCLIENT | SYS_FLAG_AUTHENTICATE |
                      SYS_FLAG_NTP | SYS_FLAG_KERNEL | SYS_FLAG_MONITOR |
                      SYS_FLAG_FILEGEN)) {
-               msyslog(LOG_ERR, "setclr_flags: extra flags: %#x",
+               msyslog(LOG_ERR, "setclr_flags: extra flags: %#lx",
                        flags & ~(SYS_FLAG_BCLIENT | SYS_FLAG_AUTHENTICATE | 
                                  SYS_FLAG_NTP | SYS_FLAG_KERNEL |
                                  SYS_FLAG_MONITOR | SYS_FLAG_FILEGEN));
@@ -1740,7 +1740,7 @@
        flags = ((struct reset_flags *)inpkt->data)->flags;
 
        if (flags & ~RESET_ALLFLAGS) {
-               msyslog(LOG_ERR, "reset_stats: reset leaves %#x",
+               msyslog(LOG_ERR, "reset_stats: reset leaves %#lx",
                        flags & ~RESET_ALLFLAGS);
                req_ack(srcadr, inter, inpkt, INFO_ERR_FMT);
                return;
diff -r a81f41ce3bc6 -r 701212fc89e3 dist/ntp/ntpd/ntp_util.c
--- a/dist/ntp/ntpd/ntp_util.c  Sat Apr 22 15:34:05 2000 +0000
+++ b/dist/ntp/ntpd/ntp_util.c  Sat Apr 22 15:49:31 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ntp_util.c,v 1.1.1.2 2000/04/22 14:53:22 simonb Exp $  */
+/*     $NetBSD: ntp_util.c,v 1.2 2000/04/22 15:49:33 simonb Exp $      */
 
 /*
  * ntp_util.c - stuff I didn't have any other place for
@@ -355,7 +355,7 @@
                (void) fclose(fp);
                if (   !finite(old_drift)
                    || (fabs(old_drift) > (sys_maxfreq * 1e6))) {
-                       msyslog(LOG_ERR, "invalid frequency (%lf) in %s", 
+                       msyslog(LOG_ERR, "invalid frequency (%f) in %s", 
                            old_drift, stats_drift_file);
                        exit(1);
                }
diff -r a81f41ce3bc6 -r 701212fc89e3 dist/ntp/ntpd/refclock_oncore.c
--- a/dist/ntp/ntpd/refclock_oncore.c   Sat Apr 22 15:34:05 2000 +0000
+++ b/dist/ntp/ntpd/refclock_oncore.c   Sat Apr 22 15:49:31 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: refclock_oncore.c,v 1.1.1.1 2000/03/29 12:38:53 simonb Exp $   */
+/*     $NetBSD: refclock_oncore.c,v 1.2 2000/04/22 15:49:33 simonb Exp $       */
 
 /*
  * ----------------------------------------------------------------------------
@@ -1589,7 +1589,8 @@
 
                if (debug > 2)
                        printf("ONCORE: serial/j (%lu, %d) %ld.%09ld\n",
-                           pps_i.assert_sequence, j, tsp->tv_sec, tsp->tv_nsec);
+                           (long)pps_i.assert_sequence, j,
+                           (long)tsp->tv_sec, (long)tsp->tv_nsec);
 
                if (pps_i.assert_sequence == j) {
                        printf("ONCORE: oncore_msg_En, error serial pps\n");
@@ -1601,7 +1602,8 @@
 
                if (debug > 2)
                        printf("ONCORE: serial/j (%lu, %d) %ld.%09ld\n",
-                           pps_i.clear_sequence, j, tsp->tv_sec, tsp->tv_nsec);
+                           (long)pps_i.clear_sequence, j,
+                           (long)tsp->tv_sec, (long)tsp->tv_nsec);
 
                if (pps_i.clear_sequence == j) {
                        printf("ONCORE: oncore_msg_En, error serial pps\n");



Home | Main Index | Thread Index | Old Index