This website requires JavaScript.
Explore
Help
Sign In
mirrors
/
qemu
Watch
1
Star
0
Fork
0
You've already forked qemu
Code
Issues
Pull Requests
Packages
Projects
Releases
Wiki
Activity
9af4b6b9e8
qemu
/
tests
/
qapi-schema
/
unknown-escape.json
4 lines
93 B
JSON
Raw
Normal View
History
Unescape
Escape
qapi: Drop support for escape sequences other than \\ Since the previous commit restricted strings to printable ASCII, \uXXXX's only use is obfuscation. Drop it. This leaves \\, \/, \', and \". Since QAPI schema strings are all names, and names are restricted to ASCII letters, digits, hyphen, and underscore, none of them is useful. The latter three have no test coverage. Drop them. Keep \\ to avoid (more) gratuitous incompatibility with JSON. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20190913201349.24332-8-armbru@redhat.com>
2019-09-13 23:13:40 +03:00
#
w
e
o
n
l
y
r
e
c
o
g
n
i
z
e
\
\
qapi: Support (subset of) \u escapes in strings The handling of \ inside QAPI strings was less than ideal, and really only worked JSON's \/, \\, \", and our extension of \' (an obvious extension, when you realize we use '' instead of "" for strings). For other things, like '\n', it resulted in a literal 'n' instead of a newline. Of course, at the moment, we really have no use for escaped characters, as QAPI has to map to C identifiers, and we currently support ASCII only for that. But down the road, we may add support for default values for string parameters to a command or struct; if that happens, it would be nice to correctly support all JSON escape sequences, such as \n or \uXXXX. This gets us closer, by supporting Unicode escapes in the ASCII range. Since JSON does not require \OCTAL or \xXX escapes, and our QMP implementation does not understand them either, I intentionally reject it here, but it would be an easy addition if we desired it. Likewise, intentionally refusing the NUL byte means we don't have to worry about C strings being shorter than the qapi input. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-05-04 18:05:36 +03:00
#
{
'
c
o
m
m
a
n
d
'
:
'
f
o
o
'
,
'
d
a
t
a
'
:
{
}
}
{
'
c
o
m
m
a
n
d
'
:
'
f
o
o
'
,
'
d
a
t
\
x
6
1
'
:
{
}
}
Reference in New Issue
Copy Permalink