Merge branch 'nd/no-more-fnmatch'
[gitweb.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index b1e13035f5055caec66a16ff30371d97886cade2..a831d5089908df61574119b01a29a1991196f63a 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -5,8 +5,8 @@
 /* This code is originally from http://www.cl.cam.ac.uk/~mgk25/ucs/ */
 
 struct interval {
-  int first;
-  int last;
+       ucs_char_t first;
+       ucs_char_t last;
 };
 
 size_t display_mode_esc_sequence_len(const char *s)
@@ -463,8 +463,8 @@ void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
                w += n;
        }
        strbuf_setlen(&sb_dst, dst - sb_dst.buf);
-       strbuf_attach(sb_src, strbuf_detach(&sb_dst, NULL),
-                     sb_dst.len, sb_dst.alloc);
+       strbuf_swap(sb_src, &sb_dst);
+       strbuf_release(&sb_dst);
 }
 
 int is_encoding_utf8(const char *name)
@@ -529,7 +529,7 @@ char *reencode_string_iconv(const char *in, size_t insz, iconv_t conv, int *outs
        while (1) {
                size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);
 
-               if (cnt == -1) {
+               if (cnt == (size_t) -1) {
                        size_t sofar;
                        if (errno != E2BIG) {
                                free(out);