]> pd.if.org Git - pdclib/commitdiff
Fixing bug #37 and #38.
authorsolar <unknown>
Fri, 19 Nov 2010 05:33:50 +0000 (05:33 +0000)
committersolar <unknown>
Fri, 19 Nov 2010 05:33:50 +0000 (05:33 +0000)
functions/_PDCLIB/print.c

index 8d19fe57e856ad3c6c564f81b758de4157febba2..46c00d9eeb60e2ea88e392d12423eeb7bff49fe6 100644 (file)
 */
 #define DELIVER( x ) \
 do { \
+    int character = x; \
     if ( status->i < status->n ) { \
         if ( status->stream != NULL ) \
-            putc( x, status->stream ); \
+            putc( character, status->stream ); \
         else \
-            status->s[status->i] = x; \
+            status->s[status->i] = character; \
     } \
     ++(status->i); \
 } while ( 0 )
@@ -498,7 +499,7 @@ const char * _PDCLIB_print( const char * spec, struct _PDCLIB_status_t * status
                 ++(status->current);
             }
         }
-        if ( status->i >= status->n )
+        if ( status->i >= status->n && status->n > 0 )
         {
             status->s[status->n - 1] = '\0';
         }