[Git][NTPsec/ntpsec][master] 6 commits: dolfptoa: fix a 32 bit warning that showed on RasPi.
Gary E. Miller
gitlab at mg.gitlab.com
Tue May 16 02:13:29 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
66f120ee by Gary E. Miller at 2017-05-15T19:12:59-07:00
dolfptoa: fix a 32 bit warning that showed on RasPi.
- - - - -
6c11551a by Gary E. Miller at 2017-05-15T19:12:59-07:00
leapsec_query: removea 32-bit warning.
- - - - -
fa163e69 by Gary E. Miller at 2017-05-15T19:12:59-07:00
process_control; silence a warning on 32-bit RasPi.
- - - - -
86154d01 by Gary E. Miller at 2017-05-15T19:12:59-07:00
process_control: fix two 32-bit warnings about signed-ness.
- - - - -
8ac98e31 by Gary E. Miller at 2017-05-15T19:12:59-07:00
onceore: remove pointless cast from long to ulong to long.
This created a warning on 32 bit RasPi and the valid range is
tested later by existing code.
- - - - -
8221dafd by Gary E. Miller at 2017-05-15T19:12:59-07:00
refclock_jjy: convert several implicit casts to explicit.
For some reason only warnings showed up on 32-bit RasPi.
- - - - -
5 changed files:
- libntp/dolfptoa.c
- ntpd/ntp_control.c
- ntpd/ntp_leapsec.c
- ntpd/refclock_jjy.c
- ntpd/refclock_oncore.c
Changes:
=====================================
libntp/dolfptoa.c
=====================================
--- a/libntp/dolfptoa.c
+++ b/libntp/dolfptoa.c
@@ -67,8 +67,8 @@ dolfptoa(
dec += 3;
cpdec += 3;
}
- if ((size_t)dec > sizeof(cbuf) - (size_t)(cpend - cbuf))
- dec = sizeof(cbuf) - (size_t)(cpend - cbuf);
+ if (dec > (long)sizeof(cbuf) - (cpend - cbuf))
+ dec = (long)sizeof(cbuf) - (cpend - cbuf);
/*
* If there's a fraction to deal with, do so.
=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -804,7 +804,7 @@ process_control(
* We're set up now. Make sure we've got at least enough
* incoming data space to match the count.
*/
- req_data = rbufp->recv_length - CTL_HEADER_LEN;
+ req_data = (int)rbufp->recv_length - (int)CTL_HEADER_LEN;
if (req_data < req_count || rbufp->recv_length & 0x3) {
ctl_error(CERR_BADFMT);
numctldatatooshort++;
@@ -828,8 +828,8 @@ process_control(
if (!authistrusted(res_keyid))
DPRINTF(3, ("invalid keyid %08x\n", res_keyid));
else if (authdecrypt(res_keyid, (uint32_t *)pkt,
- rbufp->recv_length - maclen,
- maclen)) {
+ (int)rbufp->recv_length - (int)maclen,
+ (int)maclen)) {
res_authokay = true;
DPRINTF(3, ("authenticated okay\n"));
} else {
=====================================
ntpd/ntp_leapsec.c
=====================================
--- a/ntpd/ntp_leapsec.c
+++ b/ntpd/ntp_leapsec.c
@@ -314,7 +314,7 @@ leapsec_query(
/* now start to collect the remaining data */
qr->tai_diff = pt->head.next_tai - pt->head.this_tai;
qr->ttime = pt->head.ttime;
- qr->ddist = pt->head.dtime - when;
+ qr->ddist = (uint32_t)(pt->head.dtime - when);
qr->dynamic = pt->head.dynls;
qr->proximity = LSPROX_SCHEDULE;
=====================================
ntpd/refclock_jjy.c
=====================================
--- a/ntpd/refclock_jjy.c
+++ b/ntpd/refclock_jjy.c
@@ -1742,7 +1742,7 @@ jjy_receive_echokeisokuki_lt2000 ( struct recvbuf *rbufp )
/* Switch from mode 2 to mode 1 in order to restraint of
* useless time stamp.
*/
- iLen = strlen( ECHOKEISOKUKI_LT2000_COMMAND_REQUEST_SEND ) ;
+ iLen = (int)strlen( ECHOKEISOKUKI_LT2000_COMMAND_REQUEST_SEND ) ;
if ( write ( pp->io.fd, ECHOKEISOKUKI_LT2000_COMMAND_REQUEST_SEND,
(size_t)iLen ) != iLen ) {
refclock_report ( peer, CEVNT_FAULT ) ;
@@ -2774,7 +2774,7 @@ jjy_start_telephone ( int unit, struct peer *peer, struct jjyunit *up )
return true ;
}
iFirstThreeDigitsCount = 0 ;
- iCommaPosition = i ;
+ iCommaPosition = (int)i ;
} else if ( *(sys_phone[0]+i) != '-' ) {
msyslog( LOG_ERR, "refclock_jjy.c : jjy_start_telephone : phone in the ntpd.conf should be a number or a hyphen." ) ;
up->bInitError = true ;
@@ -3299,7 +3299,7 @@ teljjy_login_login ( struct peer *peer, struct refclockproc *pp, struct jjyunit
pCmd = "TJJY\r" ;
/* Send login ID */
- iCmdLen = strlen( pCmd ) ;
+ iCmdLen = (int)strlen( pCmd ) ;
if ( write( pp->io.fd, pCmd, (size_t)iCmdLen ) != iCmdLen ) {
refclock_report( peer, CEVNT_FAULT ) ;
}
@@ -4221,7 +4221,7 @@ modem_init_resp00 ( struct peer *peer, struct refclockproc *pp, struct jjyunit *
if ( pCmd != NULL ) {
- iCmdLen = strlen( pCmd ) ;
+ iCmdLen = (int)strlen( pCmd ) ;
if ( write( pp->io.fd, pCmd, (size_t)iCmdLen ) != iCmdLen ) {
refclock_report( peer, CEVNT_FAULT ) ;
}
@@ -4303,7 +4303,7 @@ modem_dial_dialout ( struct peer *peer, struct refclockproc *pp, struct jjyunit
snprintf( sCmd, sizeof(sCmd), "ATDW%c%s\r\n", cToneOrPulse, *sys_phone ) ;
/* Send command */
- iCmdLen = strlen( sCmd ) ;
+ iCmdLen = (int)strlen( sCmd ) ;
if ( write( pp->io.fd, sCmd, (size_t)iCmdLen ) != iCmdLen ) {
refclock_report( peer, CEVNT_FAULT ) ;
}
@@ -4419,7 +4419,7 @@ modem_esc_escape ( struct peer *peer, struct refclockproc *pp, struct jjyunit *u
pCmd = "+++" ;
/* Send command */
- iCmdLen = strlen( pCmd ) ;
+ iCmdLen = (int)strlen( pCmd ) ;
if ( write( pp->io.fd, pCmd, (size_t)iCmdLen ) != iCmdLen ) {
refclock_report( peer, CEVNT_FAULT ) ;
}
@@ -4488,7 +4488,7 @@ modem_esc_disc ( struct peer *peer, struct refclockproc *pp, struct jjyunit *up
pCmd = "ATH0\r\n" ;
/* Send command */
- iCmdLen = strlen( pCmd ) ;
+ iCmdLen = (int)strlen( pCmd ) ;
if ( write( pp->io.fd, pCmd, (size_t)iCmdLen ) != iCmdLen ) {
refclock_report( peer, CEVNT_FAULT ) ;
}
@@ -4545,8 +4545,8 @@ jjy_write_clockstats ( struct peer *peer, int iMark, const char *pData )
break ;
}
- iDataLen = strlen( pData ) ;
- iMarkLen = strlen( pMark ) ;
+ iDataLen = (int)strlen( pData ) ;
+ iMarkLen = (int)strlen( pMark ) ;
strlcpy( sLog, pMark, sizeof( sLog )) ;
printableString( sLog+iMarkLen, (int)sizeof(sLog)-iMarkLen,
pData, iDataLen ) ;
=====================================
ntpd/refclock_oncore.c
=====================================
--- a/ntpd/refclock_oncore.c
+++ b/ntpd/refclock_oncore.c
@@ -2037,7 +2037,8 @@ oncore_msg_Ay(
instance->saw_Ay = 1;
- instance->offset = (u_long)buf_w32(&buf[4]);
+ /* @@Ay is between 0 and 999999999 */
+ instance->offset = buf_w32(&buf[4]);
oncore_log_f(instance, LOG_INFO, "PPS Offset is set to %ld ns",
instance->offset);
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/1751e893aeafd00312efe8cc8e8a64e30a55a274...8221dafd5aa097abf3d4507f7f673a2e52232a6b
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/1751e893aeafd00312efe8cc8e8a64e30a55a274...8221dafd5aa097abf3d4507f7f673a2e52232a6b
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170516/a3142551/attachment.html>
More information about the vc
mailing list