diff options
author | Christopher Head <chead@chead.ca> | 2018-07-24 22:47:23 -0700 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-07-26 16:24:43 +0200 |
commit | 9526cbe6bca1f9389fa84e5b0e5e2dc173e82f0d (patch) | |
tree | 1fb3c022c3d2483d38497d890175557a7bf1f7f1 /tests/data/test2058 | |
parent | 10d8f3f1344b958a9bea3b3d9f607bc624bce410 (diff) |
docs/CURLOPT_WRITEFUNCTION: size is always 1
For compatibility with `fwrite`, the `CURLOPT_WRITEFUNCTION` callback is
passed two `size_t` parameters which, when multiplied, designate the
number of bytes of data passed in. In practice, CURL always sets the
first parameter (`size`) to 1.
This practice is also enshrined in documentation and cannot be changed
in future. The documentation states that the default callback is
`fwrite`, which means `fwrite` must be a suitable function for this
purpose. However, the documentation also states that the callback must
return the number of *bytes* it successfully handled, whereas ISO C
`fwrite` returns the number of items (each of size `size`) which it
wrote. The only way these numbers can be equal is if `size` is 1.
Since `size` is 1 and can never be changed in future anyway, document
that fact explicitly and let users rely on it.
Closes #2787
Diffstat (limited to 'tests/data/test2058')
0 files changed, 0 insertions, 0 deletions