Print output in testparse.c byte-by-byte instead of as an ASCIZ string. trunk
authorRyan C. Gordon <icculus@icculus.org>
Sun, 06 Apr 2008 09:35:19 -0400
branchtrunk
changeset 113 8ebf445c5305
parent 112 5ddfb2f7ca4a
child 114 3b8cf84b46b8
Print output in testparse.c byte-by-byte instead of as an ASCIZ string. ...because it's not a string in the passthrough profile, and a null byte will kill output prematurely.
mojoshader.h
testparse.c
--- a/mojoshader.h	Sun Apr 06 09:26:27 2008 -0400
+++ b/mojoshader.h	Sun Apr 06 09:35:19 2008 -0400
@@ -131,8 +131,9 @@
 
     /*
      * Byte count for output, not counting any null terminator. Most profiles
-     *  produce an ASCII string of source code, but profiles that do binary
-     *  output may not be text at all. Will be 0 on error.
+     *  produce an ASCII string of source code (which will be null-terminated
+     *  even though that null char isn't included in output_len), but profiles
+     *  that do binary output may not be text at all. Will be 0 on error.
      */
     int output_len;
 
--- a/testparse.c	Sun Apr 06 09:26:27 2008 -0400
+++ b/testparse.c	Sun Apr 06 09:35:19 2008 -0400
@@ -94,7 +94,13 @@
         } // else
 
         if (pd->output != NULL)
-            printf("OUTPUT:\n%s\n", pd->output);
+        {
+            int i;
+            printf("OUTPUT:\n");
+            for (i = 0; i < pd->output_len; i++)
+                putchar((int) pd->output[i]);
+            printf("\n");
+        } // if
     } // else
     printf("\n\n");
     MOJOSHADER_freeParseData(pd);