feat: String_ToFloat + Json escape sequence support

- Add bux_str_to_float() C runtime wrapper (strtod)
- Add String_ToFloat() in library/std/String.bux
- Update JsonParser_ParseNumber to use String_ToFloat (decimals now work)
- Update JsonParser_ParseString to decode escape sequences (\n, \t, \r, \", \\, \b, \f)
- Fix use-after-free in JsonParser_ParseString: String_Copy before StringBuilder_Free
This commit is contained in:
2026-06-05 22:35:50 +03:00
parent d0de9c2abf
commit 154579b30d
4 changed files with 36 additions and 6 deletions
+5
View File
@@ -221,6 +221,11 @@ char* bux_strncpy(char* dest, const char* src, unsigned int n) {
return strncpy(dest, src, (size_t)n);
}
double bux_str_to_float(const char* s) {
if (!s) return 0.0;
return strtod(s, NULL);
}
/* String find: returns pointer to first occurrence of needle in haystack, or NULL */
const char* bux_strstr(const char* haystack, const char* needle) {
if (!haystack || !needle) return NULL;