X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/6a81c8460007e1d52bf6aab06460b9ce75c1ae4b..ed59bcd1564904f6ab57883e191f819b724c3be3:/out.c diff --git a/out.c b/out.c index 96d1d771..9c4e4c94 100644 --- a/out.c +++ b/out.c @@ -1,4 +1,4 @@ -/* $Id: out.c,v 1.47 2014/03/23 11:25:26 schwarze Exp $ */ +/* $Id: out.c,v 1.48 2014/04/20 16:46:05 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze @@ -39,7 +39,8 @@ static void tblcalc_literal(struct rofftbl *, struct roffcol *, static void tblcalc_number(struct rofftbl *, struct roffcol *, const struct tbl_opts *, const struct tbl_dat *); -/* + +/* * Convert a `scaling unit' to a consistent form, or fail. Scaling * units are documented in groff.7, mdoc.7, man.7. */ @@ -56,10 +57,10 @@ a2roffsu(const char *src, struct roffsu *dst, enum roffscale def) i = hasd = 0; switch (*src) { - case ('+'): + case '+': src++; break; - case ('-'): + case '-': buf[i++] = *src++; break; default: @@ -87,39 +88,39 @@ a2roffsu(const char *src, struct roffsu *dst, enum roffscale def) buf[i] = '\0'; switch (*src) { - case ('c'): + case 'c': unit = SCALE_CM; break; - case ('i'): + case 'i': unit = SCALE_IN; break; - case ('P'): + case 'P': unit = SCALE_PC; break; - case ('p'): + case 'p': unit = SCALE_PT; break; - case ('f'): + case 'f': unit = SCALE_FS; break; - case ('v'): + case 'v': unit = SCALE_VS; break; - case ('m'): + case 'm': unit = SCALE_EM; break; - case ('\0'): + case '\0': if (SCALE_MAX == def) return(0); unit = SCALE_BU; break; - case ('u'): + case 'u': unit = SCALE_BU; break; - case ('M'): + case 'M': unit = SCALE_MM; break; - case ('n'): + case 'n': unit = SCALE_EN; break; default: @@ -153,8 +154,8 @@ tblcalc(struct rofftbl *tbl, const struct tbl_span *sp) */ assert(NULL == tbl->cols); - tbl->cols = mandoc_calloc - ((size_t)sp->opts->cols, sizeof(struct roffcol)); + tbl->cols = mandoc_calloc((size_t)sp->opts->cols, + sizeof(struct roffcol)); for ( ; sp; sp = sp->next) { if (TBL_SPAN_DATA != sp->pos) @@ -187,26 +188,26 @@ tblcalc_data(struct rofftbl *tbl, struct roffcol *col, /* Branch down into data sub-types. */ switch (dp->layout->pos) { - case (TBL_CELL_HORIZ): + case TBL_CELL_HORIZ: /* FALLTHROUGH */ - case (TBL_CELL_DHORIZ): + case TBL_CELL_DHORIZ: sz = (*tbl->len)(1, tbl->arg); if (col->width < sz) col->width = sz; break; - case (TBL_CELL_LONG): + case TBL_CELL_LONG: /* FALLTHROUGH */ - case (TBL_CELL_CENTRE): + case TBL_CELL_CENTRE: /* FALLTHROUGH */ - case (TBL_CELL_LEFT): + case TBL_CELL_LEFT: /* FALLTHROUGH */ - case (TBL_CELL_RIGHT): + case TBL_CELL_RIGHT: tblcalc_literal(tbl, col, dp); break; - case (TBL_CELL_NUMBER): + case TBL_CELL_NUMBER: tblcalc_number(tbl, col, opts, dp); break; - case (TBL_CELL_DOWN): + case TBL_CELL_DOWN: break; default: abort(); @@ -232,7 +233,7 @@ static void tblcalc_number(struct rofftbl *tbl, struct roffcol *col, const struct tbl_opts *opts, const struct tbl_dat *dp) { - int i; + int i; size_t sz, psz, ssz, d; const char *str; char *cp;