mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
[qfcc] Improve string quoting when dumping strings
Not knowing if a blank line is an empty string or spaces...
This commit is contained in:
parent
1cd7bd2bf0
commit
ac9f3404ef
1 changed files with 9 additions and 3 deletions
|
@ -44,14 +44,14 @@ dump_string_block (const char *strblock, unsigned size)
|
|||
{
|
||||
const char *s = strblock;
|
||||
|
||||
printf ("%x ", 0);
|
||||
printf ("%x \"", 0);
|
||||
while (s - strblock < size) {
|
||||
char c = *s++;
|
||||
switch (c) {
|
||||
case 0:
|
||||
fputs ("\n", stdout);
|
||||
fputs ("\"\n", stdout);
|
||||
if (s - strblock < size)
|
||||
printf ("%lx ", s - strblock);
|
||||
printf ("%lx \"", s - strblock);
|
||||
break;
|
||||
case 9:
|
||||
fputs ("\\t", stdout);
|
||||
|
@ -62,6 +62,12 @@ dump_string_block (const char *strblock, unsigned size)
|
|||
case 13:
|
||||
fputs ("\\r", stdout);
|
||||
break;
|
||||
case '\"':
|
||||
fputs ("\\\"", stdout);
|
||||
break;
|
||||
case '\\':
|
||||
fputs ("\\\\", stdout);
|
||||
break;
|
||||
default:
|
||||
fputc (sys_char_map[(unsigned char)c], stdout);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue