Rémi Bernon (@rbernon) commented about dlls/windows.web/json_value.c:
- WindowsDeleteString( pattern );
- WindowsDeleteString( new_string );
- return hr;
+}
+static HRESULT parse_json( HSTRING json, struct json_value *impl ) +{
- HSTRING trimmed_json = NULL;
- HRESULT hr = trim_string( json, L" ", &trimmed_json );
- if (SUCCEEDED(hr) && WindowsIsStringEmpty( trimmed_json )) hr = WEB_E_INVALID_JSON_STRING;
- if (SUCCEEDED(hr)) hr = validate_json( trimmed_json, &impl->json_value_type, &impl->parsed_number, &impl->parsed_boolean );
- if (SUCCEEDED(hr)) hr = trim_string( trimmed_json, L"\"", &trimmed_json );
- if (SUCCEEDED(hr)) hr = WindowsDuplicateString( trimmed_json, &impl->parsed_string );
Although it probably works in all cases, trimming the quotes seem specific to string values and IMO should be done in the string-specific case above.