]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2272] Use c99 integer types: ntp_calendar.h, ntp_types.h
authorHarlan Stenn <stenn@ntp.org>
Wed, 16 Oct 2013 08:45:10 +0000 (08:45 +0000)
committerHarlan Stenn <stenn@ntp.org>
Wed, 16 Oct 2013 08:45:10 +0000 (08:45 +0000)
bk: 525e5216q_TBuFk-4pa1m6Qt4Y5CAQ

ChangeLog
include/ntp_calendar.h
include/ntp_types.h

index 463440b8edda8c60367c4fdd279c65e8c5c7e735..131b6c9b121480b2b29540701c4c337849262995 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [Bug 2272] Use C99 integer types. ntp_calendar.h and ntp_types.h .
 (4.2.7p392) 2013/10/15 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 2375] Improve AIX compatibility.
 * [Bug 2490] Fixed non-const initializer coming from [Bug 2250] fix.
index c1838400a9efb1eb6290a054bc8eb857a6e01444..53ce614593e3b0a78c7b963586a549e2e64eaf7f 100644 (file)
 
 /* gregorian calendar date */
 struct calendar {
-       u_short year;           /* year (A.D.) */
-       u_short yearday;        /* day of year, 1 = January 1 */
-       u_char month;           /* month, 1 = January */
-       u_char monthday;        /* day of month */
-       u_char hour;            /* hour of day, midnight = 0 */
-       u_char minute;          /* minute of hour */
-       u_char second;          /* second of minute */
-       u_char weekday;         /* 0..7, 0=Sunday */
+       uint16_t year;          /* year (A.D.) */
+       uint16_t yearday;       /* day of year, 1 = January 1 */
+       uint8_t month;          /* month, 1 = January */
+       uint8_t monthday;       /* day of month */
+       uint8_t hour;           /* hour of day, midnight = 0 */
+       uint8_t minute;         /* minute of hour */
+       uint8_t second;         /* second of minute */
+       uint8_t weekday;        /* 0..7, 0=Sunday */
 };
 
 /* ISO week calendar date */
 struct isodate {
-       u_short year;           /* year (A.D.) */
-       u_char  week;           /* 1..53, week in year */
-       u_char  weekday;        /* 1..7, 1=Monday */
-       u_char  hour;           /* hour of day, midnight = 0 */
-       u_char  minute;         /* minute of hour */
-       u_char  second;         /* second of minute */
+       uint16_t        year;   /* year (A.D.) */
+       uint8_t week;           /* 1..53, week in year */
+       uint8_t weekday;        /* 1..7, 1=Monday */
+       uint8_t hour;           /* hour of day, midnight = 0 */
+       uint8_t minute;         /* minute of hour */
+       uint8_t second;         /* second of minute */
 };
 
 /* general split representation */
index f5bcced069c6ec947156ccd30865ef37da0b5d13..1beb16647a6609782877f1e125eab1fad73db631 100644 (file)
@@ -1,5 +1,10 @@
 /*
  *  ntp_types.h - defines how int32 and u_int32 are treated.
+ *
+ * New style: Make sure C99 fixed width integer types are available:
+ * intN_t and uintN_t
+
+ * Old style: defines how int32 and u_int32 are treated.
  *  For 64 bit systems like the DEC Alpha, they have to be defined
  *  as int and u_int.
  *  For 32 bit systems, define them as long and u_long
@@ -164,10 +169,10 @@ typedef unsigned long long u_int64;
 typedef union {
 #   ifdef WORDS_BIGENDIAN
        struct {
-               short   hh; u_short hl; u_short lh; u_short ll;
+               int16_t hh; uint16_t hl; uint16_t lh; uint16_t ll;
        } w_s;
        struct {
-               u_short hh; u_short hl; u_short lh; u_short ll;
+               uint16_t hh; uint16_t hl; uint16_t lh; uint16_t ll;
        } W_s;
        struct {
                  int32 hi; u_int32 lo;
@@ -177,10 +182,10 @@ typedef union {
        } D_s;
 #   else
        struct {
-               u_short ll; u_short lh; u_short hl;   short hh;
+               uint16_t ll; uint16_t lh; uint16_t hl;   int16_t hh;
        } w_s;
        struct {
-               u_short ll; u_short lh; u_short hl; u_short hh;
+               uint16_t ll; uint16_t lh; uint16_t hl; uint16_t hh;
        } W_s;
        struct {
                u_int32 lo;   int32 hi;
@@ -197,13 +202,13 @@ typedef union {
 } vint64; /* variant int 64 */
 
 
-typedef u_char         ntp_u_int8_t;
-typedef u_short                ntp_u_int16_t;
-typedef u_int32                ntp_u_int32_t;
+typedef uint8_t                ntp_u_int8_t;
+typedef uint16_t       ntp_u_int16_t;
+typedef uint32_t       ntp_u_int32_t;
 
 typedef struct ntp_uint64_t { u_int32 val[2]; } ntp_uint64_t;
 
-typedef u_short                associd_t; /* association ID */
+typedef uint16_t       associd_t; /* association ID */
 #define ASSOCID_MAX    USHRT_MAX
 typedef u_int32 keyid_t;       /* cryptographic key ID */
 #define KEYID_T_MAX    (0xffffffff)