• Mike Hommey's avatar
    Make fread/fwrite-like functions in http.c more like fread/fwrite. · 5c3d5a38
    Mike Hommey authored
    The fread/fwrite-like functions in http.c, namely fread_buffer,
    fwrite_buffer, fwrite_null, fwrite_sha1_file all return the
    multiplication of the size and number of items they are being given.
    Practically speaking, it doesn't matter, because in all contexts where
    those functions are used, size is 1.
    But those functions being similar to fread and fwrite (the curl API is
    designed around being able to use fread and fwrite directly), it might
    be preferable to make them behave like fread and fwrite, which, from
    the fread/fwrite manual page, is:
       On  success, fread() and fwrite() return the number of items read
       or written.  This number equals the number of bytes transferred
       only when size is 1.  If an error occurs, or the end of the file
       is reached, the return value is a short item count (or zero).
    Signed-off-by: 's avatarMike Hommey <mh@glandium.org>
    Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
http.c 65.3 KB