From: Frederick Bruckman Date: Sun, 5 Oct 2003 22:49:11 +0000 (-0500) Subject: Fixes for various and sundry compiler warnings, from NetBSD. X-Git-Tag: NTP_4_2_0~6^2~2^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d3e475a6f59f93ab15c8bca3a2cf1c99864fb89d;p=thirdparty%2Fntp.git Fixes for various and sundry compiler warnings, from NetBSD. bk: 3f809fe7mTX56nakJoOsyL1P7j0ILQ --- diff --git a/ntpd/ntp_control.c b/ntpd/ntp_control.c index 568d032061..0ac040493b 100644 --- a/ntpd/ntp_control.c +++ b/ntpd/ntp_control.c @@ -42,7 +42,9 @@ struct ctl_proc { * Request processing routines */ static void ctl_error P((int)); +#ifdef REFCLOCK static u_short ctlclkstatus P((struct refclockstat *)); +#endif static void ctl_flushpkt P((int)); static void ctl_putdata P((const char *, unsigned int, int)); static void ctl_putstr P((const char *, const char *, @@ -729,6 +731,7 @@ ctlpeerstatus( /* * ctlclkstatus - return a status word for this clock */ +#ifdef REFCLOCK static u_short ctlclkstatus( struct refclockstat *this_clock @@ -737,6 +740,7 @@ ctlclkstatus( return ((u_short)(((this_clock->currentstatus) << 8) | (this_clock->lastevent))); } +#endif /* diff --git a/ntpd/ntp_crypto.c b/ntpd/ntp_crypto.c index c55108548d..3e677032a1 100644 --- a/ntpd/ntp_crypto.c +++ b/ntpd/ntp_crypto.c @@ -2207,7 +2207,7 @@ crypto_iff( DSA_SIG *sdsa; /* DSA parameters */ BIGNUM *bn, *bk; u_int len; - u_char *ptr; + const u_char *ptr; int temp; /* @@ -2237,7 +2237,7 @@ crypto_iff( */ bctx = BN_CTX_new(); bk = BN_new(); bn = BN_new(); len = ntohl(ep->vallen); - ptr = (u_char *)ep->pkt; + ptr = (const u_char *)ep->pkt; if ((sdsa = d2i_DSA_SIG(NULL, &ptr, len)) == NULL) { msyslog(LOG_ERR, "crypto_iff %s\n", ERR_error_string(ERR_get_error(), NULL)); @@ -2495,7 +2495,7 @@ crypto_gq( BN_CTX *bctx; /* BIGNUM context */ DSA_SIG *sdsa; /* RSA signature context fake */ BIGNUM *y, *v; - u_char *ptr; + const u_char *ptr; u_int len; int temp; @@ -2527,7 +2527,7 @@ crypto_gq( */ bctx = BN_CTX_new(); y = BN_new(); v = BN_new(); len = ntohl(ep->vallen); - ptr = (u_char *)ep->pkt; + ptr = (const u_char *)ep->pkt; if ((sdsa = d2i_DSA_SIG(NULL, &ptr, len)) == NULL) { msyslog(LOG_ERR, "crypto_gq %s\n", ERR_error_string(ERR_get_error(), NULL)); @@ -2813,7 +2813,7 @@ crypto_mv( BN_CTX *bctx; /* BIGNUM context */ BIGNUM *k, *u, *v; u_int len; - u_char *ptr; + const u_char *ptr; int temp; /* @@ -2843,7 +2843,7 @@ crypto_mv( */ bctx = BN_CTX_new(); k = BN_new(); u = BN_new(); v = BN_new(); len = ntohl(ep->vallen); - ptr = (u_char *)ep->pkt; + ptr = (const u_char *)ep->pkt; if ((sdsa = d2i_DSAparams(NULL, &ptr, len)) == NULL) { msyslog(LOG_ERR, "crypto_mv %s\n", ERR_error_string(ERR_get_error(), NULL)); diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index 65df620952..9f2acea8bb 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -145,7 +145,9 @@ int maxactivefd; static int create_sockets P((u_short)); static SOCKET open_socket P((struct sockaddr_storage *, int, int)); static void close_socket P((SOCKET)); +#ifdef REFCLOCK static void close_file P((SOCKET)); +#endif static char * fdbits P((int, fd_set *)); static void set_reuseaddr P((int)); @@ -1283,6 +1285,7 @@ close_socket( * close_file - close a file and remove from the activefd list * added 1/31/1997 Greg Schueman for Windows NT portability */ +#ifdef REFCLOCK static void close_file( SOCKET fd @@ -1308,6 +1311,7 @@ close_file( delete_socket_from_list(fd); } +#endif /* XXX ELIMINATE sendpkt similar in ntpq.c, ntpdc.c, ntp_io.c, ntptrace.c */ diff --git a/ntpd/refclock_shm.c b/ntpd/refclock_shm.c index 0b78b951c8..4ab0eded86 100644 --- a/ntpd/refclock_shm.c +++ b/ntpd/refclock_shm.c @@ -87,6 +87,9 @@ struct shmTime { int valid; int dummy[10]; }; + +struct shmTime *getShmTime(int); + struct shmTime *getShmTime (int unit) { #ifndef SYS_WINNT int shmid=0; diff --git a/ntpdc/ntpdc_ops.c b/ntpdc/ntpdc_ops.c index 7c5e925fe2..190c83a9cf 100644 --- a/ntpdc/ntpdc_ops.c +++ b/ntpdc/ntpdc_ops.c @@ -293,7 +293,7 @@ peerlist( again: res = doquery(impl_ver, REQ_PEER_LIST, 0, 0, 0, (char *)NULL, &items, - &itemsize, (char **)&plist, 0, + &itemsize, (void *)&plist, 0, sizeof(struct info_peer_list)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -383,7 +383,7 @@ dopeers( again: res = doquery(impl_ver, REQ_PEER_LIST_SUM, 0, 0, 0, (char *)NULL, - &items, &itemsize, (char **)&plist, 0, + &items, &itemsize, (void *)&plist, 0, sizeof(struct info_peer_summary)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -667,7 +667,7 @@ again: res = doquery(impl_ver, REQ_PEER_INFO, 0, qitems, sendsize, (char *)plist, &items, - &itemsize, (char **)&pp, 0, sizeof(struct info_peer)); + &itemsize, (void *)&pp, 0, sizeof(struct info_peer)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { impl_ver = IMPL_XNTPD_OLD; @@ -740,7 +740,7 @@ again: res = doquery(impl_ver, REQ_PEER_STATS, 0, qitems, sendsize, (char *)plist, &items, - &itemsize, (char **)&pp, 0, + &itemsize, (void *)&pp, 0, sizeof(struct info_peer_stats)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -838,7 +838,7 @@ loopinfo( again: res = doquery(impl_ver, REQ_LOOP_INFO, 0, 0, 0, (char *)NULL, - &items, &itemsize, (char **)&il, 0, + &items, &itemsize, (void *)&il, 0, sizeof(struct info_loop)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -901,7 +901,7 @@ sysinfo( again: res = doquery(impl_ver, REQ_SYS_INFO, 0, 0, 0, (char *)NULL, - &items, &itemsize, (char **)&is, 0, + &items, &itemsize, (void *)&is, 0, sizeof(struct info_sys)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -998,7 +998,7 @@ sysstats( again: res = doquery(impl_ver, REQ_SYS_STATS, 0, 0, 0, (char *)NULL, - &items, &itemsize, (char **)&ss, 0, + &items, &itemsize, (void *)&ss, 0, sizeof(struct info_sys_stats)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -1064,7 +1064,7 @@ iostats( again: res = doquery(impl_ver, REQ_IO_STATS, 0, 0, 0, (char *)NULL, - &items, &itemsize, (char **)&io, 0, + &items, &itemsize, (void *)&io, 0, sizeof(struct info_io_stats)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -1126,7 +1126,7 @@ memstats( again: res = doquery(impl_ver, REQ_MEM_STATS, 0, 0, 0, (char *)NULL, - &items, &itemsize, (char **)&mem, 0, + &items, &itemsize, (void *)&mem, 0, sizeof(struct info_mem_stats)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -1185,7 +1185,7 @@ timerstats( again: res = doquery(impl_ver, REQ_TIMER_STATS, 0, 0, 0, (char *)NULL, - &items, &itemsize, (char **)&tim, 0, + &items, &itemsize, (void *)&tim, 0, sizeof(struct info_timer_stats)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -1606,7 +1606,7 @@ reslist( again: res = doquery(impl_ver, REQ_GET_RESTRICT, 0, 0, 0, (char *)NULL, - &items, &itemsize, (char **)&rl, 0, + &items, &itemsize, (void *)&rl, 0, sizeof(struct info_restrict)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -2260,7 +2260,7 @@ authinfo( again: res = doquery(impl_ver, REQ_AUTHINFO, 0, 0, 0, (char *)NULL, - &items, &itemsize, (char **)&ia, 0, + &items, &itemsize, (void *)&ia, 0, sizeof(struct info_auth)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -2318,7 +2318,7 @@ traps( again: res = doquery(impl_ver, REQ_TRAPS, 0, 0, 0, (char *)NULL, - &items, &itemsize, (char **)&it, 0, + &items, &itemsize, (void *)&it, 0, sizeof(struct info_trap)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -2559,7 +2559,7 @@ ctlstats( again: res = doquery(impl_ver, REQ_GET_CTLSTATS, 0, 0, 0, (char *)NULL, - &items, &itemsize, (char **)&ic, 0, + &items, &itemsize, (void *)&ic, 0, sizeof(struct info_control)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { @@ -2635,7 +2635,7 @@ clockstat( again: res = doquery(impl_ver, REQ_GET_CLOCKINFO, 0, qitems, sizeof(u_int32), (char *)clist, &items, - &itemsize, (char **)&cl, 0, sizeof(struct info_clock)); + &itemsize, (void *)&cl, 0, sizeof(struct info_clock)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { impl_ver = IMPL_XNTPD_OLD; @@ -2808,7 +2808,7 @@ clkbug( again: res = doquery(impl_ver, REQ_GET_CLKBUGINFO, 0, qitems, sizeof(u_int32), (char *)clist, &items, - &itemsize, (char **)&cl, 0, sizeof(struct info_clkbug)); + &itemsize, (void *)&cl, 0, sizeof(struct info_clkbug)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { impl_ver = IMPL_XNTPD_OLD; @@ -2895,7 +2895,7 @@ kerninfo( again: res = doquery(impl_ver, REQ_GET_KERNEL, 0, 0, 0, (char *)NULL, - &items, &itemsize, (char **)&ik, 0, + &items, &itemsize, (void *)&ik, 0, sizeof(struct info_kernel)); if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) { diff --git a/ntpq/ntpq.c b/ntpq/ntpq.c index 73b2dcaa60..5c98af4a9f 100644 --- a/ntpq/ntpq.c +++ b/ntpq/ntpq.c @@ -1911,8 +1911,8 @@ decodeint( { if (*str == '0') { if (*(str+1) == 'x' || *(str+1) == 'X') - return hextoint(str+2, (u_long *)&val); - return octtoint(str, (u_long *)&val); + return hextoint(str+2, (void *)&val); + return octtoint(str, (void *)&val); } return atoint(str, val); } diff --git a/ntpq/ntpq_ops.c b/ntpq/ntpq_ops.c index 8b71407e65..c4936313eb 100644 --- a/ntpq/ntpq_ops.c +++ b/ntpq/ntpq_ops.c @@ -865,7 +865,7 @@ dogetassoc( u_short rstatus; res = doquery(CTL_OP_READSTAT, 0, 0, 0, (char *)0, &rstatus, - &dsize, (char **)&datap); + &dsize, (void *)&datap); if (res != 0) return 0;