mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 14:20:59 +00:00
support %c for sprintf and make sprintf return a return string rather than a temp string
This commit is contained in:
parent
d084264c3a
commit
4dba10d613
2 changed files with 7 additions and 2 deletions
|
@ -586,8 +586,8 @@ PF_sprintf (progs_t *pr)
|
|||
str = PR_NewMutableString (pr);
|
||||
dstr = PR_GetMutableString (pr, str);
|
||||
PR_Sprintf (pr, dstr, "PF_sprintf", fmt, count, args);
|
||||
PR_MakeTempString (pr, str);
|
||||
R_STRING (pr) = str;
|
||||
RETURN_STRING (pr, dstr->str);
|
||||
dstring_delete (dstr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -571,6 +571,10 @@ I_DoPrint (dstring_t *result, fmt_item_t *formatting)
|
|||
dstring_appendstr (tmp, "s");
|
||||
PRINT (string);
|
||||
break;
|
||||
case 'c':
|
||||
dstring_appendstr (tmp, "c");
|
||||
PRINT (integer);
|
||||
break;
|
||||
case 'i':
|
||||
dstring_appendstr (tmp, "d");
|
||||
PRINT (integer);
|
||||
|
@ -723,6 +727,7 @@ PR_Sprintf (progs_t *pr, dstring_t *result, const char *name,
|
|||
fi = &(*fi)->next;
|
||||
break;
|
||||
case 'i':
|
||||
case 'c':
|
||||
// integer
|
||||
(*fi)->type = *c;
|
||||
(*fi)->data.integer_var = P_INT (pr, fmt_count);
|
||||
|
|
Loading…
Reference in a new issue