mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 23:52:22 +00:00
[gamecode] Move % handling to the flags state
% is effectively a format flag that cancels the format and outputs a % single %. Fixes % not getting output for %%.
This commit is contained in:
parent
a88f821342
commit
1c5454cf6b
1 changed files with 12 additions and 9 deletions
|
@ -868,6 +868,7 @@ fmt_append_item (fmt_state_t *state)
|
|||
* \dot
|
||||
* digraph PR_Sprintf_fmt_state_machine {
|
||||
* format -> flags [label="{%}"];
|
||||
* flogs -> format [label="{%}"];
|
||||
* flags -> flags [label="{#+0 -}"];
|
||||
* flags -> var_field_width [label="{*}"];
|
||||
* flags -> precision [label="{.}"];
|
||||
|
@ -906,6 +907,17 @@ fmt_state_flags (fmt_state_t *state)
|
|||
state->c++; // skip over %
|
||||
while (1) {
|
||||
switch (*state->c) {
|
||||
case '%':
|
||||
state->c++;
|
||||
(*state->fi)->flags = 0;
|
||||
(*state->fi)->precision = 1;
|
||||
(*state->fi)->minFieldWidth = 0;
|
||||
(*state->fi)->type = 's';
|
||||
(*state->fi)->data.string_var = "%";
|
||||
|
||||
fmt_append_item (state);
|
||||
state->state = fmt_state_format;
|
||||
return;
|
||||
case '0':
|
||||
(*state->fi)->flags |= FMT_ZEROPAD;
|
||||
break;
|
||||
|
@ -1111,15 +1123,6 @@ fmt_state_conversion (fmt_state_t *state)
|
|||
(*state->fi)->data.string_var = "'";
|
||||
|
||||
state->fmt_count++;
|
||||
fmt_append_item (state);
|
||||
break;
|
||||
case '%':
|
||||
(*state->fi)->flags = 0;
|
||||
(*state->fi)->precision = 0;
|
||||
(*state->fi)->minFieldWidth = 0;
|
||||
(*state->fi)->type = 's';
|
||||
(*state->fi)->data.string_var = "%";
|
||||
|
||||
fmt_append_item (state);
|
||||
break;
|
||||
case 'x':
|
||||
|
|
Loading…
Reference in a new issue