summaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-04-19 09:08:46 +1000
committerJunio C Hamano <gitster@pobox.com>2013-04-18 16:28:28 -0700
commitb782bbab94e3618aea352907caa77321b487b918 (patch)
tree0aa385e77a981f481943f304cdf7a1be65973baf /utf8.h
parent2bc1e7ecba1fcd73112d5e6703bdc28fb4da530a (diff)
downloadgit-b782bbab94e3618aea352907caa77321b487b918.tar.gz
utf8.c: add reencode_string_len() that can handle NULs in string
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'utf8.h')
-rw-r--r--utf8.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/utf8.h b/utf8.h
index d3da96f234..a43ef9ae74 100644
--- a/utf8.h
+++ b/utf8.h
@@ -17,12 +17,25 @@ void strbuf_add_wrapped_bytes(struct strbuf *buf, const char *data, int len,
int indent, int indent2, int width);
#ifndef NO_ICONV
-char *reencode_string_iconv(const char *in, size_t insz, iconv_t conv);
-char *reencode_string(const char *in, const char *out_encoding, const char *in_encoding);
+char *reencode_string_iconv(const char *in, size_t insz,
+ iconv_t conv, int *outsz);
+char *reencode_string_len(const char *in, int insz,
+ const char *out_encoding,
+ const char *in_encoding,
+ int *outsz);
#else
-#define reencode_string(a,b,c) NULL
+#define reencode_string_len(a,b,c,d,e) NULL
#endif
+static inline char *reencode_string(const char *in,
+ const char *out_encoding,
+ const char *in_encoding)
+{
+ return reencode_string_len(in, strlen(in),
+ out_encoding, in_encoding,
+ NULL);
+}
+
int mbs_chrlen(const char **text, size_t *remainder_p, const char *encoding);
#endif