From b2ccf8dd31d1457ae9f0ae270054117179220370 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 7 Apr 2015 08:29:34 +0000 Subject: Imported from /home/lorry/working-area/delta_ntp/ntp-4.2.8p2.tar.gz. --- ntpd/refclock_jjy.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'ntpd/refclock_jjy.c') diff --git a/ntpd/refclock_jjy.c b/ntpd/refclock_jjy.c index d8ec6b7..e279ee3 100644 --- a/ntpd/refclock_jjy.c +++ b/ntpd/refclock_jjy.c @@ -297,9 +297,9 @@ struct refclock refclock_jjy = { static struct { - char commandNumber ; - char *commandLog ; - char *command ; + const char commandNumber ; + const char *commandLog ; + const char *command ; int commandLength ; } tristate_jjy01_command_sequence[] = { @@ -337,8 +337,8 @@ static struct static struct { char commandNumber ; - char *commandLog ; - char *command ; + const char *commandLog ; + const char *command ; int commandLength ; } tristate_gpsclock01_command_sequence[] = { @@ -741,7 +741,7 @@ static int jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp ) { #ifdef DEBUG - static char *sFunctionName = "jjy_receive_tristate_jjy01" ; + static const char *sFunctionName = "jjy_receive_tristate_jjy01" ; #endif struct jjyunit *up ; @@ -756,7 +756,7 @@ jjy_receive_tristate_jjy01 ( struct recvbuf *rbufp ) char sLogText [ MAX_LOGTEXT ], sReplyText [ MAX_LOGTEXT ] ; - char *pCmd ; + const char *pCmd ; int iCmdLen ; /* @@ -930,7 +930,7 @@ static int jjy_receive_cdex_jst2000 ( struct recvbuf *rbufp ) { #ifdef DEBUG - static char *sFunctionName = "jjy_receive_cdex_jst2000" ; + static const char *sFunctionName = "jjy_receive_cdex_jst2000" ; #endif struct jjyunit *up ; @@ -1010,7 +1010,7 @@ static int jjy_receive_echokeisokuki_lt2000 ( struct recvbuf *rbufp ) { #ifdef DEBUG - static char *sFunctionName = "jjy_receive_echokeisokuki_lt2000" ; + static const char *sFunctionName = "jjy_receive_echokeisokuki_lt2000" ; #endif struct jjyunit *up ; @@ -1052,7 +1052,7 @@ jjy_receive_echokeisokuki_lt2000 ( struct recvbuf *rbufp ) if ( up->operationmode == 1 ) { #ifdef DEBUG if ( debug ) { - printf ( "%s (refclock_jjy.c) : send '#'\n", sFunctionName ) ; + printf ( "%s (refclock_jjy.c) : send '#'\n", __func__ ) ; } #endif if ( write ( pp->io.fd, "#",1 ) != 1 ) { @@ -1169,7 +1169,7 @@ static int jjy_receive_citizentic_jjy200 ( struct recvbuf *rbufp ) { #ifdef DEBUG - static char *sFunctionName = "jjy_receive_citizentic_jjy200" ; + static const char *sFunctionName = "jjy_receive_citizentic_jjy200" ; #endif struct jjyunit *up ; @@ -1264,7 +1264,7 @@ static int jjy_receive_tristate_gpsclock01 ( struct recvbuf *rbufp ) { #ifdef DEBUG - static char *sFunctionName = "jjy_receive_tristate_gpsclock01" ; + static const char *sFunctionName = "jjy_receive_tristate_gpsclock01" ; #endif struct jjyunit *up ; @@ -1279,7 +1279,7 @@ jjy_receive_tristate_gpsclock01 ( struct recvbuf *rbufp ) char sLogText [ MAX_LOGTEXT ], sReplyText [ MAX_LOGTEXT ] ; - char *pCmd ; + const char *pCmd ; int iCmdLen ; /* @@ -1519,13 +1519,13 @@ static void jjy_poll_tristate_jjy01 ( int unit, struct peer *peer ) { #ifdef DEBUG - static char *sFunctionName = "jjy_poll_tristate_jjy01" ; + static const char *sFunctionName = "jjy_poll_tristate_jjy01" ; #endif struct jjyunit *up; struct refclockproc *pp; - char *pCmd ; + const char *pCmd ; int iCmdLen ; pp = peer->procptr; @@ -1641,13 +1641,13 @@ static void jjy_poll_tristate_gpsclock01 ( int unit, struct peer *peer ) { #ifdef DEBUG - static char *sFunctionName = "jjy_poll_tristate_gpsclock01" ; + static const char *sFunctionName = "jjy_poll_tristate_gpsclock01" ; #endif struct jjyunit *up; struct refclockproc *pp; - char *pCmd ; + const char *pCmd ; int iCmdLen ; pp = peer->procptr; @@ -1690,7 +1690,7 @@ jjy_poll_tristate_gpsclock01 ( int unit, struct peer *peer ) static void printableString ( char *sOutput, int iOutputLen, char *sInput, int iInputLen ) { - char *printableControlChar[] = { + const char *printableControlChar[] = { "", "", "", "", "", "", "", "", "" , "" , "" , "" , @@ -1700,16 +1700,15 @@ printableString ( char *sOutput, int iOutputLen, char *sInput, int iInputLen ) "", "" , "", "", "" , "" , "" , "" , " " } ; + + size_t i, j, n ; size_t InputLen; size_t OutputLen; - size_t i; - size_t j; - size_t n; InputLen = (size_t)iInputLen; OutputLen = (size_t)iOutputLen; for ( i = j = 0 ; i < InputLen && j < OutputLen ; i ++ ) { - if ( isprint( sInput[i] ) ) { + if ( isprint( (unsigned char)sInput[i] ) ) { n = 1 ; if ( j + 1 >= OutputLen ) break ; @@ -1732,7 +1731,7 @@ printableString ( char *sOutput, int iOutputLen, char *sInput, int iInputLen ) j += n ; } - sOutput[min(j, iOutputLen - 1)] = '\0' ; + sOutput[min(j, (size_t)iOutputLen - 1)] = '\0' ; } -- cgit v1.2.1