]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
WINNT specific includes were included in wrong place.
authorDanny Mayer <mayer@ntp.org>
Mon, 25 Mar 2002 00:25:36 +0000 (19:25 -0500)
committerDanny Mayer <mayer@ntp.org>
Mon, 25 Mar 2002 00:25:36 +0000 (19:25 -0500)
Casting issue fixes.

bk: 3c9e6e80xvPZzo_xnYNpNgXh6DN-bw

include/ntp_machine.h
libntp/binio.c
libntp/caljulian.c
libntp/dofptoa.c
libntp/dolfptoa.c
ntpd/ntp_config.c
ntpd/ntp_refclock.c
ntpd/ntp_request.c

index 9e72565701c5258a44905852e7d3a5ee9d6f4663..40f1c28d29c9fa415ada576212258c147db396d4 100644 (file)
@@ -9,10 +9,6 @@
 # include <config.h>
 #endif
 
-# include <windows.h>
-# include <ws2tcpip.h>
-# include <winsock2.h>
-
 #ifdef TIME_WITH_SYS_TIME
 # include <sys/time.h>
 # include <time.h>
@@ -245,6 +241,9 @@ typedef unsigned long u_long;
 # if !defined(HAVE_CONFIG_H)  || !defined(__config)
     error "NT requires config.h to be included"
 # endif /* HAVE_CONFIG_H) */
+# include <windows.h>
+# include <ws2tcpip.h>
+# include <winsock2.h>
 
 # define ifreq _INTERFACE_INFO
 # define ifr_flags iiFlags
@@ -270,7 +269,9 @@ typedef unsigned long u_long;
  * Defining registers are not a good idea on Windows
  * This gets rid of the usage
  */
+#ifndef register
 # define register
+#endif
  typedef char *caddr_t;
 #endif /* SYS_WINNT */
 
index cc3b408df9e85f11091f5975d9316e7cb8a9cd6b..bbaf06f4e002f7646cb1951d2751987121a352df 100644 (file)
@@ -27,8 +27,8 @@ put_lsb_short(
        long val
        )
 {
-  *((*bufpp)++) =  val       & 0xFF;
-  *((*bufpp)++) = (val >> 8) & 0xFF;
+  *((*bufpp)++) = (unsigned char) (val        & 0xFF);
+  *((*bufpp)++) = (unsigned char) ((val >> 8) & 0xFF);
 }
 
 long
@@ -52,10 +52,10 @@ put_lsb_long(
        long val
        )
 {
-  *((*bufpp)++) =  val        & 0xFF;
-  *((*bufpp)++) = (val >> 8)  & 0xFF;
-  *((*bufpp)++) = (val >> 16) & 0xFF;
-  *((*bufpp)++) = (val >> 24) & 0xFF;
+  *((*bufpp)++) = (unsigned char)(val         & 0xFF);
+  *((*bufpp)++) = (unsigned char)((val >> 8)  & 0xFF);
+  *((*bufpp)++) = (unsigned char)((val >> 16) & 0xFF);
+  *((*bufpp)++) = (unsigned char)((val >> 24) & 0xFF);
 }
 
 long
@@ -77,8 +77,8 @@ put_msb_short(
        long val
        )
 {
-  *((*bufpp)++) = (val >> 8) & 0xFF;
-  *((*bufpp)++) =  val       & 0xFF;
+  *((*bufpp)++) = (unsigned char)((val >> 8) & 0xFF);
+  *((*bufpp)++) = (unsigned char)( val       & 0xFF);
 }
 
 long
@@ -102,10 +102,10 @@ put_msb_long(
        long val
        )
 {
-  *((*bufpp)++) = (val >> 24) & 0xFF;
-  *((*bufpp)++) = (val >> 16) & 0xFF;
-  *((*bufpp)++) = (val >> 8 ) & 0xFF;
-  *((*bufpp)++) =  val        & 0xFF;
+  *((*bufpp)++) = (unsigned char)((val >> 24) & 0xFF);
+  *((*bufpp)++) = (unsigned char)((val >> 16) & 0xFF);
+  *((*bufpp)++) = (unsigned char)((val >> 8 ) & 0xFF);
+  *((*bufpp)++) = (unsigned char)( val        & 0xFF);
 }
 
 /*
index 948bb1c57dd834b186289da40b056d7c090ee104..c3b5e671fc5409213de79dc3964312934650c174 100644 (file)
@@ -110,6 +110,6 @@ caljulian(
                break;
        }
        jt->month++;
-       jt->monthday = monthday;
+       jt->monthday = (u_char) monthday;
        }
 }
index 502011cfe9246d87f19fb470fa3ab28671cdfdc7..40432906df1efca408c3abbc2fb3d4e805429532 100644 (file)
@@ -53,7 +53,7 @@ dofptoa(
 
                do {
                        tmp = sv;
-                       sv = sv/ten;
+                       sv = (u_short) (sv/ten);
                        *(--cp) = tmp - ((sv<<3) + (sv<<1));
                } while (sv != 0);
        }
index bc9f3f43f4adc9cde2dab5d0e73e307e480d04ac..a155a59dc383f16bef8bd6c429f65afc33b4444b 100644 (file)
@@ -59,7 +59,7 @@ dolfptoa(
 
                do {
                        stmp = swork;
-                       swork /= sten;
+                       swork = (u_short) (swork/sten);
                        stmp -= (swork<<3) + (swork<<1);
                        *--cp = (u_char)stmp;
                } while (swork != 0);
index e5fd1b5ac01a8d05af6786a6cb8bb92b4b46c1ed..136f47accf388316d75e5eac1f2afe2fc98006be 100644 (file)
@@ -513,6 +513,7 @@ getconfig(
        struct interface *localaddr;
        struct refclockstat clock_stat;
        FILEGEN *filegen;
+       u_char asterisk = '*';
 
        /*
         * Initialize, initialize
@@ -671,7 +672,7 @@ getconfig(
                        minpoll = NTP_MINDPOLL;
                        maxpoll = NTP_MAXDPOLL;
                        peerkey = 0;
-                       peerkeystr = '*';
+                       peerkeystr = &asterisk;
                        peerflags = 0;
                        ttl = 0;
                        for (i = 2; i < ntokens; i++)
@@ -1680,7 +1681,7 @@ getconfig(
 
                for (i = 0; i < 8; i++)
                        for (j = 1; j < 100; ++j) {
-                               rankey[i] = RANDOM & 0xff;
+                               rankey[i] = (char) (RANDOM & 0xff);
                                if (rankey[i] != 0) break;
                        }
                rankey[8] = 0;
index 2205b6ca2ddc33025f22a4abeedc8a20ff5508f1..e99167eef18bdf594ef1536b89fe410717c48262 100644 (file)
@@ -641,7 +641,7 @@ refclock_gtlin(
        if (dpend - dpt > bmax - 1)
                dpend = dpt + bmax - 1;
        for (dp = lineptr; dpt < dpend; dpt++) {
-               c = *dpt & 0x7f;
+               c = (char) (*dpt & 0x7f);
                if (c >= ' ')
                        *dp++ = c;
        }
index 260b48b1e7fef3c5593751c5584e51f2deaed180..9ef735c98885f8d39b38935a1fffef94d489d201 100644 (file)
@@ -2421,7 +2421,7 @@ set_clock_fudge(
                        clock_stat.haveflags = CLK_HAVEVAL2;
                        break;
                    case FUDGE_FLAGS:
-                       clock_stat.flags = (u_char) ntohl(cf->fudgeval_flags) & 0xf;
+                       clock_stat.flags = (u_char) (ntohl(cf->fudgeval_flags) & 0xf);
                        clock_stat.haveflags =
                                (CLK_HAVEFLAG1|CLK_HAVEFLAG2|CLK_HAVEFLAG3|CLK_HAVEFLAG4);
                        break;