Truthy across the representations properties_json may use (JSON bool, the * integer 1 sqlite/json_extract emits, or a "true"/"1" string). */
| 58 | /* Truthy across the representations properties_json may use (JSON bool, the |
| 59 | * integer 1 sqlite/json_extract emits, or a "true"/"1" string). */ |
| 60 | static bool json_truthy(yyjson_val *v) { |
| 61 | if (!v) |
| 62 | return false; |
| 63 | if (yyjson_is_bool(v)) |
| 64 | return yyjson_get_bool(v); |
| 65 | if (yyjson_is_int(v)) |
| 66 | return yyjson_get_int(v) != 0; |
| 67 | if (yyjson_is_uint(v)) |
| 68 | return yyjson_get_uint(v) != 0; |
| 69 | if (yyjson_is_real(v)) |
| 70 | return yyjson_get_real(v) != 0.0; |
| 71 | if (yyjson_is_str(v)) { |
| 72 | const char *s = yyjson_get_str(v); |
| 73 | return s && s[0] && strcmp(s, "0") != 0 && strcmp(s, "false") != 0; |
| 74 | } |
| 75 | return false; |
| 76 | } |
| 77 | |
| 78 | static node_flags_t parse_node_flags(const char *props_json) { |
| 79 | node_flags_t f = {false, false, false, false}; |