]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
quiet gcc4 warnings
authorDave Hart <hart@ntp.org>
Wed, 15 Dec 2010 00:14:11 +0000 (00:14 +0000)
committerDave Hart <hart@ntp.org>
Wed, 15 Dec 2010 00:14:11 +0000 (00:14 +0000)
alloc/free peer group identity member

bk: 4d080853JAZhazHIWB14ZG6evGyVRQ

ntpd/ntp_control.c
ntpd/ntp_io.c
ntpd/ntp_peer.c
ntpd/refclock_jjy.c
ntpd/refclock_mx4200.c
sntp/tests/packetHandling.cpp

index 5e9dc5d5283aee1a637d3e31e0e4338a2bfc1dd0..afa989e823383492fca3a8625e8dc1ab4948f86c 100644 (file)
@@ -563,7 +563,6 @@ ctl_error(
        )
 {
        int             maclen;
-       keyid_t *       pkid;
 
        numctlerrors++;
        DPRINTF(3, ("sending control error %u\n", errcode));
index d3a96d2ff6696bef341a926e985406f63784ad69..ec2508bb2d00b64044204a1a8053c8fbfc00f00e 100644 (file)
@@ -3591,13 +3591,14 @@ input_handler(
        l_fp ts_e;              /* Timestamp at EOselect() gob */
 #endif
        fd_set fds;
-       int select_count = 0;
+       size_t select_count;
        endpt *ep;
 #if defined(HAS_ROUTING_SOCKET)
        struct asyncio_reader *asyncio_reader;
 #endif
 
        handler_calls++;
+       select_count = 0;
 
        /*
         * If we have something to do, freeze a timestamp.
index d16a9b2f266a38298128bd46513cf66a33806b92..9eeec21c17b2e4ab06a7ab67a4d387171cec962f 100644 (file)
@@ -467,6 +467,9 @@ free_peer(
        if (p->hostname != NULL)
                free(p->hostname);
 
+       if (p->ident != NULL)
+               free(p->ident);
+
        if (p->addrs != NULL)
                free(p->addrs);         /* from copy_addrinfo_list() */
 
@@ -894,7 +897,7 @@ newpeer(
 #endif /* AUTOKEY */
        peer->ttl = (u_char)ttl;
        peer->keyid = key;
-       peer->ident = group;
+       peer->ident = estrdup(group);
        peer->precision = sys_precision;
        peer->hpoll = peer->minpoll;
        if (cast_flags & MDF_ACAST)
index df7869dc987b0cdaf7a5db12d71c1dae50816509..a088140c60014b35e88e054d65e260888d3a94d7 100644 (file)
@@ -1349,7 +1349,6 @@ jjy_poll_citizentic_jjy200 ( int unit, struct peer *peer )
 static void
 printableString ( char *sOutput, int iOutputLen, char *sInput, int iInputLen )
 {
-
        char    *printableControlChar[] = {
                        "<NUL>", "<SOH>", "<STX>", "<ETX>",
                        "<EOT>", "<ENQ>", "<ACK>", "<BEL>",
@@ -1360,28 +1359,34 @@ printableString ( char *sOutput, int iOutputLen, char *sInput, int iInputLen )
                        "<CAN>", "<EM>" , "<SUB>", "<ESC>",
                        "<FS>" , "<GS>" , "<RS>" , "<US>" ,
                        " " } ;
-
-       int     i, j, n ;
-
-       for ( i = j = 0 ; i < iInputLen && j < iOutputLen ; i ++ ) {
+       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] ) ) {
                        n = 1 ;
-                       if ( j + 1 >= iOutputLen )
+                       if ( j + 1 >= OutputLen )
                                break ;
                        sOutput[j] = sInput[i] ;
                } else if ( ( sInput[i] & 0xFF ) < 
                            COUNTOF(printableControlChar) ) {
                        n = strlen( printableControlChar[sInput[i] & 0xFF] ) ;
-                       if ( j + n + 1 >= iOutputLen )
+                       if ( j + n + 1 >= OutputLen )
                                break ;
                        strncpy( sOutput + j,
                                 printableControlChar[sInput[i] & 0xFF],
-                                (size_t)iOutputLen - j ) ;
+                                OutputLen - j ) ;
                } else {
                        n = 5 ;
-                       if ( j + n + 1 >= iOutputLen ) break ;
-                       snprintf( sOutput + j, (size_t)iOutputLen - j,
-                                 "<x%X>", sInput[i] & 0xFF ) ;
+                       if ( j + n + 1 >= OutputLen )
+                               break ;
+                       snprintf( sOutput + j, OutputLen - j, "<x%X>",
+                                 sInput[i] & 0xFF ) ;
                }
                j += n ;
        }
index 11d4a260a0ebdee4905fb315abba4cc655b3aa52..7c85d07e685b65674e3c4c098cce143d542649d2 100644 (file)
@@ -840,7 +840,7 @@ mx4200_receive(
                 * Capture the last PPS signal.
                 * Precision timestamp is returned in pp->lastrec
                 */
-               if (mx4200_pps(peer) != NULL) {
+               if (0 != mx4200_pps(peer)) {
                        mx4200_debug(peer, "mx4200_receive: pps failure\n");
                        refclock_report(peer, CEVNT_FAULT);
                        return;
index 74b861da7f56f812f049c1659685c7c38b75f703..15f7fd98f700ceaa75eebfcbde4a49644e09793d 100644 (file)
@@ -122,7 +122,7 @@ TEST_F(mainTest, OffsetCalculationPositiveOffset) {
        offset_calculation(&rpkt, LEN_PKT_NOMAC, &dst, &offset, &precision, &root_disp);
 
        EXPECT_DOUBLE_EQ(1.25, offset);
-       EXPECT_DOUBLE_EQ(LOGTOD(-16), precision);
+       EXPECT_DOUBLE_EQ(1. / ULOGTOD(16), precision);
        EXPECT_DOUBLE_EQ(0.25, root_disp);
 }
 
@@ -164,7 +164,7 @@ TEST_F(mainTest, OffsetCalculationNegativeOffset) {
        offset_calculation(&rpkt, LEN_PKT_NOMAC, &dst, &offset, &precision, &root_disp);
 
        EXPECT_DOUBLE_EQ(-1, offset);
-       EXPECT_DOUBLE_EQ(LOGTOD(-1), precision);
+       EXPECT_DOUBLE_EQ(1. / ULOGTOD(1), precision);
        EXPECT_DOUBLE_EQ(0.5, root_disp);
 }