summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2014-08-08 16:00:23 +0000
committerschwarze <schwarze@openbsd.org>2014-08-08 16:00:23 +0000
commit53ab8734a5619407a3c3ee69c102dad00d7359df (patch)
tree03cadcce943b3f12d194de04514de5749d47c68e
parentdemacrify: get rid of man_nmsg(), man_pmsg(), mdoc_nmsg(), mdoc_pmsg() (diff)
downloadwireguard-openbsd-53ab8734a5619407a3c3ee69c102dad00d7359df.tar.xz
wireguard-openbsd-53ab8734a5619407a3c3ee69c102dad00d7359df.zip
Clarity with respect to floating point handling:
Write double constants as double rather than integer literals. Remove useless explicit (double) cast done at one place and nowhere else. No functional change.
-rw-r--r--usr.bin/mandoc/man_html.c4
-rw-r--r--usr.bin/mandoc/mdoc_html.c6
-rw-r--r--usr.bin/mandoc/out.c6
-rw-r--r--usr.bin/mandoc/term.c14
-rw-r--r--usr.bin/mandoc/term_ascii.c14
-rw-r--r--usr.bin/mandoc/term_ps.c8
6 files changed, 26 insertions, 26 deletions
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index e14daa503a6..a7982edbfb1 100644
--- a/usr.bin/mandoc/man_html.c
+++ b/usr.bin/mandoc/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.54 2014/04/23 16:07:06 schwarze Exp $ */
+/* $Id: man_html.c,v 1.55 2014/08/08 16:00:23 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -384,7 +384,7 @@ man_br_pre(MAN_ARGS)
if ( ! a2roffsu(n->string, &su, SCALE_VS))
SCALE_VS_INIT(&su, atoi(n->string));
} else
- su.scale = 0;
+ su.scale = 0.0;
bufinit(h);
bufcat_su(h, "height", &su);
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index ec0d14bcd89..df8797adaf7 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.76 2014/08/08 15:10:14 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.77 2014/08/08 16:00:23 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -695,7 +695,7 @@ mdoc_nm_pre(MDOC_ARGS)
if (0 == len && meta->name)
len = html_strlen(meta->name);
- SCALE_HS_INIT(&su, (double)len);
+ SCALE_HS_INIT(&su, len);
bufinit(h);
bufcat_su(h, "width", &su);
PAIR_STYLE_INIT(&tag, h);
@@ -1561,7 +1561,7 @@ mdoc_sp_pre(MDOC_ARGS)
if ( ! a2roffsu(n->string, &su, SCALE_VS))
SCALE_VS_INIT(&su, atoi(n->string));
} else
- su.scale = 0;
+ su.scale = 0.0;
bufinit(h);
bufcat_su(h, "height", &su);
diff --git a/usr.bin/mandoc/out.c b/usr.bin/mandoc/out.c
index 55cad2527e4..c1794a9e8cc 100644
--- a/usr.bin/mandoc/out.c
+++ b/usr.bin/mandoc/out.c
@@ -1,4 +1,4 @@
-/* $Id: out.c,v 1.21 2014/04/20 16:44:44 schwarze Exp $ */
+/* $Id: out.c,v 1.22 2014/08/08 16:00:23 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -124,8 +124,8 @@ a2roffsu(const char *src, struct roffsu *dst, enum roffscale def)
}
/* FIXME: do this in the caller. */
- if ((dst->scale = atof(buf)) < 0)
- dst->scale = 0;
+ if ((dst->scale = atof(buf)) < 0.0)
+ dst->scale = 0.0;
dst->unit = unit;
return(1);
}
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c
index 2c29334a282..fc8743ed3c6 100644
--- a/usr.bin/mandoc/term.c
+++ b/usr.bin/mandoc/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.85 2014/07/06 18:51:08 schwarze Exp $ */
+/* $Id: term.c,v 1.86 2014/08/08 16:00:23 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -765,25 +765,25 @@ term_vspan(const struct termp *p, const struct roffsu *su)
switch (su->unit) {
case SCALE_CM:
- r = su->scale * 2;
+ r = su->scale * 2.0;
break;
case SCALE_IN:
- r = su->scale * 6;
+ r = su->scale * 6.0;
break;
case SCALE_PC:
r = su->scale;
break;
case SCALE_PT:
- r = su->scale / 8;
+ r = su->scale / 8.0;
break;
case SCALE_MM:
- r = su->scale / 1000;
+ r = su->scale / 1000.0;
break;
case SCALE_VS:
r = su->scale;
break;
default:
- r = su->scale - 1;
+ r = su->scale - 1.0;
break;
}
@@ -797,7 +797,7 @@ term_hspan(const struct termp *p, const struct roffsu *su)
{
double v;
- v = ((*p->hspan)(p, su));
+ v = (*p->hspan)(p, su);
if (v < 0.0)
v = 0.0;
return((size_t)v);
diff --git a/usr.bin/mandoc/term_ascii.c b/usr.bin/mandoc/term_ascii.c
index 064e12e0691..a1b02b525ff 100644
--- a/usr.bin/mandoc/term_ascii.c
+++ b/usr.bin/mandoc/term_ascii.c
@@ -1,4 +1,4 @@
-/* $Id: term_ascii.c,v 1.15 2014/07/27 21:51:53 schwarze Exp $ */
+/* $Id: term_ascii.c,v 1.16 2014/08/08 16:00:23 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -215,22 +215,22 @@ ascii_hspan(const struct termp *p, const struct roffsu *su)
switch (su->unit) {
case SCALE_CM:
- r = 4 * su->scale;
+ r = su->scale * 4.0;
break;
case SCALE_IN:
- r = 10 * su->scale;
+ r = su->scale * 10.0;
break;
case SCALE_PC:
- r = (10 * su->scale) / 6;
+ r = (su->scale * 10.0) / 6.0;
break;
case SCALE_PT:
- r = (10 * su->scale) / 72;
+ r = (su->scale * 10.0) / 72.0;
break;
case SCALE_MM:
- r = su->scale / 1000;
+ r = su->scale / 1000.0;
break;
case SCALE_VS:
- r = su->scale * 2 - 1;
+ r = su->scale * 2.0 - 1.0;
break;
default:
r = su->scale;
diff --git a/usr.bin/mandoc/term_ps.c b/usr.bin/mandoc/term_ps.c
index 5cb4369c469..542a7c37853 100644
--- a/usr.bin/mandoc/term_ps.c
+++ b/usr.bin/mandoc/term_ps.c
@@ -1,4 +1,4 @@
-/* $Id: term_ps.c,v 1.26 2014/07/27 21:53:04 schwarze Exp $ */
+/* $Id: term_ps.c,v 1.27 2014/08/08 16:00:23 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -1116,13 +1116,13 @@ ps_hspan(const struct termp *p, const struct roffsu *su)
r = PNT2AFM(p, su->scale * 28.34);
break;
case SCALE_IN:
- r = PNT2AFM(p, su->scale * 72);
+ r = PNT2AFM(p, su->scale * 72.0);
break;
case SCALE_PC:
- r = PNT2AFM(p, su->scale * 12);
+ r = PNT2AFM(p, su->scale * 12.0);
break;
case SCALE_PT:
- r = PNT2AFM(p, su->scale * 100);
+ r = PNT2AFM(p, su->scale * 100.0);
break;
case SCALE_EM:
r = su->scale *