utf8: fix iconv error detection
iconv(3) returns "(size_t) -1" on error. Make sure that we cast the "-1" properly when checking for this. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
aa012e9065
commit
df5213b70d
2
utf8.c
2
utf8.c
|
@ -529,7 +529,7 @@ char *reencode_string_iconv(const char *in, size_t insz, iconv_t conv, int *outs
|
||||||
while (1) {
|
while (1) {
|
||||||
size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);
|
size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);
|
||||||
|
|
||||||
if (cnt == -1) {
|
if (cnt == (size_t) -1) {
|
||||||
size_t sofar;
|
size_t sofar;
|
||||||
if (errno != E2BIG) {
|
if (errno != E2BIG) {
|
||||||
free(out);
|
free(out);
|
||||||
|
|
Loading…
Reference in New Issue