Merge branch '2.1'
authorPetri Lehtinen <petri@digip.org>
Thu, 30 Jun 2011 18:48:51 +0000 (21:48 +0300)
committerPetri Lehtinen <petri@digip.org>
Thu, 30 Jun 2011 18:48:51 +0000 (21:48 +0300)
1  2 
doc/apiref.rst

diff --combined doc/apiref.rst
@@@ -765,26 -765,6 +765,26 @@@ is in UTF-8
     *path* already exists, it is overwritten. *flags* is described
     above. Returns 0 on success and -1 on error.
  
 +.. type:: json_dump_callback_t
 +
 +   A typedef for a function that's called by
 +   :func:`json_dump_callback()`::
 +
 +       typedef int (*json_dump_callback_t)(const char *buffer, size_t size, void *data);
 +
 +   *buffer* points to a buffer containing a chunk of output, *size* is
 +   the length of the buffer, and *data* is the corresponding
 +   :func:`json_dump_callback()` argument passed through.
 +
 +   On error, the function should return -1 to stop the encoding
 +   process. On success, it should return 0.
 +
 +.. function:: int json_dump_callback(const json_t *json, json_dump_callback_t callback, void *data, size_t flags)
 +
 +   Call *callback* repeatedly, passing a chunk of the JSON
 +   representation of *root* each time. *flags* is described above.
 +   Returns 0 on success and -1 on error.
 +
  
  .. _apiref-decoding:
  
@@@ -870,14 -850,14 +870,14 @@@ The following functions perform the act
  Building Values
  ===============
  
- This sectinon describes functions that help to create, or *pack*,
+ This section describes functions that help to create, or *pack*,
  complex JSON values, especially nested objects and arrays. Value
  building is based on a *format string* that is used to tell the
  functions about the expected arguments.
  
  For example, the format string ``"i"`` specifies a single integer
  value, while the format string ``"[ssb]"`` or the equivalent ``"[s, s,
- b]"`` specifies an array value with two integers and a boolean as its
+ b]"`` specifies an array value with two strings and a boolean as its
  items::
  
      /* Create the JSON integer 42 */
@@@ -912,7 -892,7 +912,7 @@@ denotes the C type that is expected as 
  ``o`` (any value) [json_t \*]
      Output any given JSON value as-is. If the value is added to an
      array or object, the reference to the value passed to ``o`` is
-     stealed by the container.
+     stolen by the container.
  
  ``O`` (any value) [json_t \*]
      Like ``o``, but the argument's reference count is incremented.
@@@ -962,10 -942,10 +962,10 @@@ More examples:
    json_pack("{}");
  
    /* Build the JSON object {"foo": 42, "bar": 7} */
-   json_pack("{sisb}", "foo", 42, "bar", 7);
+   json_pack("{sisi}", "foo", 42, "bar", 7);
  
    /* Like above, ':', ',' and whitespace are ignored */
-   json_pack("{s:i, s:b}", "foo", 42, "bar", 7);
+   json_pack("{s:i, s:i}", "foo", 42, "bar", 7);
  
    /* Build the JSON array [[1, 2], {"cool": true}] */
    json_pack("[[i,i],{s:b]]", 1, 2, "cool", 1);