1. 09 2月, 2018 2 次提交
  2. 20 6月, 2017 1 次提交
  3. 07 3月, 2017 3 次提交
  4. 06 7月, 2016 1 次提交
  5. 23 3月, 2016 1 次提交
  6. 09 2月, 2016 1 次提交
    • E
      qobject: Document more shortcomings in our number handling · 6e8e5cb9
      Eric Blake 提交于
      We've already documented that our JSON parsing is locale dependent;
      but we should also document that our JSON output has the same
      problem.  Additionally, JSON requires finite values (you have to
      upgrade to JSON5 to get support for Inf or NaN), and our output
      truncates floating point numbers to the point of losing significant
      precision that could cause the receiver to read a different value.
      
      Sadly, this series is not going to be the one that addresses these
      problems.
      
      Fix some trailing whitespace I noticed in the vicinity.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1454075341-13658-2-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      6e8e5cb9
  7. 05 2月, 2016 1 次提交
  8. 26 11月, 2015 1 次提交
  9. 23 6月, 2015 1 次提交
  10. 22 6月, 2015 1 次提交
  11. 11 5月, 2015 2 次提交
  12. 10 12月, 2014 1 次提交
  13. 27 7月, 2013 1 次提交
    • K
      qapi: Anonymous unions · 69dd62df
      Kevin Wolf 提交于
      The discriminator for anonymous unions is the data type. This allows to
      have a union type that allows both of these:
      
          { 'file': 'my_existing_block_device_id' }
          { 'file': { 'filename': '/tmp/mydisk.qcow2', 'read-only': true } }
      
      Unions like this are specified in the schema with an empty dict as
      discriminator. For this example you could take:
      
          { 'union': 'BlockRef',
            'discriminator': {},
            'data': { 'definition': 'BlockOptions',
                      'reference': 'str' } }
          { 'type': 'ExampleObject',
            'data: { 'file': 'BlockRef' } }
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      69dd62df
  14. 14 4月, 2013 1 次提交
    • M
      qjson: to_json() case QTYPE_QSTRING is buggy, rewrite · e2ec3f97
      Markus Armbruster 提交于
      Known bugs in to_json():
      
      * A start byte for a three-byte sequence followed by less than two
        continuation bytes is split into one-byte sequences.
      
      * Start bytes for sequences longer than three bytes get misinterpreted
        as start bytes for three-byte sequences.  Continuation bytes beyond
        byte three become one-byte sequences.
      
        This means all characters outside the BMP are decoded incorrectly.
      
      * One-byte sequences with the MSB are put into the JSON string
        verbatim when char is unsigned, producing invalid UTF-8.  When char
        is signed, they're replaced by "\\uFFFF" instead.
      
        This includes \xFE, \xFF, and stray continuation bytes.
      
      * Overlong sequences are happily accepted, unless screwed up by the
        bugs above.
      
      * Likewise, sequences encoding surrogate code points or noncharacters.
      
      * Unlike other control characters, ASCII DEL is not escaped.  Except
        in overlong encodings.
      
      My rewrite fixes them as follows:
      
      * Malformed UTF-8 sequences are replaced.
      
        Except the overlong encoding \xC0\x80 of U+0000 is still accepted.
        Permits embedding NUL characters in C strings.  This trick is known
        as "Modified UTF-8".
      
      * Sequences encoding code points beyond Unicode range are replaced.
      
      * Sequences encoding code points beyond the BMP produce a surrogate
        pair.
      
      * Sequences encoding surrogate code points are replaced.
      
      * Sequences encoding noncharacters are replaced.
      
      * ASCII DEL is now always escaped.
      
      The replacement character is U+FFFD.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
      e2ec3f97
  15. 13 1月, 2013 1 次提交
  16. 19 12月, 2012 1 次提交
  17. 01 10月, 2010 1 次提交
    • D
      Add support for JSON pretty printing · 212b6008
      Daniel P. Berrange 提交于
      The monitor does not pretty-print JSON output, so that everything
      will be on a single line reply. When JSON docs get large this is
      quite unpleasant to read. For the future command line capabilities
      query ability, huge JSON docs will be available. This needs the
      ability to pretty-print.
      
      This introduces a new API qobject_to_json_pretty() that does
      a minimal indentation of list and dict members. As an example,
      this makes
      
        {"QMP": {"version": {"micro": 50, "minor": 12, "package": "", "major": 0}, "capabilities": []}}
      
      Output as
      
        {
            "QMP": {
                "version": {
                    "micro": 50,
                    "minor": 12,
                    "package": "",
                    "major": 0
                },
                "capabilities": [
                ]
            }
        }
      
      NB: this is not turned on for the QMP monitor.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      212b6008
  18. 12 6月, 2010 1 次提交
  19. 11 2月, 2010 1 次提交
  20. 27 1月, 2010 1 次提交
    • A
      json: escape u0000 .. u001F when outputting json · ff06ea21
      Anthony Liguori 提交于
      Markus Armbruster pointed out:
      
      JSON requires control characters in strings to be escaped.  RFC 4627
      section 2.5:
      
         A string begins and ends with quotation marks.  All Unicode
         characters may be placed within the quotation marks except for the
         characters that must be escaped: quotation mark, reverse solidus, and
         the control characters (U+0000 through U+001F).
      
      We've been quoting the special escape sequences that JSON defines but we
      haven't been encoding the full control character range.  This patch fixes that.
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      ff06ea21
  21. 03 12月, 2009 2 次提交
  22. 17 11月, 2009 2 次提交