Brad ArantandClaude Sonnet 5 3e6e410fe8 Fix JFile empty-document seed and MString's ZString-source pointer/length mismatch
JFile.cpp: JFile and MFile both "virtual public MString" a single shared
base, so a virtual base is initialized only by the *most derived* class's
constructor. JFile's own constructor never mentions MString, so
JString's own "{}" default initializer never ran - a JFile backed by a
new or nonexistent file started as a raw empty string instead of a valid
empty JSON object. Every subsequent locate()/set() call then silently
misbehaved (no leading "{" for ifNext("{") to match, so writes landed at
offset 0 with no braces or separators - fields ended up prepended in
reverse order, concatenated with no delimiters at all). Fixed by seeding
"{}" via append (matching MFile's own load pattern) whenever the loaded
content is empty.

MString.cpp: several ZString-source copy paths (the ZString/MString copy
constructors, both assignment operators, operator<<(ZString), insert(),
write()) called zstring.getData() (the object's absolute start) paired
with zstring.getLength() (which is documented/implemented as "remaining
bytes from cursor to end", i.e. length - (cursor - data)). Pairing an
absolute start with a cursor-relative length silently corrupts any
cursor-advanced source: the copy starts from the wrong (too-early)
position but is truncated by exactly the amount the cursor had already
advanced, keeping unwanted leading bytes while dropping trailing ones.
Found via the CGIFormData-style resumability testing pattern used
elsewhere this session, triggered by JetCore's new "@name" session
variable feature stripping a sigil prefix via ifNext() before streaming
the remainder into an MString. Fixed by pairing zstring.getCursor()
(cursor-relative start) with zstring.getLength() consistently everywhere
this pattern appeared.

Verified via the existing jstring_test/mstring_test/zstring_test/
parser_test suites (all pass, no output changes) plus a new isolated
JFile round-trip test proving persistence across two separate process
instances sharing one file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-23 18:44:59 -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%