Skip to content
Permalink
Browse files
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
  • Loading branch information
icculus committed Apr 6, 2008
1 parent 7e7d4e4 commit c8a1b499bdd922dd554a744777d20e1fb795a5bb
Showing with 10 additions and 3 deletions.
  1. +3 −2 mojoshader.h
  2. +7 −1 testparse.c
@@ -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;

@@ -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);

0 comments on commit c8a1b49

Please sign in to comment.