Rémi Bernon (@rbernon) commented about dlls/windows.web/json_value.c:
- HRESULT hr = S_OK;
- /* FIXME: Handle all JSON edge cases */
- if (json_len == 4 && !wcsncmp( L"null", json, 4 ))
- {
impl->json_value_type = JsonValueType_Null;
- }
- else if ((json_len == 4 && !wcsncmp( L"true", json, 4 )) || (json_len == 5 && !wcsncmp( L"false", json, 5 )))
- {
impl->parsed_boolean = json_len == 4;
impl->json_value_type = JsonValueType_Boolean;
- }
- else if (json[0] == '"' && json[json_len - 1] == '"')
- {
if (FAILED(hr = trim_string( input, L"\\\"", &impl->parsed_string ))) return hr;
Do we really want to trim `"`? The string quotes aren't escaped as you just checked that the first char is '"', so I think this should be `L"""` instead?
**But**, do we really want to trim the string? What if it ends with `""`? We should keep a quote in the string in this case. As you checked for first and last char I think you can simply shrink the string by 1 char on each side instead of trimming.