From: solar <> Date: Fri, 7 Apr 2006 05:13:15 +0000 (+0000) Subject: All tests except hex / zero work. X-Git-Url: https://pd.if.org/git/?a=commitdiff_plain;h=c401a4dd7dc2a005af4bf3c503f90bdd02818d7b;p=pdclib.old All tests except hex / zero work. --- diff --git a/draft.c b/draft.c index fdda32d..740def7 100644 --- a/draft.c +++ b/draft.c @@ -50,7 +50,7 @@ struct status_t s - the buffer into which the character shall be delivered TODO: Overruns. */ -#define DELIVER( x ) if ( status->i < status->n ) status->s[status->i] = x; ++(status->i) +#define DELIVER( x ) do { if ( status->i < status->n ) status->s[status->i] = x; ++(status->i); } while ( 0 ) /* TODO: Left / right alignment - requires track-keeping of width and printed chars. "Father function", die für right alignment "tail recursive" gerufen wird, und @@ -139,9 +139,9 @@ static void padwrap( int value, struct status_t * status ) ++(status->this); } } - if ( status->i == status->n ) + if ( status->i >= status->n ) { - status->s[status->i] = '\0'; + status->s[status->n - 1] = '\0'; } }