userdiff.c: remove implicit dependency on the_index
[gitweb.git] / strbuf.c
index db9069c937a6d3c05b5ab0243a6b41bfd1f6518e..64041c3c249b158478ecc6db7257519bc3fc5c19 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
@@ -734,18 +734,18 @@ void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes)
 {
        if (bytes > 1 << 30) {
                strbuf_addf(buf, "%u.%2.2u GiB",
-                           (int)(bytes >> 30),
-                           (int)(bytes & ((1 << 30) - 1)) / 10737419);
+                           (unsigned)(bytes >> 30),
+                           (unsigned)(bytes & ((1 << 30) - 1)) / 10737419);
        } else if (bytes > 1 << 20) {
-               int x = bytes + 5243;  /* for rounding */
+               unsigned x = bytes + 5243;  /* for rounding */
                strbuf_addf(buf, "%u.%2.2u MiB",
                            x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20);
        } else if (bytes > 1 << 10) {
-               int x = bytes + 5;  /* for rounding */
+               unsigned x = bytes + 5;  /* for rounding */
                strbuf_addf(buf, "%u.%2.2u KiB",
                            x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
        } else {
-               strbuf_addf(buf, "%u bytes", (int)bytes);
+               strbuf_addf(buf, "%u bytes", (unsigned)bytes);
        }
 }
 
@@ -921,7 +921,7 @@ void strbuf_add_unique_abbrev(struct strbuf *sb, const struct object_id *oid,
                              int abbrev_len)
 {
        int r;
-       strbuf_grow(sb, GIT_SHA1_HEXSZ + 1);
+       strbuf_grow(sb, GIT_MAX_HEXSZ + 1);
        r = find_unique_abbrev_r(sb->buf + sb->len, oid, abbrev_len);
        strbuf_setlen(sb, sb->len + r);
 }