diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2011-01-02 21:37:36 -0600 |
---|---|---|
committer | Jonathan Nieder <jrnieder@gmail.com> | 2011-03-27 22:37:05 -0500 |
commit | 896e4bfcec4f6b489aba2197f60a59bc7f45a8ac (patch) | |
tree | 88fce7c9f5d5a5cac4caab609a3bbd62e8add2f7 /vcs-svn/line_buffer.h | |
parent | 9d2f5ddfe56fcc228a36dd079f0897e0f474eb4e (diff) | |
download | git-896e4bfcec4f6b489aba2197f60a59bc7f45a8ac.tar.gz |
vcs-svn: make buffer_read_binary API more convenient
buffer_read_binary is a thin wrapper around fread, but its signature
is wrong:
- fread can fill an arbitrary in-memory buffer. buffer_read_binary
is limited to buffers whose size is representable by a 32-bit
integer.
- The result from fread is the number of bytes actually read.
buffer_read_binary only reports the number of bytes read by
incrementing sb->len by that amount and returns void.
Fix both: let buffer_read_binary accept a size_t instead of uint32_t
for the number of bytes to read and as a convenience return the number
of bytes actually read.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Diffstat (limited to 'vcs-svn/line_buffer.h')
-rw-r--r-- | vcs-svn/line_buffer.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/vcs-svn/line_buffer.h b/vcs-svn/line_buffer.h index d0b22dda76..8901f214ba 100644 --- a/vcs-svn/line_buffer.h +++ b/vcs-svn/line_buffer.h @@ -23,7 +23,7 @@ long buffer_tmpfile_prepare_to_read(struct line_buffer *buf); int buffer_ferror(struct line_buffer *buf); char *buffer_read_line(struct line_buffer *buf); int buffer_read_char(struct line_buffer *buf); -void buffer_read_binary(struct line_buffer *buf, struct strbuf *sb, uint32_t len); +size_t buffer_read_binary(struct line_buffer *buf, struct strbuf *sb, size_t len); /* Returns number of bytes read (not necessarily written). */ off_t buffer_copy_bytes(struct line_buffer *buf, off_t len); off_t buffer_skip_bytes(struct line_buffer *buf, off_t len); |