static void
printableString ( char *sOutput, int iOutputLen, char *sInput, int iInputLen )
{
-
char *printableControlChar[] = {
"<NUL>", "<SOH>", "<STX>", "<ETX>",
"<EOT>", "<ENQ>", "<ACK>", "<BEL>",
"<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 ;
}
* 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;
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);
}
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);
}