]> pd.if.org Git - pdclib/commitdiff
All tests except hex / zero work.
authorsolar <unknown>
Fri, 7 Apr 2006 05:13:15 +0000 (05:13 +0000)
committersolar <unknown>
Fri, 7 Apr 2006 05:13:15 +0000 (05:13 +0000)
draft.c

diff --git a/draft.c b/draft.c
index fdda32d1fe8703840350c3b9ec593b53796cc529..740def7d2b2609086ea04200358c1e3c3e930fb7 100644 (file)
--- 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';
     }
 }