From 530429e4d6106c55bc735d1f397ba2d2c42c8cc5 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 26 Apr 2020 15:50:32 +0000 Subject: [PATCH] Add casts to work around harmless -Werror warnings from clang 10.0.0, such as: usr.sbin/timed/timed/networkdelta.c:160:13: error: implicit conversion from 'long' to 'float' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion] float ap = LONG_MAX; /* bounds on the median */ ~~ ^~~~~~~~ Direct commit to stable/{10,11,12}, since timed has been removed from FreeBSD 13. git-svn-id: svn://svn.freebsd.org/base/stable/10@360338 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/timed/Makefile | 1 + usr.sbin/timed/timed/networkdelta.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/usr.sbin/timed/Makefile b/usr.sbin/timed/Makefile index 2f56510bc..fe2d8a428 100644 --- a/usr.sbin/timed/Makefile +++ b/usr.sbin/timed/Makefile @@ -4,3 +4,4 @@ SUBDIR= timed timedc .include +# DO NOT DELETE diff --git a/usr.sbin/timed/timed/networkdelta.c b/usr.sbin/timed/timed/networkdelta.c index bf2a35389..90c68d32b 100644 --- a/usr.sbin/timed/timed/networkdelta.c +++ b/usr.sbin/timed/timed/networkdelta.c @@ -155,8 +155,8 @@ median(float a, float *eps_ptr, long *x, long *xlim, unsigned int gnuf) /* unsigned int gnuf; */ /* good enough estimate */ { long *xptr; - float ap = LONG_MAX; /* bounds on the median */ - float am = -LONG_MAX; + float ap = (float)LONG_MAX; /* bounds on the median */ + float am = -(float)LONG_MAX; float aa; int npts; /* # of points above & below guess */ float xp; /* closet point above the guess */ @@ -178,8 +178,8 @@ median(float a, float *eps_ptr, long *x, long *xlim, unsigned int gnuf) sum = 0.0; sumx = 0.0; npts = 0; - xp = LONG_MAX; - xm = -LONG_MAX; + xp = (float)LONG_MAX; + xm = -(float)LONG_MAX; for (xptr = x; xptr != xlim; xptr++) { float xx = *xptr; -- 2.42.0