mirror of
https://github.com/gbdev/rgbds.git
synced 2026-09-03 04:18:40 +00:00
Fix STRFMT stopping at NUL characters in format spec strings
This commit is contained in:
+1
-1
@@ -555,7 +555,7 @@ std::string act_StringFormat(
|
|||||||
std::string str;
|
std::string str;
|
||||||
size_t argIndex = 0;
|
size_t argIndex = 0;
|
||||||
|
|
||||||
for (size_t i = 0; spec[i] != '\0';) {
|
for (size_t i = 0; i < spec.length();) {
|
||||||
if (int c = spec[i]; c != '%') {
|
if (int c = spec[i]; c != '%') {
|
||||||
str += c;
|
str += c;
|
||||||
++i;
|
++i;
|
||||||
|
|||||||
@@ -26,3 +26,7 @@ PRINTLN STRFMT("%d eol %", 1)
|
|||||||
PRINTLN STRFMT("invalid %w spec", 42)
|
PRINTLN STRFMT("invalid %w spec", 42)
|
||||||
|
|
||||||
PRINTLN STRFMT("one=%d two=%d three=%d", 1)
|
PRINTLN STRFMT("one=%d two=%d three=%d", 1)
|
||||||
|
|
||||||
|
DEF NUL EQUS STRFMT("%s \0 %s", "goodbye", "world")
|
||||||
|
ASSERT #NUL === "goodbye \0 world"
|
||||||
|
PRINTLN #NUL
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user