Fix STRFMT stopping at NUL characters in format spec strings

This commit is contained in:
Rangi
2026-08-22 19:23:49 -04:00
parent 9fa5058add
commit 21a4b85a4f
3 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -555,7 +555,7 @@ std::string act_StringFormat(
std::string str;
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 != '%') {
str += c;
++i;
+4
View File
@@ -26,3 +26,7 @@ PRINTLN STRFMT("%d eol %", 1)
PRINTLN STRFMT("invalid %w spec", 42)
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.