]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Use predefined function types for parse driver functions used to set up function...
authorMartin Burnicki <burnicki@ntp.org>
Thu, 19 Mar 2015 15:52:05 +0000 (16:52 +0100)
committerMartin Burnicki <burnicki@ntp.org>
Thu, 19 Mar 2015 15:52:05 +0000 (16:52 +0100)
Account for changed prototype of parse_inp_fnc_t functions.
Cast parse conversion results to appropriate types to avoid compiler warnings.
Let ioctl() for Windows accept a (void *) to avoid compiler warnings when called with pointers to different types.

bk: 550af0a5RYsn8g_t3WsPB9NfRklECg

22 files changed:
ChangeLog
include/binio.h
include/mbg_gps166.h
include/parse.h
libparse/clk_computime.c
libparse/clk_dcf7000.c
libparse/clk_hopf6021.c
libparse/clk_meinberg.c
libparse/clk_rawdcf.c
libparse/clk_rcc8000.c
libparse/clk_schmid.c
libparse/clk_sel240x.c
libparse/clk_trimtaip.c
libparse/clk_trimtsip.c
libparse/clk_varitext.c
libparse/clk_wharton.c
libparse/data_mbg.c
libparse/gpstolfp.c
libparse/parse.c
ntpd/refclock_parse.c
ports/winnt/include/termios.h
ports/winnt/libntp/termios.c

index 3587b47b7f297dad25367ca5f0cb741078164407..c35f9ca8b22f960f6598d6d7d1a97ddae64c537e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 ---
 
+* Use predefined function types for parse driver functions
+  used to set up function pointers.
+  Account for changed prototype of parse_inp_fnc_t functions.
+  Cast parse conversion results to appropriate types to avoid
+  compiler warnings.
+  Let ioctl() for Windows accept a (void *) to avoid compiler warnings
+  when called with pointers to different types.
 * [Bug 2777] Fixed loops and decoding of Meinberg GPS satellite info.
   Removed non-ASCII characters from some copyright comments.
   Removed trailing whitespace.
index d1ee94429144641c2b39e8ad2af21853378a65ba..cf98633578bc24495a3125c0d5a8ceb1a1f4220f 100644 (file)
@@ -42,11 +42,21 @@ void put_lsb_short (unsigned char **, long);
 long get_lsb_long (unsigned char **);
 void put_lsb_long (unsigned char **, long);
 
+#define get_lsb_int16( _x_ )   ((int16_t) get_lsb_short( _x_ ))
+#define get_lsb_uint16( _x_ )  ((uint16_t) get_lsb_short( _x_ ))
+#define get_lsb_int32( _x_ )   ((int32_t) get_lsb_long( _x_ ))
+#define get_lsb_uint32( _x_ )  ((uint32_t) get_lsb_long( _x_ ))
+
 long get_msb_short (unsigned char **);
 void put_msb_short (unsigned char **, long);
 long get_msb_long (unsigned char **);
 void put_msb_long (unsigned char **, long);
 
+#define get_msb_int16( _x_ )   ((int16_t) get_msb_short( _x_ ))
+#define get_msb_uint16( _x_ )  ((uint16_t) get_msb_short( _x_ ))
+#define get_msb_int32( _x_ )   ((int32_t) get_msb_long( _x_ ))
+#define get_msb_uint32( _x_ )  ((uint32_t) get_msb_long( _x_ ))
+
 #endif
 /*
  * History:
index 5bd1dadbb277cdaa466e0f3bcdb0c48d00bc11df..b9b3d778356bde7e186ac5471fe90ca4ce5c273c 100644 (file)
@@ -981,7 +981,7 @@ void get_mbg_eph (unsigned char **, EPH *);
 void get_mbg_alm (unsigned char **, ALM *);
 void get_mbg_iono (unsigned char **, IONO *);
 
-unsigned long mbg_csum (unsigned char *, unsigned int);
+CSUM mbg_csum (unsigned char *, unsigned int);
 
 #endif
 /*
index 808dea7497481db00cc12e01ef3dfb60efa9e4c0..aa0fe478776cec9bd2b25ce7570bb44518578631 100644 (file)
@@ -108,8 +108,8 @@ extern unsigned int splclock (void);
  * some constants useful for GPS time conversion
  */
 #define GPSORIGIN       2524953600UL                /* NTP origin - GPS origin in seconds */
-#define GPSWRAP         990                         /* assume week count less than this in the previous epoch */
-#define GPSWEEKS        1024                        /* number of weeks until the GPS epch rolls over */
+#define GPSWRAP         990U                        /* assume week count less than this in the previous epoch */
+#define GPSWEEKS        1024U                       /* number of weeks until the GPS epch rolls over */
 
 /*
  * state flags
@@ -344,15 +344,19 @@ typedef struct clocktime clocktime_t;
 #define SYNC_ZERO      0x00
 #define SYNC_ONE       0x01
 
+typedef u_long parse_inp_fnc_t(parse_t *, char, timestamp_t *);
+typedef u_long parse_cvt_fnc_t(unsigned char *, int, struct format *, clocktime_t *, void *);
+typedef u_long parse_pps_fnc_t(parse_t *, int, timestamp_t *);
+
 struct clockformat
 {
   /* special input protocol - implies fixed format */
-  u_long       (*input)   (parse_t *, unsigned int, timestamp_t *);
+  parse_inp_fnc_t *input;
   /* conversion routine */
-  u_long        (*convert) (unsigned char *, int, struct format *, clocktime_t *, void *);
+  parse_cvt_fnc_t *convert;
   /* routine for handling RS232 sync events (time stamps) */
   /* PPS input routine */
-  u_long        (*syncpps) (parse_t *, int, timestamp_t *);
+  parse_pps_fnc_t *syncpps;
   /* time code synthesizer */
 
   void           *data;                /* local parameters */
@@ -368,7 +372,7 @@ typedef struct clockformat clockformat_t;
  */
 extern int  parse_ioinit (parse_t *);
 extern void parse_ioend (parse_t *);
-extern int  parse_ioread (parse_t *, unsigned int, timestamp_t *);
+extern int  parse_ioread (parse_t *, char, timestamp_t *);
 extern int  parse_iopps (parse_t *, int, timestamp_t *);
 extern void parse_iodone (parse_t *);
 extern int  parse_timecode (parsectl_t *, parse_t *);
@@ -376,8 +380,8 @@ extern int  parse_getfmt (parsectl_t *, parse_t *);
 extern int  parse_setfmt (parsectl_t *, parse_t *);
 extern int  parse_setcs (parsectl_t *, parse_t *);
 
-extern unsigned int parse_restart (parse_t *, unsigned int);
-extern unsigned int parse_addchar (parse_t *, unsigned int);
+extern unsigned int parse_restart (parse_t *, char);
+extern unsigned int parse_addchar (parse_t *, char);
 extern unsigned int parse_end (parse_t *);
 
 extern int Strok (const unsigned char *, const unsigned char *);
@@ -386,9 +390,9 @@ extern int Stoi (const unsigned char *, long *, int);
 extern time_t parse_to_unixtime (clocktime_t *, u_long *);
 extern u_long updatetimeinfo (parse_t *, u_long);
 extern void syn_simple (parse_t *, timestamp_t *, struct format *, u_long);
-extern u_long pps_simple (parse_t *, int, timestamp_t *);
-extern u_long pps_one (parse_t *, int, timestamp_t *);
-extern u_long pps_zero (parse_t *, int, timestamp_t *);
+extern parse_pps_fnc_t pps_simple;
+extern parse_pps_fnc_t pps_one;
+extern parse_pps_fnc_t pps_zero;
 extern int parse_timedout (parse_t *, timestamp_t *, struct timeval *);
 
 #endif
index 2f7c787cbb2a3e2addb589fb776ef90469663d96..5026232ea5f007c4f4ca888df8f63743c6c8c36b 100644 (file)
@@ -88,10 +88,10 @@ static struct format computime_fmt =
        0
 };
 
-static u_long cvt_computime (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_computime (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_computime;
+static parse_inp_fnc_t inp_computime;
 
-clockformat_t   clock_computime =
+clockformat_t clock_computime =
 {
        inp_computime,          /* Computime input handling */
        cvt_computime,          /* Computime conversion */
@@ -103,11 +103,11 @@ clockformat_t   clock_computime =
 };
 
 /*
- * cvt_computime
+ * parse_cvt_fnc_t cvt_computime
  *
  * convert simple type format
  */
-static          u_long
+static u_long
 cvt_computime(
        unsigned char *buffer,
        int            size,
@@ -144,14 +144,14 @@ cvt_computime(
 }
 
 /*
- * inp_computime
+ * parse_inp_fnc_t inp_computime
  *
- * grep data from input stream
+ * grab data from input stream
  */
 static u_long
 inp_computime(
              parse_t      *parseio,
-             unsigned int  ch,
+             char         ch,
              timestamp_t  *tstamp
              )
 {
index 6b0692da29728f77f424ae315cc48694d47d6297..f1da9ef8484e02dff1a2c5909ff9154908a43ad4 100644 (file)
@@ -64,8 +64,9 @@ static struct format dcf7000_fmt =
        (const unsigned char *)"  -  -  -  -  -  -  -  \r",
        0
 };
-static u_long cvt_dcf7000 (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_dcf7000 (parse_t *, unsigned int, timestamp_t *);
+
+static parse_cvt_fnc_t cvt_dcf7000;
+static parse_inp_fnc_t inp_dcf7000;
 
 clockformat_t clock_dcf7000 =
 {
@@ -79,7 +80,7 @@ clockformat_t clock_dcf7000 =
 };
 
 /*
- * cvt_dcf7000
+ * parse_cvt_fnc_t cvt_dcf7000
  *
  * convert dcf7000 type format
  */
@@ -144,14 +145,14 @@ cvt_dcf7000(
 }
 
 /*
- * inp_dcf700
+ * parse_inp_fnc_t inp_dcf700
  *
- * grep data from input stream
+ * grab data from input stream
  */
 static u_long
 inp_dcf7000(
          parse_t      *parseio,
-         unsigned int  ch,
+         char         ch,
          timestamp_t  *tstamp
          )
 {
index 033d2d2ca4e71c847292c5c41534591b8fef1c44..357ac2ec0f15f90e83a76ff423a8fd8c4b08768d 100644 (file)
 extern int printf (const char *, ...);
 #endif
 
-/* 
- * hopf Funkuhr 6021 
+/*
+ * hopf Funkuhr 6021
  *      used with 9600,8N1,
- *      UTC ueber serielle Schnittstelle 
+ *      UTC ueber serielle Schnittstelle
  *      Sekundenvorlauf ON
  *      ETX zum Sekundenvorlauf ON
  *      Datenstring 6021
@@ -71,7 +71,7 @@ extern int printf (const char *, ...);
  *      x x 0 x  - Wintertime
  *      x x 1 x  - Summertime
  *      0 0 x x  - Time/Date invalid
- *      0 1 x x  - Internal clock used 
+ *      0 1 x x  - Internal clock used
  *      1 0 x x  - Radio clock
  *      1 1 x x  - Radio clock highprecision
  *
@@ -90,10 +90,10 @@ extern int printf (const char *, ...);
 #define HOPF_DSTWARN   0x01    /* DST switch warning */
 #define HOPF_DST       0x02    /* DST in effect */
 
-#define HOPF_MODE      0x0C    /* operation mode mask */       
+#define HOPF_MODE      0x0C    /* operation mode mask */
 #define  HOPF_INVALID  0x00    /* no time code available */
 #define  HOPF_INTERNAL 0x04    /* internal clock */
-#define  HOPF_RADIO    0x08    /* radio clock */       
+#define  HOPF_RADIO    0x08    /* radio clock */
 #define  HOPF_RADIOHP  0x0C    /* high precision radio clock */
 
 #define HOPF_UTC       0x08    /* time code in UTC */
@@ -102,13 +102,13 @@ extern int printf (const char *, ...);
 static struct format hopf6021_fmt =
 {
        {
-               {  9, 2 }, {11, 2}, { 13, 2}, /* Day, Month, Year */ 
-               {  3, 2 }, { 5, 2}, {  7, 2}, /* Hour, Minute, Second */ 
+               {  9, 2 }, {11, 2}, { 13, 2}, /* Day, Month, Year */
+               {  3, 2 }, { 5, 2}, {  7, 2}, /* Hour, Minute, Second */
                {  2, 1 }, { 1, 1}, {  0, 0}, /* Weekday, Flags, Zone */
                /* ... */
        },
        (const unsigned char *)"\002              \n\r\003",
-       0 
+       0
 };
 
 #define OFFS(x) format->field_offsets[(x)].offset
@@ -118,8 +118,8 @@ static struct format hopf6021_fmt =
                   ('A' <= (x) && (x) <= 'F') ? (x) - 'A' + 10 : \
                   -1)
 
-static unsigned long cvt_hopf6021 (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_hopf6021 (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_hopf6021;
+static parse_inp_fnc_t inp_hopf6021;
 
 clockformat_t clock_hopf6021 =
 {
@@ -132,7 +132,8 @@ clockformat_t clock_hopf6021 =
   0                            /* private data length, no private data */
 };
 
-static unsigned long
+/* parse_cvt_fnc_t cvt_hopf6021 */
+static u_long
 cvt_hopf6021(
             unsigned char *buffer,
             int            size,
@@ -162,8 +163,8 @@ cvt_hopf6021(
        clock_time->usecond   = 0;
        clock_time->utcoffset = 0;
 
-       status = hexval(buffer[OFFS(O_FLAGS)]);
-       weekday= hexval(buffer[OFFS(O_WDAY)]);
+       status = (u_char) hexval(buffer[OFFS(O_FLAGS)]);
+       weekday= (u_char) hexval(buffer[OFFS(O_WDAY)]);
 
        if ((status == 0xFF) || (weekday == 0xFF))
        {
@@ -213,21 +214,21 @@ cvt_hopf6021(
 }
 
 /*
- * inp_hopf6021
+ * parse_inp_fnc_t inp_hopf6021
  *
- * grep data from input stream
+ * grab data from input stream
  */
 static u_long
 inp_hopf6021(
             parse_t      *parseio,
-            unsigned int  ch,
+            char         ch,
             timestamp_t  *tstamp
          )
 {
        unsigned int rtc;
-       
+
        parseprintf(DD_PARSE, ("inp_hopf6021(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
-       
+
        switch (ch)
        {
        case ETX:
index e42677c14f4b08d0b7c702e83651ecbe74f786e8..4f763fdfe90b4d976fe289a2949b2ee0860ee90e 100644 (file)
 /* Ret val:      the checksum                                   */
 /*+-------------------------------------------------------------*/
 
-unsigned long
+CSUM
 mbg_csum(
         unsigned char *p,
         unsigned int n
         )
 {
-  unsigned long sum = 0;
+  unsigned int sum = 0;
   unsigned int i;
 
   for ( i = 0; i < n; i++ )
     sum += *p++;
 
-  return( sum );
+  return (CSUM) sum;
+
 }  /* csum */
 
 void
@@ -172,10 +173,10 @@ get_mbg_header(
               GPS_MSG_HDR *headerp
               )
 {
-  headerp->cmd = get_lsb_short(bufpp);
-  headerp->len = get_lsb_short(bufpp);
-  headerp->data_csum = get_lsb_short(bufpp);
-  headerp->hdr_csum  = get_lsb_short(bufpp);
+  headerp->cmd = (GPS_CMD) get_lsb_short(bufpp);
+  headerp->len = get_lsb_uint16(bufpp);
+  headerp->data_csum = (CSUM) get_lsb_short(bufpp);
+  headerp->hdr_csum  = (CSUM) get_lsb_short(bufpp);
 }
 
 static struct format meinberg_fmt[] =
@@ -210,10 +211,10 @@ static struct format meinberg_fmt[] =
        }
 };
 
-static u_long cvt_meinberg (unsigned char *, int, struct format *, clocktime_t *, void *);
-static u_long cvt_mgps     (unsigned char *, int, struct format *, clocktime_t *, void *);
-static u_long mbg_input    (parse_t *, unsigned int, timestamp_t *);
-static u_long gps_input    (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_meinberg;
+static parse_cvt_fnc_t cvt_mgps;
+static parse_inp_fnc_t mbg_input;
+static parse_inp_fnc_t gps_input;
 
 struct msg_buf
 {
@@ -258,7 +259,7 @@ clockformat_t clock_meinberg[] =
 };
 
 /*
- * cvt_meinberg
+ * parse_cvt_fnc_t cvt_meinberg
  *
  * convert simple type format
  */
@@ -417,14 +418,14 @@ cvt_meinberg(
 
 
 /*
- * mbg_input
+ * parse_inp_fnc_t mbg_input
  *
- * grep data from input stream
+ * grab data from input stream
  */
 static u_long
 mbg_input(
          parse_t      *parseio,
-         unsigned int  ch,
+         char         ch,
          timestamp_t  *tstamp
          )
 {
@@ -456,7 +457,7 @@ mbg_input(
 
 
 /*
- * cvt_mgps
+ * parse_cvt_fnc_t cvt_mgps
  *
  * convert Meinberg GPS format
  */
@@ -581,14 +582,14 @@ cvt_mgps(
 }
 
 /*
- * gps_input
+ * parse_inp_fnc_t gps_input
  *
  * grep binary data from input stream
  */
 static u_long
 gps_input(
          parse_t      *parseio,
-         unsigned int  ch,
+         char ch,
          timestamp_t  *tstamp
          )
 {
index a821cc536f5fcfc629f2a4fbddb8a1e5897819df..3c6f9198e3ca00ad929157b01cfc33ef86baf5e3 100644 (file)
  * 59                - usually missing (minute indication), except for leap insertion
  */
 
-static u_long pps_rawdcf (parse_t *, int, timestamp_t *);
-static u_long cvt_rawdcf (unsigned char *, int, struct format *, clocktime_t *, void *);
-static u_long inp_rawdcf (parse_t *, unsigned int, timestamp_t  *);
+static parse_pps_fnc_t pps_rawdcf;
+static parse_cvt_fnc_t cvt_rawdcf;
+static parse_inp_fnc_t inp_rawdcf;
 
 typedef struct last_tcode {
        time_t tcode;   /* last converted time code */
@@ -327,6 +327,7 @@ convert_rawdcf(
 }
 
 /*
+ * parse_cvt_fnc_t cvt_rawdcf
  * raw dcf input routine - needs to fix up 50 baud
  * characters for 1/0 decision
  */
@@ -379,7 +380,7 @@ cvt_rawdcf(
                                ch >>= 1;
                        }
 
-                       *s = i;
+                       *s = (unsigned char) i;
                        histbuf[i]++;
                        cutoff += i;
                        lowmax++;
@@ -509,7 +510,7 @@ cvt_rawdcf(
 }
 
 /*
- * pps_rawdcf
+ * parse_pps_fnc_t pps_rawdcf
  *
  * currently a very stupid version - should be extended to decode
  * also ones and zeros (which is easy)
@@ -555,14 +556,14 @@ snt_rawdcf(
 }
 
 /*
- * inp_rawdcf
+ * parse_inp_fnc_t inp_rawdcf
  *
  * grab DCF77 data from input stream
  */
 static u_long
 inp_rawdcf(
          parse_t      *parseio,
-         unsigned int  ch,
+         char         ch,
          timestamp_t  *tstamp
          )
 {
index 6dca1660d4450210f714b13cd577ddab41d9b696..a690e588b91b37c1a819e0219fa363abaf919e15 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * /src/NTP/ntp4-dev/libparse/clk_rcc8000.c,v 4.9 2004/11/14 15:29:41 kardel RELEASE_20050508_A
- *  
+ *
  * clk_rcc8000.c,v 4.9 2004/11/14 15:29:41 kardel RELEASE_20050508_A
  *
  * Radiocode Clocks Ltd RCC 8000 Intelligent Off-Air Master Clock support
@@ -49,16 +49,16 @@ extern int printf (const char *, ...);
 
 #define        O_USEC          O_WDAY
 static struct format rcc8000_fmt =
-{ { { 13, 2 }, {16, 2}, { 19, 2}, /* Day, Month, Year */ 
-    {  0, 2 }, { 3, 2}, {  6, 2}, /* Hour, Minute, Second */ 
+{ { { 13, 2 }, {16, 2}, { 19, 2}, /* Day, Month, Year */
+    {  0, 2 }, { 3, 2}, {  6, 2}, /* Hour, Minute, Second */
     {  9, 3 }, {28, 1}, {  0, 0}, /* uSec, Status (Valid,Reject,BST,Leapyear) */  },
-  (const unsigned char *)"  :  :  .      /  /          \r\n", 
+  (const unsigned char *)"  :  :  .      /  /          \r\n",
   /*"15:50:36.534 30/09/94 273 5 A\x0d\x0a" */
-  0 
+  0
 };
 
-static unsigned long cvt_rcc8000 (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_rcc8000 (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_rcc8000;
+static parse_inp_fnc_t inp_rcc8000;
 
 clockformat_t clock_rcc8000 =
 {
@@ -71,7 +71,8 @@ clockformat_t clock_rcc8000 =
   0                            /* no private data */
 };
 
-static unsigned long
+/* parse_cvt_fnc_t cvt_rcc8000 */
+static u_long
 cvt_rcc8000(
            unsigned char *buffer,
            int            size,
@@ -121,27 +122,27 @@ cvt_rcc8000(
                    clock_time->flags |= PARSEB_POWERUP;
 
                clock_time->flags |= PARSEB_UTC; /* British special - guess why 8-) */
-    
+
                /* other flags not used */
        }
        return CVT_OK;
 }
 /*
- * inp_rcc8000
+ * parse_inp_fnc_t inp_rcc8000
  *
- * grep data from input stream
+ * grab data from input stream
  */
 static u_long
 inp_rcc8000(
            parse_t      *parseio,
-           unsigned int  ch,
+           char         ch,
            timestamp_t  *tstamp
          )
 {
        unsigned int rtc;
-       
+
        parseprintf(DD_PARSE, ("inp_rcc8000(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
-       
+
        switch (ch)
        {
        case '\n':
@@ -150,7 +151,7 @@ inp_rcc8000(
                        return parse_end(parseio);
                else
                        return rtc;
-               
+
 
        default:
                if (parseio->parse_index == 0) /* take sample at start of message */
index 85320f0bed560f45dbf3c079d81700858c7c4516..41eae2c62c5c7ebb9683c9ace2bea053ccc9ede3 100644 (file)
@@ -89,8 +89,8 @@ extern int printf (const char *, ...);
 #define   WS_MEST      0x04
 #define WS_LEAP                0x10
 
-static u_long cvt_schmid (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_schmid (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_schmid;
+static parse_inp_fnc_t inp_schmid;
 
 clockformat_t clock_schmid =
 {
@@ -103,7 +103,7 @@ clockformat_t clock_schmid =
   0,                           /* no private data (complete messages) */
 };
 
-
+/* parse_cvt_fnc_t */
 static u_long
 cvt_schmid(
           unsigned char *buffer,
@@ -192,14 +192,14 @@ cvt_schmid(
 }
 
 /*
- * inp_schmid
+ * parse_inp_fnc_t inp_schmid
  *
- * grep data from input stream
+ * grab data from input stream
  */
 static u_long
 inp_schmid(
          parse_t      *parseio,
-         unsigned int  ch,
+         char         ch,
          timestamp_t  *tstamp
          )
 {
@@ -207,10 +207,10 @@ inp_schmid(
 
        parseprintf(DD_PARSE, ("inp_schmid(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
 
-       switch (ch)
+       switch ((uint8_t)ch)
        {
        case 0xFD:              /*  */
-               parseprintf(DD_PARSE, ("mbg_input: ETX seen\n"));
+               parseprintf(DD_PARSE, ("inp_schmid: 0xFD seen\n"));
                if ((rtc = parse_addchar(parseio, ch)) == PARSE_INP_SKIP)
                        return parse_end(parseio);
                else
index a09d3478dbf66757b79ccc111931ed238413f392..b1390b4cefb1b4b4d27f4f056a85f47d49f1f103 100644 (file)
@@ -3,7 +3,7 @@
 //        Schweitzer Engineering Laboratories, Inc. <opensource@selinc.com>
 //////////////////////////////////////////////////////////////////////////////
 
-// Need to have _XOPEN_SOURCE defined for time.h to give the 
+// Need to have _XOPEN_SOURCE defined for time.h to give the
 // correct strptime signature.  As per feature_test_macros(7),
 // define this before including any header files.
 
 // a '?'.  But we are only going to call it synced when we receive a ' '
 //////////////////////////////////////////////////////////////////////////////
 
-static unsigned long inp_sel240x( parse_t *parseio,
-                                 unsigned int ch,
-                                 timestamp_t *tstamp);
-static unsigned long cvt_sel240x( unsigned char *buffer,
-                                 int size,
-                                 struct format *format,
-                                 clocktime_t *clock_time,
-                                 void *local );
+static parse_inp_fnc_t inp_sel240x;
+static parse_cvt_fnc_t cvt_sel240x;
 
 // Parse clock format structure describing the message above
 static struct format sel240x_fmt =
@@ -94,7 +88,7 @@ clockformat_t clock_sel240x =
 //////////////////////////////////////////////////////////////////////////////
 static unsigned long
 inp_sel240x( parse_t      *parseio,
-            unsigned int ch,
+            char         ch,
             timestamp_t  *tstamp
           )
 {
@@ -139,7 +133,7 @@ cvt_sel240x( unsigned char *buffer,
        {
                struct tm ptime;
                buffer++;
-               buffer = (unsigned char *) strptime( 
+               buffer = (unsigned char *) strptime(
                        (const char *)buffer, "%Y:%j:%H:%M:%S", &ptime );
                if( *(buffer+1) != '\x0d' )
                {
index ad3c286ed2f859a096b24f19a4bbc8fc869f8936..426e897bec972870c34b655336605c8f9f7532ad 100644 (file)
@@ -78,8 +78,8 @@ extern int printf (const char *, ...);
   0
 };
 
-static unsigned long cvt_trimtaip (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_trimtaip (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_trimtaip;
+static parse_inp_fnc_t inp_trimtaip;
 
 clockformat_t clock_trimtaip =
 {
@@ -92,7 +92,8 @@ clockformat_t clock_trimtaip =
   0                            /* no private data */
 };
 
-static unsigned long
+/* parse_cvt_fnc_t cvt_trimtaip */
+static u_long
 cvt_trimtaip(
             unsigned char *buffer,
             int            size,
@@ -141,14 +142,14 @@ cvt_trimtaip(
 }
 
 /*
- * inp_trimtaip
+ * parse_inp_fnc_t inp_trimtaip
  *
- * grep data from input stream
+ * grab data from input stream
  */
 static u_long
 inp_trimtaip(
             parse_t      *parseio,
-            unsigned int  ch,
+            char         ch,
             timestamp_t  *tstamp
          )
 {
index 7f0ec2801b885835771edd782bdf5f3f4e685ec8..6c71d75627ac83ad8fe687e7f14c69fde8371a27 100644 (file)
@@ -116,7 +116,7 @@ struct trimble
 #define STATUS_UNSAFE 1                /* not enough receivers for full precision */
 #define STATUS_SYNC   2                /* enough information for good operation */
 
-static unsigned long inp_tsip (parse_t *, unsigned int, timestamp_t *);
+static unsigned long inp_tsip (parse_t *, char, timestamp_t *);
 static unsigned long cvt_trimtsip (unsigned char *, int, struct format *, clocktime_t *, void *);
 
 struct clockformat clock_trimtsip =
@@ -136,7 +136,7 @@ struct clockformat clock_trimtsip =
 static unsigned long
 inp_tsip(
         parse_t      *parseio,
-        unsigned int ch,
+        char         ch,
         timestamp_t  *tstamp
        )
 {
@@ -183,7 +183,7 @@ inp_tsip(
                        /* DLE,ETX -> end of packet */
                        parseio->parse_data[parseio->parse_index++] = DLE;
                        parseio->parse_data[parseio->parse_index] = ch;
-                       parseio->parse_ldsize = parseio->parse_index+1;
+                       parseio->parse_ldsize = (u_short) (parseio->parse_index + 1);
                        memcpy(parseio->parse_ldata, parseio->parse_data, parseio->parse_ldsize);
                        parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = DLE;
                        parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = ch;
@@ -201,12 +201,12 @@ inp_tsip(
   return PARSE_INP_SKIP;
 }
 
-static int
+static short
 getshort(
         unsigned char *p
         )
 {
-       return get_msb_short(&p);
+       return (short) get_msb_short(&p);
 }
 
 /*
@@ -265,8 +265,8 @@ cvt_trimtsip(
                                            clock_time->flags = PARSEB_POWERUP;
                                            return CVT_OK;
                                    }
-                                   if (week < 990) {
-                                           week += 1024;
+                                   if (week < GPSWRAP) {
+                                           week += GPSWEEKS;
                                    }
 
                                    /* time OK */
@@ -348,17 +348,17 @@ cvt_trimtsip(
                                    unsigned char *lbp;
 
                                    /* UTC correction data - derive a leap warning */
-                                   int tls   = t->t_gpsutc     = getshort((unsigned char *)&mb(12)); /* current leap correction (GPS-UTC) */
-                                   int tlsf  = t->t_gpsutcleap = getshort((unsigned char *)&mb(24)); /* new leap correction */
+                                   int tls   = t->t_gpsutc     = (u_short) getshort((unsigned char *)&mb(12)); /* current leap correction (GPS-UTC) */
+                                   int tlsf  = t->t_gpsutcleap = (u_short) getshort((unsigned char *)&mb(24)); /* new leap correction */
 
-                                   t->t_weekleap   = getshort((unsigned char *)&mb(20)); /* week no of leap correction */
-                                   if (t->t_weekleap < 990)
-                                     t->t_weekleap += 1024;
+                                   t->t_weekleap   = (u_short) getshort((unsigned char *)&mb(20)); /* week no of leap correction */
+                                   if (t->t_weekleap < GPSWRAP)
+                                     t->t_weekleap = (u_short)(t->t_weekleap + GPSWEEKS);
 
-                                   t->t_dayleap    = getshort((unsigned char *)&mb(22)); /* day in week of leap correction */
-                                   t->t_week = getshort((unsigned char *)&mb(18)); /* current week no */
-                                   if (t->t_week < 990)
-                                     t->t_week += 1024;
+                                   t->t_dayleap    = (u_short) getshort((unsigned char *)&mb(22)); /* day in week of leap correction */
+                                   t->t_week = (u_short) getshort((unsigned char *)&mb(18)); /* current week no */
+                                   if (t->t_week < GPSWRAP)
+                                     t->t_week = (u_short)(t->t_weekleap + GPSWEEKS);
 
                                    lbp = (unsigned char *)&mb(14); /* last update time */
                                    if (fetch_ieee754(&lbp, IEEE_SINGLE, &t0t, trim_offsets) != IEEE_OK)
index e7098a5d5d801575efbb7837bd4b3f53ea7b45fb..022549e82f4a6c288e2ba3de6e151758bb6a2f13 100644 (file)
@@ -105,8 +105,8 @@ static struct format varitext_fmt =
   0
 };
 
-static u_long   cvt_varitext (unsigned char *, int, struct format *, clocktime_t *, void *);
-static u_long   inp_varitext (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_varitext;
+static parse_inp_fnc_t inp_varitext;
 
 struct varitext {
   unsigned char start_found;
@@ -128,11 +128,11 @@ clockformat_t   clock_varitext =
 };
 
 /*
- * cvt_varitext
+ * parse_cvt_fnc_t cvt_varitext
  *
  * convert simple type format
  */
-static          u_long
+static u_long
 cvt_varitext(
             unsigned char      *buffer,
             int                size,
@@ -184,10 +184,11 @@ cvt_varitext(
   }
 }
 
+/* parse_inp_fnc_t inp_varitext */
 static u_long
 inp_varitext(
             parse_t     *parseio,
-            unsigned int ch,
+            char ch,
             timestamp_t *tstamp
             )
 {
index 17d63bbc0954d856841ad0b5b4e17fe7d126c778..a65bc53860e6c3816fae2cf57b096f047f62f430 100644 (file)
@@ -74,8 +74,11 @@ extern void printf (const char *, ...);
  * 
  */
 
+static parse_cvt_fnc_t cvt_wharton_400a;
+static parse_inp_fnc_t inp_wharton_400a;
+
 /*
- * cvt_wharton_400a
+ * parse_cvt_fnc_t cvt_wharton_400a
  * 
  * convert simple type format
  */
@@ -121,14 +124,14 @@ cvt_wharton_400a(
 }
 
 /*
- * inp_wharton_400a
+ * parse_inp_fnc_t inp_wharton_400a
  *
- * grep data from input stream
+ * grab data from input stream
  */
 static u_long
 inp_wharton_400a(
              parse_t      *parseio,
-             unsigned int  ch,
+             char         ch,
              timestamp_t  *tstamp
              )
 {
index 472a593bb0c541aead4296f45365b9871a696f08..0b3808c8ba647bda1f9e8a42efa210fd3f1ee86f 100644 (file)
@@ -76,7 +76,7 @@ get_mbg_sw_rev(
        SW_REV *sw_revp
        )
 {
-  sw_revp->code = get_lsb_short(bufpp);
+  sw_revp->code = get_lsb_uint16(bufpp);
   memcpy(sw_revp->name, *bufpp, sizeof(sw_revp->name));
   *bufpp += sizeof(sw_revp->name);
 }
@@ -87,8 +87,8 @@ get_mbg_ascii_msg(
        ASCII_MSG *ascii_msgp
        )
 {
-  ascii_msgp->csum  = get_lsb_short(bufpp);
-  ascii_msgp->valid = get_lsb_short(bufpp);
+  ascii_msgp->csum  = (CSUM) get_lsb_short(bufpp);
+  ascii_msgp->valid = get_lsb_int16(bufpp);
   memcpy(ascii_msgp->s, *bufpp, sizeof(ascii_msgp->s));
   *bufpp += sizeof(ascii_msgp->s);
 }
@@ -99,7 +99,7 @@ get_mbg_svno(
        SVNO *svnop
        )
 {
-  *svnop = get_lsb_short(bufpp);
+  *svnop = (SVNO) get_lsb_short(bufpp);
 }
 
 void
@@ -108,7 +108,7 @@ get_mbg_health(
        HEALTH *healthp
        )
 {
-  *healthp = get_lsb_short(bufpp);
+  *healthp = (HEALTH) get_lsb_short(bufpp);
 }
 
 void
@@ -117,7 +117,7 @@ get_mbg_cfg(
        CFG *cfgp
        )
 {
-  *cfgp = get_lsb_short(bufpp);
+  *cfgp = (CFG) get_lsb_short(bufpp);
 }
 
 void
@@ -126,7 +126,7 @@ get_mbg_tgps(
        T_GPS *tgpsp
        )
 {
-  tgpsp->wn = get_lsb_short(bufpp);
+  tgpsp->wn = get_lsb_uint16(bufpp);
   tgpsp->sec = get_lsb_long(bufpp);
   tgpsp->tick = get_lsb_long(bufpp);
 }
@@ -137,17 +137,17 @@ get_mbg_tm(
        TM_GPS *tmp
        )
 {
-  tmp->year = get_lsb_short(buffpp);
+  tmp->year = get_lsb_int16(buffpp);
   tmp->month = *(*buffpp)++;
   tmp->mday = *(*buffpp)++;
-  tmp->yday = get_lsb_short(buffpp);
+  tmp->yday = get_lsb_int16(buffpp);
   tmp->wday = *(*buffpp)++;
   tmp->hour = *(*buffpp)++;
   tmp->min = *(*buffpp)++;
   tmp->sec = *(*buffpp)++;
   tmp->frac = get_lsb_long(buffpp);
   tmp->offs_from_utc = get_lsb_long(buffpp);
-  tmp->status= get_lsb_short(buffpp);
+  tmp->status = get_lsb_uint16(buffpp);
 }
 
 void
@@ -156,7 +156,7 @@ get_mbg_ttm(
        TTM *ttmp
        )
 {
-  ttmp->channel = get_lsb_short(buffpp);
+  ttmp->channel = get_lsb_int16(buffpp);
   get_mbg_tgps(buffpp, &ttmp->t);
   get_mbg_tm(buffpp, &ttmp->tm);
 }
@@ -167,9 +167,9 @@ get_mbg_synth(
        SYNTH *synthp
        )
 {
-  synthp->freq  = get_lsb_short(buffpp);
-  synthp->range = get_lsb_short(buffpp);
-  synthp->phase = get_lsb_short(buffpp);
+  synthp->freq  = get_lsb_int16(buffpp);
+  synthp->range = get_lsb_int16(buffpp);
+  synthp->phase = get_lsb_int16(buffpp);
 }
 
 static void
@@ -202,7 +202,7 @@ get_mbg_antinfo(
        ANT_INFO *antinfop
        )
 {
-  antinfop->status = get_lsb_short(buffpp);
+  antinfop->status = get_lsb_int16(buffpp);
   get_mbg_tm(buffpp, &antinfop->tm_disconn);
   get_mbg_tm(buffpp, &antinfop->tm_reconn);
   antinfop->delta_t = get_lsb_long(buffpp);
@@ -297,8 +297,8 @@ get_mbg_cfgh(
 {
   int i;
 
-  cfghp->csum = get_lsb_short(buffpp);
-  cfghp->valid = get_lsb_short(buffpp);
+  cfghp->csum = (CSUM) get_lsb_short(buffpp);
+  cfghp->valid = get_lsb_int16(buffpp);
   get_mbg_tgps(buffpp, &cfghp->tot_51);
   get_mbg_tgps(buffpp, &cfghp->tot_63);
   get_mbg_tgps(buffpp, &cfghp->t0a);
@@ -320,8 +320,8 @@ get_mbg_utc(
        UTC *utcp
        )
 {
-  utcp->csum  = get_lsb_short(buffpp);
-  utcp->valid = get_lsb_short(buffpp);
+  utcp->csum  = (CSUM) get_lsb_short(buffpp);
+  utcp->valid = get_lsb_int16(buffpp);
 
   get_mbg_tgps(buffpp, &utcp->t0t);
 
@@ -335,8 +335,8 @@ get_mbg_utc(
       L_CLR(&utcp->A1);
     }
 
-  utcp->WNlsf      = get_lsb_short(buffpp);
-  utcp->DNt        = get_lsb_short(buffpp);
+  utcp->WNlsf      = get_lsb_uint16(buffpp);
+  utcp->DNt        = get_lsb_int16(buffpp);
   utcp->delta_tls  = *(*buffpp)++;
   utcp->delta_tlsf = *(*buffpp)++;
 }
@@ -393,7 +393,7 @@ get_mbg_comparam(
     {
       comparamp->framing[i] = *(*buffpp)++;
     }
-  comparamp->handshake = get_lsb_short(buffpp);
+  comparamp->handshake = get_lsb_int16(buffpp);
 }
 
 void
@@ -426,13 +426,13 @@ get_mbg_eph(
        EPH *ephp
        )
 {
-  ephp->csum   = get_lsb_short(buffpp);
-  ephp->valid  = get_lsb_short(buffpp);
+  ephp->csum   = (CSUM) get_lsb_short(buffpp);
+  ephp->valid  = get_lsb_int16(buffpp);
 
-  ephp->health = get_lsb_short(buffpp);
-  ephp->IODC   = get_lsb_short(buffpp);
-  ephp->IODE2  = get_lsb_short(buffpp);
-  ephp->IODE3  = get_lsb_short(buffpp);
+  ephp->health = (HEALTH) get_lsb_short(buffpp);
+  ephp->IODC   = (IOD) get_lsb_short(buffpp);
+  ephp->IODE2  = (IOD) get_lsb_short(buffpp);
+  ephp->IODE3  = (IOD) get_lsb_short(buffpp);
 
   get_mbg_tgps(buffpp, &ephp->tt);
   get_mbg_tgps(buffpp, &ephp->t0c);
@@ -459,7 +459,7 @@ get_mbg_eph(
   FETCH_DOUBLE(buffpp, &ephp->af2);
   FETCH_DOUBLE(buffpp, &ephp->tgd);
 
-  ephp->URA = get_lsb_short(buffpp);
+  ephp->URA = get_lsb_uint16(buffpp);
 
   ephp->L2code = *(*buffpp)++;
   ephp->L2flag = *(*buffpp)++;
@@ -471,10 +471,10 @@ get_mbg_alm(
        ALM *almp
        )
 {
-  almp->csum   = get_lsb_short(buffpp);
-  almp->valid  = get_lsb_short(buffpp);
+  almp->csum   = (CSUM) get_lsb_short(buffpp);
+  almp->valid  = get_lsb_int16(buffpp);
 
-  almp->health = get_lsb_short(buffpp);
+  almp->health = (HEALTH) get_lsb_short(buffpp);
   get_mbg_tgps(buffpp, &almp->t0a);
 
 
@@ -496,8 +496,8 @@ get_mbg_iono(
        IONO *ionop
        )
 {
-  ionop->csum   = get_lsb_short(buffpp);
-  ionop->valid  = get_lsb_short(buffpp);
+  ionop->csum   = (CSUM) get_lsb_short(buffpp);
+  ionop->valid  = get_lsb_int16(buffpp);
 
   FETCH_DOUBLE(buffpp, &ionop->alpha_0);
   FETCH_DOUBLE(buffpp, &ionop->alpha_1);
index f26c8cf4d7b72c967fb035fcee800e5cfb728581..c162429ed92a9ecfb5a424021e61105de8673e1f 100644 (file)
@@ -50,7 +50,7 @@ gpstolfp(
       weeks += GPSWEEKS;
     }
 
-  lfp->l_ui = weeks * SECSPERWEEK + days * SECSPERDAY + seconds + GPSORIGIN; /* convert to NTP time */
+  lfp->l_ui = (uint32_t)(weeks * SECSPERWEEK + days * SECSPERDAY + seconds + GPSORIGIN); /* convert to NTP time */
   lfp->l_uf = 0;
 }
 
index 4b8bc20d9bfce3fb8ead516a3902b7e9613a7d96..50781796cfc78cc0793e7d74ebbcf0d29c0d3399 100644 (file)
@@ -188,7 +188,7 @@ parse_ioend(
 unsigned int
 parse_restart(
              parse_t *parseio,
-             unsigned int ch
+             char ch
              )
 {
        unsigned int updated = PARSE_INP_SKIP;
@@ -218,7 +218,7 @@ parse_restart(
 unsigned int
 parse_addchar(
              parse_t *parseio,
-             unsigned int ch
+             char ch
              )
 {
        /*
@@ -260,11 +260,11 @@ parse_end(
 int
 parse_ioread(
        register parse_t *parseio,
-       register unsigned int ch,
+       register char ch,
        register timestamp_t *tstamp
        )
 {
-       register unsigned updated = CVT_NONE;
+       register u_int updated = CVT_NONE;
        /*
         * within STREAMS CSx (x < 8) chars still have the upper bits set
         * so we normalize the characters by masking unecessary bits off.
@@ -284,7 +284,7 @@ parse_ioread(
                break;
 
            case PARSE_IO_CS8:
-               ch &= 0xFF;
+               ch &= (char) 0xFF;
                break;
        }
 
@@ -309,7 +309,7 @@ parse_ioread(
 
                if (input_status & PARSE_INP_TIME)      /* time sample is available */
                {
-                       updated = timepacket(parseio);
+                       updated = (u_int) timepacket(parseio);
                }
 
                if (input_status & PARSE_INP_DATA) /* got additional data */
@@ -353,7 +353,7 @@ parse_iopps(
        register timestamp_t *ptime
        )
 {
-       register unsigned updated = CVT_NONE;
+       register u_int updated = CVT_NONE;
 
        /*
         * PPS pulse information will only be delivered to ONE clock format
@@ -364,7 +364,7 @@ parse_iopps(
 
        if (clockformats[parseio->parse_lformat]->syncpps)
        {
-               updated = clockformats[parseio->parse_lformat]->syncpps(parseio, status == SYNC_ONE, ptime);
+               updated = (u_int) clockformats[parseio->parse_lformat]->syncpps(parseio, status == SYNC_ONE, ptime);
                parseprintf(DD_PARSE, ("parse_iopps: updated = 0x%x\n", updated));
        }
 
@@ -614,7 +614,7 @@ syn_simple(
 }
 
 /*
- * pps_simple
+ * parse_pps_fnc_t pps_simple
  *
  * handle a pps time stamp
  */
@@ -633,7 +633,7 @@ pps_simple(
 }
 
 /*
- * pps_one
+ * parse_pps_fnc_t pps_one
  *
  * handle a pps time stamp in ONE edge
  */
@@ -652,7 +652,7 @@ pps_one(
 }
 
 /*
- * pps_zero
+ * parse_pps_fnc_t pps_zero
  *
  * handle a pps time stamp in ZERO edge
  */
@@ -732,7 +732,7 @@ timepacket(
        parseio->parse_dtime.parse_time.tv.tv_sec  = t;
        parseio->parse_dtime.parse_time.tv.tv_usec = clock_time.usecond;
 #else
-       parseio->parse_dtime.parse_time.fp.l_ui = t + JAN_1970;
+       parseio->parse_dtime.parse_time.fp.l_ui = (uint32_t) (t + JAN_1970);
        TVUTOTSF(clock_time.usecond, parseio->parse_dtime.parse_time.fp.l_uf);
 #endif
 
@@ -852,7 +852,7 @@ parse_getfmt(
        if (dct->parseformat.parse_format < nformats &&
            Strlen(clockformats[dct->parseformat.parse_format]->name) <= PARSE_TCMAX)
        {
-               dct->parseformat.parse_count = Strlen(clockformats[dct->parseformat.parse_format]->name)+1;
+               dct->parseformat.parse_count = (unsigned short) (Strlen(clockformats[dct->parseformat.parse_format]->name) + 1);
                memcpy(dct->parseformat.parse_buffer, clockformats[dct->parseformat.parse_format]->name, dct->parseformat.parse_count);
                return 1;
        }
@@ -870,7 +870,7 @@ parse_setcs(
        )
 {
        parse->parse_ioflags &= ~PARSE_IO_CSIZE;
-       parse->parse_ioflags |= dct->parsesetcs.parse_cs & PARSE_IO_CSIZE;
+       parse->parse_ioflags |= (int) (dct->parsesetcs.parse_cs & PARSE_IO_CSIZE);
        return 1;
 }
 
index 01827907f13d54a3c9b5362632d51de306894eca..3117332ac2b949d897306abfceafb1e1fbd1c7a8 100644 (file)
 # endif
 #endif
 
-#define BUFFER_SIZE(_BUF, _PTR) ((_BUF) + sizeof(_BUF) - (_PTR))
-#define BUFFER_SIZES(_BUF, _PTR, _SZ) ((_BUF) + (_SZ) - (_PTR))
+# define BUFFER_SIZE(_BUF, _PTR)       ((int)((_BUF) + sizeof(_BUF) - (_PTR)))
+# define BUFFER_SIZES(_BUF, _PTR, _SZ) ((int)((_BUF) + (_SZ) - (_PTR)))
 
 /*
  * document type of PPS interfacing - copy of ifdef mechanism in local_input()
@@ -2246,9 +2246,9 @@ local_input(
                                                        else
                                                          pts = pps_info.assert_timestamp;
 
-                                                       parse->parseio.parse_dtime.parse_ptime.fp.l_ui = pts.tv_sec + JAN_1970;
+                                                       parse->parseio.parse_dtime.parse_ptime.fp.l_ui = (uint32_t) (pts.tv_sec + JAN_1970);
 
-                                                       dtemp = pts.tv_nsec / 1e9;
+                                                       dtemp = (double) pts.tv_nsec / 1e9;
                                                        if (dtemp < 0.) {
                                                                dtemp += 1;
                                                                parse->parseio.parse_dtime.parse_ptime.fp.l_ui--;
@@ -2257,9 +2257,9 @@ local_input(
                                                                dtemp -= 1;
                                                                parse->parseio.parse_dtime.parse_ptime.fp.l_ui++;
                                                        }
-                                                       parse->parseio.parse_dtime.parse_ptime.fp.l_uf = dtemp * FRAC;
+                                                       parse->parseio.parse_dtime.parse_ptime.fp.l_uf = (uint32_t)(dtemp * FRAC);
 
-                                                       parse->parseio.parse_dtime.parse_state |= PARSEB_PPS|PARSEB_S_PPS;
+                                                       parse->parseio.parse_dtime.parse_state |= PARSEB_PPS|PARSEB_S_PPS;
 #ifdef DEBUG
                                                        if (debug > 3)
                                                        {
@@ -2899,7 +2899,7 @@ parse_ppsapi(
        int cap, mode_ppsoffset;
        const char *cp;
 
-       parse->flags &= ~PARSE_PPSCLOCK;
+       parse->flags &= (u_char) (~PARSE_PPSCLOCK);
 
        /*
         * collect PPSAPI offset capability - should move into generic handling
@@ -2941,16 +2941,16 @@ parse_ppsapi(
                  CLK_UNIT(parse->peer), cp, cap);
                mode_ppsoffset = 0;
        } else {
-               if (mode_ppsoffset == PPS_OFFSETCLEAR)
-                       {
-                               parse->atom.pps_params.clear_offset.tv_sec = -parse->ppsphaseadjust;
-                               parse->atom.pps_params.clear_offset.tv_nsec = -1e9*(parse->ppsphaseadjust - (long)parse->ppsphaseadjust);
+               if (mode_ppsoffset == PPS_OFFSETCLEAR)
+                       {
+                               parse->atom.pps_params.clear_offset.tv_sec = (time_t)(-parse->ppsphaseadjust);
+                               parse->atom.pps_params.clear_offset.tv_nsec = (long)(-1e9*(parse->ppsphaseadjust - (double)(long)parse->ppsphaseadjust));
                        }
 
                if (mode_ppsoffset == PPS_OFFSETASSERT)
-                       {
-                               parse->atom.pps_params.assert_offset.tv_sec = -parse->ppsphaseadjust;
-                               parse->atom.pps_params.assert_offset.tv_nsec = -1e9*(parse->ppsphaseadjust - (long)parse->ppsphaseadjust);
+                       {
+                               parse->atom.pps_params.assert_offset.tv_sec = (time_t)(-parse->ppsphaseadjust);
+                               parse->atom.pps_params.assert_offset.tv_nsec = (long)(-1e9*(parse->ppsphaseadjust - (double)(long)parse->ppsphaseadjust));
                        }
        }
 
@@ -3124,15 +3124,15 @@ parse_start(
                }
 #endif
 
-               tio.c_cflag = parse_clockinfo[type].cl_cflag;
-               tio.c_iflag = parse_clockinfo[type].cl_iflag;
-               tio.c_oflag = parse_clockinfo[type].cl_oflag;
-               tio.c_lflag = parse_clockinfo[type].cl_lflag;
+               tio.c_cflag = (tcflag_t) parse_clockinfo[type].cl_cflag;
+               tio.c_iflag = (tcflag_t) parse_clockinfo[type].cl_iflag;
+               tio.c_oflag = (tcflag_t) parse_clockinfo[type].cl_oflag;
+               tio.c_lflag = (tcflag_t) parse_clockinfo[type].cl_lflag;
 
 
 #ifdef HAVE_TERMIOS
-               if ((cfsetospeed(&tio, parse_clockinfo[type].cl_speed) == -1) ||
-                   (cfsetispeed(&tio, parse_clockinfo[type].cl_speed) == -1))
+               if ((cfsetospeed(&tio, (speed_t) parse_clockinfo[type].cl_speed) == -1) ||
+                   (cfsetispeed(&tio, (speed_t) parse_clockinfo[type].cl_speed) == -1))
                {
                        msyslog(LOG_ERR, "PARSE receiver #%d: parse_start: tcset{i,o}speed(&tio, speed): %m", unit);
                        parse_shutdown(CLK_UNIT(parse->peer), peer); /* let our cleaning staff do the work */
@@ -3279,7 +3279,7 @@ parse_start(
        }
 
        strlcpy(tmp_ctl.parseformat.parse_buffer, parse->parse_type->cl_format, sizeof(tmp_ctl.parseformat.parse_buffer));
-       tmp_ctl.parseformat.parse_count = strlen(tmp_ctl.parseformat.parse_buffer);
+       tmp_ctl.parseformat.parse_count = (u_short) strlen(tmp_ctl.parseformat.parse_buffer);
 
        if (!PARSE_SETFMT(parse, &tmp_ctl))
        {
@@ -3379,8 +3379,8 @@ parse_ctl(
        {
                if (in->haveflags & (CLK_HAVEFLAG1|CLK_HAVEFLAG2|CLK_HAVEFLAG3|CLK_HAVEFLAG4))
                {
-                 parse->flags = (parse->flags & ~(CLK_FLAG1|CLK_FLAG2|CLK_FLAG3|CLK_FLAG4)) |
-                   (in->flags & (CLK_FLAG1|CLK_FLAG2|CLK_FLAG3|CLK_FLAG4));
+                 u_char mask = CLK_FLAG1|CLK_FLAG2|CLK_FLAG3|CLK_FLAG4;
+                 parse->flags = (parse->flags & (u_char)(~mask)) | (in->flags & mask);
 #if defined(HAVE_PPSAPI)
                  if (CLK_PPS(parse->peer))
                    {
@@ -3663,7 +3663,7 @@ parse_control(
                                        clockstatus((unsigned int)i),
                                        l_mktime(s_time),
                                        (int)(percent / 100), (int)(percent % 100));
-                               if ((count = strlen(item)) < (LEN_STATES - 40 - (tt - start)))
+                               if ((count = (int) strlen(item)) < (LEN_STATES - 40 - (tt - start)))
                                        {
                                                tt = ap(start, LEN_STATES, tt,
                                                    "%s", item);
@@ -3695,7 +3695,7 @@ parse_control(
                        }
                }
 
-               out->lencode       = strlen(outstatus);
+               out->lencode       = (u_short) strlen(outstatus);
                out->p_lastcode    = outstatus;
        }
 }
@@ -4349,7 +4349,7 @@ gps16x_message(
                                        char buffer[512];
                                        char *p, *b;
 
-                                       status = get_lsb_short(&bufp);
+                                       status = (BVAR_STAT) get_lsb_short(&bufp);
                                        p = b = buffer;
                                        p = ap(buffer, sizeof(buffer), p,
                                            "meinberg_gps_status=\"[0x%04x] ",
@@ -4631,7 +4631,8 @@ gps16x_message(
                }
                else
                {
-                       msyslog(LOG_DEBUG, "PARSE receiver #%d: gps16x_message: message checksum error: hdr_csum = 0x%x (expected 0x%lx), data_len = %d, data_csum = 0x%x (expected 0x%lx)",
+                       msyslog(LOG_DEBUG, "PARSE receiver #%d: gps16x_message: message checksum error: hdr_csum = 0x%x (expected 0x%x), "
+                                          "data_len = %d, data_csum = 0x%x (expected 0x%x)",
                                CLK_UNIT(parse->peer),
                                header.hdr_csum, mbg_csum(parsetime->parse_msg + 1, 6),
                                header.len,
@@ -4702,7 +4703,7 @@ gps16x_poll(
        }
 #endif
 
-       rtc = write(parse->generic->io.fd, cmd_buffer, (unsigned long)(outp - cmd_buffer));
+       rtc = (int) write(parse->generic->io.fd, cmd_buffer, (unsigned long)(outp - cmd_buffer));
 
        if (rtc < 0)
        {
@@ -4765,11 +4766,11 @@ poll_dpoll(
        struct parseunit *parse
        )
 {
-       int rtc;
+       long rtc;
        const char *ps = ((poll_info_t *)parse->parse_type->cl_data)->string;
-       int   ct = ((poll_info_t *)parse->parse_type->cl_data)->count;
+       long ct = ((poll_info_t *)parse->parse_type->cl_data)->count;
 
-       rtc = write(parse->generic->io.fd, ps, (unsigned long)ct);
+       rtc = write(parse->generic->io.fd, ps, ct);
        if (rtc < 0)
        {
                ERR(ERR_BADIO)
@@ -4779,7 +4780,7 @@ poll_dpoll(
            if (rtc != ct)
            {
                    ERR(ERR_BADIO)
-                           msyslog(LOG_ERR, "PARSE receiver #%d: poll_dpoll: failed to send cmd incomplete (%d of %d bytes sent)", CLK_UNIT(parse->peer), rtc, ct);
+                           msyslog(LOG_ERR, "PARSE receiver #%d: poll_dpoll: failed to send cmd incomplete (%ld of %ld bytes sent)", CLK_UNIT(parse->peer), rtc, ct);
            }
        clear_err(parse, ERR_BADIO);
 }
@@ -4885,7 +4886,7 @@ trimbletaip_event(
                            iv = taipinit;
                            while (*iv)
                            {
-                                   int rtc = write(parse->generic->io.fd, *iv, strlen(*iv));
+                                   int rtc = (int) write(parse->generic->io.fd, *iv, strlen(*iv));
                                    if (rtc < 0)
                                    {
                                            msyslog(LOG_ERR, "PARSE receiver #%d: trimbletaip_event: failed to send cmd to clock: %m", CLK_UNIT(parse->peer));
@@ -5105,7 +5106,7 @@ sendflt(
        int i;
        union uval uval;
 
-       uval.fv = a;
+       uval.fv = (float) a;
 #ifdef WORDS_BIGENDIAN
        for (i=0; i<=3; i++)
 #else
@@ -5399,7 +5400,7 @@ getshort(
         unsigned char *p
         )
 {
-       return get_msb_short(&p);
+       return (int) get_msb_short(&p);
 }
 
 /*--------------------------------------------------
@@ -5438,7 +5439,7 @@ trimbletsip_message(
        }
        else
        {
-               int var_flag;
+               u_short var_flag;
                trimble_t *tr = parse->localdata;
                unsigned int cmd = buffer[1];
                char pbuffer[200];
@@ -5473,7 +5474,7 @@ trimbletsip_message(
                        return;
                }
 
-               var_flag = s->varmode;
+               var_flag = (u_short) s->varmode;
 
                switch(cmd)
                {
@@ -5622,11 +5623,11 @@ trimbletsip_message(
                case CMD_RUTCPARAM:
                {
                        float t0t = getflt((unsigned char *)&mb(14));
-                       short wnt = getshort((unsigned char *)&mb(18));
-                       short dtls = getshort((unsigned char *)&mb(12));
-                       short wnlsf = getshort((unsigned char *)&mb(20));
-                       short dn = getshort((unsigned char *)&mb(22));
-                       short dtlsf = getshort((unsigned char *)&mb(24));
+                       short wnt = (short) getshort((unsigned char *)&mb(18));
+                       short dtls = (short) getshort((unsigned char *)&mb(12));
+                       short wnlsf = (short) getshort((unsigned char *)&mb(20));
+                       short dn = (short) getshort((unsigned char *)&mb(22));
+                       short dtlsf = (short) getshort((unsigned char *)&mb(24));
 
                        if ((int)t0t != 0)
                        {
@@ -5762,7 +5763,7 @@ trimbletsip_message(
                        if (getflt((unsigned char *)&mb(4)) < 0.0)
                        {
                                t = ap(pbuffer, sizeof(pbuffer), t, "<NO MEASUREMENTS>");
-                               var_flag &= ~DEF;
+                               var_flag &= (u_short)(~DEF);
                        }
                        else
                        {
@@ -5775,7 +5776,7 @@ trimbletsip_message(
                                        getflt((unsigned char *)&mb(16)) * RTOD);
                                if (mb(20))
                                {
-                                       var_flag &= ~DEF;
+                                       var_flag &= (u_short)(~DEF);
                                        t = ap(pbuffer, sizeof(pbuffer), t, ", OLD");
                                }
                                if (mb(22))
@@ -5797,7 +5798,7 @@ trimbletsip_message(
                        break;
                }
 
-               t = ap(pbuffer, sizeof(pbuffer), t,"\"");
+               t = ap(pbuffer, sizeof(pbuffer), t, "\"");
                set_var(&parse->kv, pbuffer, sizeof(pbuffer), var_flag);
        }
 }
index 9c1cc625cd40eaa38a7e5e212d52b30ca4c386cb..94331afca57e7801f5dfc66964f2eae63554ca6c 100644 (file)
@@ -205,7 +205,7 @@ struct termios
 #define cfsetispeed(dcb, spd)  (0)
 
 extern int     closeserial     (int);
-extern int     ioctl           (int, int, int *);
+extern int     ioctl           (int, int, void *);
 extern int     tcsetattr       (int, int, const struct termios *);
 extern int     tcgetattr       (int, struct termios *);
 extern int     tcflush         (int, int);
index 3fe4e4859c01c566c131519004818d8d3de8ead7..5ac017dcd0359714e48eb0c0b45c4bd1b22103ca 100644 (file)
@@ -468,12 +468,13 @@ int
 ioctl(
        int fd,
        int op,
-       int *pi
+       void *pv
        )
 {
        HANDLE  h;
        int     result;
        int     modctl;
+       int *pi = (int *) pv;
        
        h = (HANDLE)_get_osfhandle(fd);