summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--term.c7
-rw-r--r--term.h2
-rw-r--r--term_ascii.c12
-rw-r--r--term_ps.c12
4 files changed, 13 insertions, 20 deletions
diff --git a/term.c b/term.c
index 3776f250..71fea0f1 100644
--- a/term.c
+++ b/term.c
@@ -692,6 +692,11 @@ term_vspan(const struct termp *p, const struct roffsu *su)
size_t
term_hspan(const struct termp *p, const struct roffsu *su)
{
+ double v;
- return((*p->hspan)(p, su));
+ v = ((*p->hspan)(p, su));
+ if (v < 0.0)
+ v = 0.0;
+ return((size_t) /* LINTED */
+ v);
}
diff --git a/term.h b/term.h
index a884ccad..755b6b95 100644
--- a/term.h
+++ b/term.h
@@ -103,7 +103,7 @@ struct termp {
void (*endline)(struct termp *);
void (*advance)(struct termp *, size_t);
size_t (*width)(const struct termp *, char);
- size_t (*hspan)(const struct termp *,
+ double (*hspan)(const struct termp *,
const struct roffsu *);
const void *argf; /* arg for headf/footf */
union {
diff --git a/term_ascii.c b/term_ascii.c
index fa19eb1b..5d36c9bc 100644
--- a/term_ascii.c
+++ b/term_ascii.c
@@ -30,7 +30,7 @@
#include "term.h"
#include "main.h"
-static size_t ascii_hspan(const struct termp *,
+static double ascii_hspan(const struct termp *,
const struct roffsu *);
static size_t ascii_width(const struct termp *, char);
static void ascii_advance(struct termp *, size_t);
@@ -146,7 +146,7 @@ ascii_advance(struct termp *p, size_t len)
/* ARGSUSED */
-static size_t
+static double
ascii_hspan(const struct termp *p, const struct roffsu *su)
{
double r;
@@ -180,12 +180,6 @@ ascii_hspan(const struct termp *p, const struct roffsu *su)
break;
}
- /* Explicitly disallow negative values. */
-
- if (r < 0.0)
- r = 0.0;
-
- return((size_t)/* LINTED */
- r);
+ return(r);
}
diff --git a/term_ps.c b/term_ps.c
index 240275b7..dea8b5db 100644
--- a/term_ps.c
+++ b/term_ps.c
@@ -359,7 +359,7 @@ static const struct font fonts[TERMFONT__MAX] = {
} while (/* CONSTCOND */ 0)
-static size_t ps_hspan(const struct termp *,
+static double ps_hspan(const struct termp *,
const struct roffsu *);
static size_t ps_width(const struct termp *, char);
static void ps_advance(struct termp *, size_t);
@@ -828,7 +828,7 @@ ps_width(const struct termp *p, char c)
}
-static size_t
+static double
ps_hspan(const struct termp *p, const struct roffsu *su)
{
double r;
@@ -871,12 +871,6 @@ ps_hspan(const struct termp *p, const struct roffsu *su)
break;
}
- /* Explicitly disallow negative values. */
-
- if (r < 0.0)
- r = 0.0;
-
- return((size_t)/* LINTED */
- r);
+ return(r);
}