Skip to content

Commit

Permalink
Print output in testparse.c byte-by-byte instead of as an ASCIZ string.
Browse files Browse the repository at this point in the history
...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 c8a1b49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions mojoshader.h
Expand Up @@ -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;

Expand Down
8 changes: 7 additions & 1 deletion testparse.c
Expand Up @@ -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);
Expand Down

0 comments on commit c8a1b49

Please sign in to comment.