From: Harlan Stenn Date: Wed, 16 Oct 2013 08:45:10 +0000 (+0000) Subject: [Bug 2272] Use c99 integer types: ntp_calendar.h, ntp_types.h X-Git-Tag: NTP_4_2_7P393~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a15587c662688905a261ec6ebc7e91405e02de7f;p=thirdparty%2Fntp.git [Bug 2272] Use c99 integer types: ntp_calendar.h, ntp_types.h bk: 525e5216q_TBuFk-4pa1m6Qt4Y5CAQ --- diff --git a/ChangeLog b/ChangeLog index 463440b8e..131b6c9b1 100644 --- 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 * [Bug 2375] Improve AIX compatibility. * [Bug 2490] Fixed non-const initializer coming from [Bug 2250] fix. diff --git a/include/ntp_calendar.h b/include/ntp_calendar.h index c1838400a..53ce61459 100644 --- a/include/ntp_calendar.h +++ b/include/ntp_calendar.h @@ -10,24 +10,24 @@ /* 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 */ diff --git a/include/ntp_types.h b/include/ntp_types.h index f5bcced06..1beb16647 100644 --- a/include/ntp_types.h +++ b/include/ntp_types.h @@ -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)