Brad ArantandClaude Sonnet 5 6e4e463a96 Fix MString assignment operators leaving cursor at its old (stale) offset
operator=(MString)/operator=(ZString)/operator=(std::string)/operator=(const
char*)/operator=(char) all replaced the buffer's content via setSize()+
memcpy() but never reset cursor back to the start - setSize() preserves
the *offset* the cursor was already at (correct for its own use, growing
a buffer while keeping a read position stable), so a full content
replacement left the cursor sitting at whatever offset it had into the
*previous* content, not the new content. operator=(double)/operator=(int)
already did `cursor = data;` after the same setSize()+memcpy() pattern,
confirming this was the intended behavior everywhere - just missing from
the other five overloads.

This is invisible to JetCore's interpreter, which never reassigns an
already-read-from MString (each tag is a freshly parsed C++ object every
time its container is scanned, so a keyword's MString is never both read
and then reassigned on the same instance). It surfaced in a prototype JET
compiler (JetCore/jetc) built this session, which intentionally reuses
one persistent keyword slot across loop iterations instead of
reconstructing everything from text every pass - exactly the case this
bug needed. A <while expr="..."> loop reusing a slot for its condition
worked for two iterations (matching a decoy pattern: the second
assignment happened to land the stale cursor at the exact end of the
new, same-length content) and threw "operand is not valid" on the third,
since a keyword reassigned inside the loop body left the cursor already
at eod() from the read.

Verified via jstring_test/mstring_test/zstring_test/parser_test (no
regressions), JetCore's tests/posttest.sh and the two-process JSON
session persistence test (no regressions), and the jetc prototype's two
demo templates - both now produce byte-identical output to jet-2.0's
interpreter, including a <while> loop that mutates and rereads the same
keyword slot every iteration.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-23 19:18:17 -07:00
2023-10-06 18:32:17 +00:00
2022-01-24 14:03:58 -08:00
2024-07-08 18:31:57 -07:00
2025-02-06 14:34:11 -08:00
2025-02-06 14:34:11 -08:00
2022-05-23 12:51:44 -07:00
2022-05-23 12:51:44 -07:00
2023-03-10 12:55:08 -08:00
2024-12-23 11:15:53 -08:00
2024-12-23 13:00:22 -08:00
2025-03-11 07:34:17 -07:00
2025-03-11 07:34:17 -07:00
2025-03-11 07:34:17 -07:00
2025-03-11 16:59:16 -07:00
2022-01-24 14:03:58 -08:00
2022-01-24 14:03:58 -08:00
2025-03-12 09:30:56 -07:00
2025-03-11 16:59:16 -07:00
2025-03-11 07:34:17 -07:00
2025-12-04 17:04:55 -08:00
2023-10-05 17:57:01 -07:00
2019-09-13 10:29:36 -07:00
2021-07-23 11:44:36 -07:00
2025-12-09 08:46:33 -08:00
2025-12-04 17:04:55 -08:00
2025-12-04 16:40:11 -08:00
S
Description
This repository contains the CoreUtils library. CoreUtils provides support for ServerCore, JetCore and other subsystem libraries used in higher functions.
33 MiB
0 Stars 1 Watchers 0 Forks
Languages
C++ 97.8%
Makefile 1.9%
Shell 0.3%