[Git][NTPsec/ntpsec][master] 4 commits: tests:/lpfunc: test to see if inline is a problem with NetBSD.
Gary E. Miller
gitlab at mg.gitlab.com
Fri Apr 14 01:45:32 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
42d378d3 by Gary E. Miller at 2017-04-13T18:44:54-07:00
tests:/lpfunc: test to see if inline is a problem with NetBSD.
- - - - -
8665e778 by Gary E. Miller at 2017-04-13T18:44:54-07:00
ntp_io: add missing default cases.
- - - - -
d9ead3aa by Gary E. Miller at 2017-04-13T18:44:54-07:00
ntpd; add missing default case, fix a bad exit() code.
- - - - -
a7976858 by Gary E. Miller at 2017-04-13T18:44:54-07:00
Add missing trivial default cases to switches.
- - - - -
6 changed files:
- libjsmn/jsmn.c
- ntpd/ntp_io.c
- ntpd/ntp_packetstamp.c
- ntpd/ntpd.c
- ntpd/refclock_jjy.c
- tests/libntp/lfpfunc.c
Changes:
=====================================
libjsmn/jsmn.c
=====================================
--- a/libjsmn/jsmn.c
+++ b/libjsmn/jsmn.c
@@ -46,12 +46,15 @@ static jsmnerr_t jsmn_parse_primitive(jsmn_parser *parser, const char *js,
for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
switch (js[parser->pos]) {
#ifndef JSMN_STRICT
- /* In strict mode primitive must be followed by "," or "}" or "]" */
- case ':':
+ /* In strict mode primitive must be followed by "," or "}" or "]" */
+ case ':':
#endif
- case '\t' : case '\r' : case '\n' : case ' ' :
- case ',' : case ']' : case '}' :
- goto found;
+ case '\t' : case '\r' : case '\n' : case ' ' :
+ case ',' : case ']' : case '}' :
+ goto found;
+ default:
+ /* huh? */
+ break;
}
if (js[parser->pos] < 32 || js[parser->pos] >= 127) {
parser->pos = (unsigned int)start;
=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -1012,7 +1012,8 @@ interface_action(
for (rule = nic_rule_list; rule != NULL; rule = rule->next) {
switch (rule->match_type) {
-
+ default:
+ /* huh? */
case MATCH_ALL:
/* loopback and wildcard excluded from "all" */
if (isloopback || iswildcard)
@@ -1278,7 +1279,6 @@ sau_from_netaddr(
ZERO_SOCK(psau);
AF(psau) = (sa_family_t)pna->family;
switch (pna->family) {
-
case AF_INET:
memcpy(&SOCK_ADDR4(psau), &pna->type.in,
sizeof(SOCK_ADDR4(psau)));
@@ -1288,6 +1288,9 @@ sau_from_netaddr(
memcpy(&SOCK_ADDR6(psau), &pna->type.in6,
sizeof(SOCK_ADDR6(psau)));
break;
+ default:
+ /* huh? */
+ break;
}
}
@@ -1503,6 +1506,7 @@ update_interfaces(
switch (interface_action(enumep.name, &enumep.sin,
enumep.flags)) {
+ default:
case ACTION_IGNORE:
DPRINTF(4, ("ignoring interface %s (%s) - by nic rules\n",
enumep.name, socktoa(&enumep.sin)));
=====================================
ntpd/ntp_packetstamp.c
=====================================
--- a/ntpd/ntp_packetstamp.c
+++ b/ntpd/ntp_packetstamp.c
@@ -197,6 +197,9 @@ fetch_packetstamp(
nts = tspec_stamp_to_lfp(tval_to_tspec(*tvp));
break;
#endif /* USE_SCM_TIMESTAMP */
+ default:
+ /* huh? */
+ break;
}
fuzz = ntp_random() * 2. / FRAC * sys_fuzz;
lfpfuzz = dtolfp(fuzz);
=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -729,7 +729,7 @@ ntpdmain(
msyslog(LOG_ERR,
"command line trusted key %s is invalid",
ntp_optarg);
- exit(0);
+ exit(1);
} else {
authtrust((keyid_t)tkey, true);
}
@@ -745,7 +745,10 @@ ntpdmain(
case 'Z':
if (ntp_optarg != NULL)
set_sys_var(ntp_optarg, strlen(ntp_optarg) + 1, (u_short) (RW | DEF));
- break;
+ break;
+ default:
+ msyslog(LOG_ERR, "invalid op: %d", op);
+ exit(1);
}
}
=====================================
ntpd/refclock_jjy.c
=====================================
--- a/ntpd/refclock_jjy.c
+++ b/ntpd/refclock_jjy.c
@@ -1763,6 +1763,9 @@ jjy_poll_echokeisokuki_lt2000 ( int unit, struct peer *peer )
case ECHOKEISOKUKI_LT2000_MODE_SWITCHING_CONTINUOUS :
sCmd[0] = 'C' ;
break ;
+ default:
+ /* huh? */
+ break ;
}
sCmd[1] = 0 ;
=====================================
tests/libntp/lfpfunc.c
=====================================
--- a/tests/libntp/lfpfunc.c
+++ b/tests/libntp/lfpfunc.c
@@ -255,15 +255,17 @@ TEST(lfpfunc, FDF_RoundTrip) {
// that limit.
for (idx = 0; idx < addsub_cnt; ++idx) {
+ double op2, d;
l_fp op1 = lfpinit_u(addsub_tab[idx][0].l_ui,
addsub_tab[idx][0].l_uf);
- double op2 = lfptod(op1);
+ // op2 = lfptod(op1);
+ op2 = ldexp((double)((int64_t)op1), -32);
l_fp op3 = dtolfp(op2);
l_fp temp = op1 - op3;
- double d = lfptod(temp);
+ d = lfptod(temp);
/* cast to long unsgiend int for 32 bit binaries */
- snprintf(msg, sizeof(msg), "%f diff %f not within %e",
+ snprintf(msg, sizeof(msg), "op2: %f diff %f not within %e",
op2, d, eps(op2));
TEST_ASSERT_DOUBLE_WITHIN_MESSAGE(eps(op2), 0.0, fabs(d), msg);
}
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/f1a139452f242e0ec96f52c2df1a2e47ca33325e...a7976858aa8fbad17c5200523e378690fb51a268
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/f1a139452f242e0ec96f52c2df1a2e47ca33325e...a7976858aa8fbad17c5200523e378690fb51a268
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/20170414/0dd9791e/attachment.html>
More information about the vc
mailing list