2 Commits
Author SHA1 Message Date
西风逍遥游 8c4af101da test: add zeroerr fuzzing for shared JSON parser 2026-08-24 20:32:49 +08:00
Cursor Agentand西风逍遥游 51015ff831 refactor: share one JSON reader instead of six copies
rpg, inventory and building each carried a byte-identical JsonHelpers.h (only
the namespace differed), card and voxel inlined a fourth and fifth copy, and
i18n hand-rolled a sixth parser because it needs to build without Poco.

Replace all of them with eve::json in common/Json.h. The backend is i18n's
recursive-descent parser, promoted and extended to track integral literals so
getInt() stays exact; picking that over Poco keeps EVCommon dependency-free and
drops Poco from six gameplay modules outright (15 modules -> 9, 136 include
sites -> 108), which is what lets those modules be trimmed independently later.

Accessors keep the lenient, never-throwing behaviour the per-module helpers
had: a missing key, wrong type or bad index yields the fallback. Two places
that relied on Poco throwing to reject incomplete input (housegen instance and
room records) now check required fields explicitly.

test/json.cpp covers the parser directly -- scalars, lenient conversion,
integer exactness and range, nesting, escapes, surrogate pairs, malformed
input and empty containers.

This is step S2 of docs/dev/模块编排与裁剪架构.md.

Co-authored-by: 西风逍遥游 <sunxfancy@gmail.com>
2026-08-18 13:46:04 +00:00