summaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-07-24 06:50:33 -0400
committerJunio C Hamano <gitster@pobox.com>2018-07-24 10:19:29 -0700
commitc7d017d7e1cca37ca20f73c11fa9f1b319a2c3a5 (patch)
tree41b17395ddd01ae0436d78b906578f7b4861c054 /utf8.h
parent77aa03d6c7f07db4a5d34afe8f5b3a55e801057c (diff)
downloadgit-c7d017d7e1cca37ca20f73c11fa9f1b319a2c3a5.tar.gz
reencode_string: use size_t for string lengths
The iconv interface takes a size_t, which is the appropriate type for an in-memory buffer. But our reencode_string_* functions use integers, meaning we may get confusing results when the sizes exceed INT_MAX. Let's use size_t consistently. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'utf8.h')
-rw-r--r--utf8.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/utf8.h b/utf8.h
index db73a2d8d3..ce1c2696e0 100644
--- a/utf8.h
+++ b/utf8.h
@@ -25,14 +25,14 @@ void strbuf_utf8_replace(struct strbuf *sb, int pos, int width,
#ifndef NO_ICONV
char *reencode_string_iconv(const char *in, size_t insz,
- iconv_t conv, int *outsz);
-char *reencode_string_len(const char *in, int insz,
+ iconv_t conv, size_t *outsz);
+char *reencode_string_len(const char *in, size_t insz,
const char *out_encoding,
const char *in_encoding,
- int *outsz);
+ size_t *outsz);
#else
-static inline char *reencode_string_len(const char *a, int b,
- const char *c, const char *d, int *e)
+static inline char *reencode_string_len(const char *a, size_t b,
+ const char *c, const char *d, size_t *e)
{ if (e) *e = 0; return NULL; }
#endif