X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/a091c28b416f83aa46dcb0bd0da81ca1d3b8a7f9..94187a80bd60baab4b9c4b949ad820d730578123:/sbr/fmt_scan.c diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index 8e59669d..791146a2 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -31,7 +31,7 @@ struct mailname fmt_mnull = { NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, /* * static prototypes */ -static int match (char *, char *); +static int match (char *, char *) PURE; static char *get_x400_friendly (char *, char *, int); static int get_x400_comp (char *, char *, char *, int); @@ -67,8 +67,13 @@ match (char *str, char *sub) * copy a number to the destination subject to a maximum width */ void -cpnumber(charstring_t dest, int num, unsigned int wid, char fill, size_t max) { - if (wid < (num >= 0 ? max : max-1)) { +cpnumber(charstring_t dest, int num, int wid, char fill, size_t max) { + /* Maybe we should handle left padding at some point? */ + if (wid == 0) + return; + if (wid < 0) + wid = -wid; /* OK because wid originally a short. */ + if ((size_t)wid < (num >= 0 ? max : max-1)) { /* Build up the string representation of num in reverse. */ charstring_t rev = charstring_create (0); int i = num >= 0 ? num : -num; @@ -836,7 +841,7 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat, case FT_LV_RCLOCK: if ((value = fmt->f_comp->c_tws->tw_clock) == 0) value = dmktime(fmt->f_comp->c_tws); - value = time((time_t *) 0) - value; + value = time(NULL) - value; break; case FT_LV_DAYF: if (!(((tws = fmt->f_comp->c_tws)->tw_flags) & (TW_SEXP|TW_SIMP))) @@ -984,7 +989,7 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat, *comp->c_tws = *tws; comp->c_flags &= ~CF_TRUE; } else if ((comp->c_flags & CF_DATEFAB) == 0) { - memset (comp->c_tws, 0, sizeof *comp->c_tws); + ZERO(comp->c_tws); comp->c_flags = CF_TRUE; } comp->c_flags |= CF_PARSED; @@ -1201,5 +1206,5 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat, } } - return (NULL); + return NULL; }