sha1write: make buffer const-correct

We are passed a "void *" and write it out without ever touching it; let's indicate that by using "const". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 24, 2013 at 13:59 UTC e74435a5169b56be901196ad172b4dbda124254d
2 files changed +4 -4
csum-file.c
+3 -3
@@ -11,7 +11,7 @@
11 #include "progress.h"
12 #include "csum-file.h"
13
14 -static void flush(struct sha1file *f, void *buf, unsigned int count)
14 +static void flush(struct sha1file *f, const void *buf, unsigned int count)
15 {
16 if (0 <= f->check_fd && count) {
17 unsigned char check_buffer[8192];
@@ -86,13 +86,13 @@ int sha1close(struct sha1file *f, unsigned char *result, unsigned int flags)
86 return fd;
87 }
88
89 -int sha1write(struct sha1file *f, void *buf, unsigned int count)
89 +int sha1write(struct sha1file *f, const void *buf, unsigned int count)
90 {
91 while (count) {
92 unsigned offset = f->offset;
93 unsigned left = sizeof(f->buffer) - offset;
94 unsigned nr = count > left ? left : count;
95 - void *data;
95 + const void *data;
96
97 if (f->do_crc)
98 f->crc32 = crc32(f->crc32, buf, nr);
csum-file.h
+1 -1
@@ -34,7 +34,7 @@ extern struct sha1file *sha1fd(int fd, const char *name);
34 extern struct sha1file *sha1fd_check(const char *name);
35 extern struct sha1file *sha1fd_throughput(int fd, const char *name, struct progress *tp);
36 extern int sha1close(struct sha1file *, unsigned char *, unsigned int);
37 -extern int sha1write(struct sha1file *, void *, unsigned int);
37 +extern int sha1write(struct sha1file *, const void *, unsigned int);
38 extern void sha1flush(struct sha1file *f);
39 extern void crc32_begin(struct sha1file *);
40 extern uint32_t crc32_end(struct sha1file *);