From: solar Date: Fri, 7 Apr 2006 05:13:15 +0000 (+0000) Subject: All tests except hex / zero work. X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=5b1aa39297ff3ba801d9612c43097c2abafd0966;p=fw%2Fpdclib All tests except hex / zero work. git-svn-id: https://srv7.svn-repos.de/dev34/pdclib/trunk@160 546481bc-9713-0410-bf18-d3337bbf4a3e --- 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'; } }