From c8a1b499bdd922dd554a744777d20e1fb795a5bb Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 6 Apr 2008 09:35:19 -0400 Subject: [PATCH] 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. --HG-- branch : trunk --- mojoshader.h | 5 +++-- testparse.c | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/mojoshader.h b/mojoshader.h index 8165dce3..168bcc69 100644 --- a/mojoshader.h +++ b/mojoshader.h @@ -131,8 +131,9 @@ typedef struct /* * 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; diff --git a/testparse.c b/testparse.c index d3a0864b..7e190598 100644 --- a/testparse.c +++ b/testparse.c @@ -94,7 +94,13 @@ static void do_parse(const unsigned char *buf, const int len, const char *prof) } // 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);