From 43664aa169b6efeb80245772f7ad9ff1c6e5edb0 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sat, 17 Nov 2007 19:16:53 +0100 Subject: [PATCH] Revert ntohl()/printf format to Junio's git This commits reverts printf format strings to the original version from Juion's git. This is a preparation for the mingw specific fix that follows in the next commit. Signed-off-by: Steffen Prohaska --- builtin-fetch-pack.c | 2 +- builtin-ls-files.c | 2 +- builtin-unpack-objects.c | 2 +- index-pack.c | 2 +- merge-index.c | 2 +- read-cache.c | 2 +- receive-pack.c | 2 +- sha1_file.c | 4 ++-- show-index.c | 2 +- unpack-trees.c | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c index 3510bfd089..a2ca746dd0 100644 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@ -509,7 +509,7 @@ static int get_pack(int xd[2], char **pack_lockfile) if (read_pack_header(fd[0], &header)) die("protocol error: bad pack header"); - snprintf(hdr_arg, sizeof(hdr_arg), "--pack_header=%lu,%lu", + snprintf(hdr_arg, sizeof(hdr_arg), "--pack_header=%u,%u", ntohl(header.hdr_version), ntohl(header.hdr_entries)); if (ntohl(header.hdr_entries) < unpack_limit) do_keep = 0; diff --git a/builtin-ls-files.c b/builtin-ls-files.c index dde79545e2..e0b856f432 100644 --- a/builtin-ls-files.c +++ b/builtin-ls-files.c @@ -208,7 +208,7 @@ static void show_ce_entry(const char *tag, struct cache_entry *ce) if (!show_stage) { fputs(tag, stdout); } else { - printf("%s%06lo %s %d\t", + printf("%s%06o %s %d\t", tag, ntohl(ce->ce_mode), abbrev ? find_unique_abbrev(ce->sha1,abbrev) diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c index 948e4bec51..1e51865c52 100644 --- a/builtin-unpack-objects.c +++ b/builtin-unpack-objects.c @@ -318,7 +318,7 @@ static void unpack_all(void) if (ntohl(hdr->hdr_signature) != PACK_SIGNATURE) die("bad pack file"); if (!pack_version_ok(hdr->hdr_version)) - die("unknown pack file version %lu", ntohl(hdr->hdr_version)); + die("unknown pack file version %d", ntohl(hdr->hdr_version)); use(sizeof(struct pack_header)); if (!quiet) diff --git a/index-pack.c b/index-pack.c index 6268da94b8..9fd6982a97 100644 --- a/index-pack.c +++ b/index-pack.c @@ -143,7 +143,7 @@ static void parse_pack_header(void) if (hdr->hdr_signature != htonl(PACK_SIGNATURE)) die("pack signature mismatch"); if (!pack_version_ok(hdr->hdr_version)) - die("pack version %lu unsupported", ntohl(hdr->hdr_version)); + die("pack version %d unsupported", ntohl(hdr->hdr_version)); nr_objects = ntohl(hdr->hdr_entries); use(sizeof(struct pack_header)); diff --git a/merge-index.c b/merge-index.c index 1cf4cb5b3f..fa719cb0b1 100644 --- a/merge-index.c +++ b/merge-index.c @@ -48,7 +48,7 @@ static int merge_entry(int pos, const char *path) break; found++; strcpy(hexbuf[stage], sha1_to_hex(ce->sha1)); - sprintf(ownbuf[stage], "%lo", ntohl(ce->ce_mode)); + sprintf(ownbuf[stage], "%o", ntohl(ce->ce_mode)); arguments[stage] = hexbuf[stage]; arguments[stage + 4] = ownbuf[stage]; } while (++pos < active_nr); diff --git a/read-cache.c b/read-cache.c index 128835b684..7748c3ece7 100644 --- a/read-cache.c +++ b/read-cache.c @@ -152,7 +152,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) case 0: /* Special case: unmerged file in index */ return MODE_CHANGED | DATA_CHANGED | TYPE_CHANGED; default: - die("internal error: ce_mode is %lo", ntohl(ce->ce_mode)); + die("internal error: ce_mode is %o", ntohl(ce->ce_mode)); } if (ce->ce_mtime.sec != htonl(st->st_mtime)) changed |= MTIME_CHANGED; diff --git a/receive-pack.c b/receive-pack.c index a66a6e45d2..38e35c06b9 100644 --- a/receive-pack.c +++ b/receive-pack.c @@ -352,7 +352,7 @@ static const char *unpack(void) hdr_err = parse_pack_header(&hdr); if (hdr_err) return hdr_err; - snprintf(hdr_arg, sizeof(hdr_arg), "--pack_header=%lu,%lu", + snprintf(hdr_arg, sizeof(hdr_arg), "--pack_header=%u,%u", ntohl(hdr.hdr_version), ntohl(hdr.hdr_entries)); if (ntohl(hdr.hdr_entries) < unpack_limit) { diff --git a/sha1_file.c b/sha1_file.c index 6b0e4c1d02..bd0e7cd21c 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -670,13 +670,13 @@ static int open_packed_git_1(struct packed_git *p) if (hdr.hdr_signature != htonl(PACK_SIGNATURE)) return error("file %s is not a GIT packfile", p->pack_name); if (!pack_version_ok(hdr.hdr_version)) - return error("packfile %s is version %lu and not supported" + return error("packfile %s is version %u and not supported" " (try upgrading GIT to a newer version)", p->pack_name, ntohl(hdr.hdr_version)); /* Verify the pack matches its index. */ if (p->num_objects != ntohl(hdr.hdr_entries)) - return error("packfile %s claims to have %lu objects" + return error("packfile %s claims to have %u objects" " while index indicates %u objects", p->pack_name, ntohl(hdr.hdr_entries), p->num_objects); diff --git a/show-index.c b/show-index.c index 9749e2da48..7253991fff 100644 --- a/show-index.c +++ b/show-index.c @@ -68,7 +68,7 @@ int main(int argc, char **argv) ntohl(off64[1]); off64_nr++; } - printf("%" PRIuMAX " %s (%08lx)\n", (uintmax_t) offset, + printf("%" PRIuMAX " %s (%08x)\n", (uintmax_t) offset, sha1_to_hex(entries[i].sha1), ntohl(entries[i].crc)); } diff --git a/unpack-trees.c b/unpack-trees.c index 18f586cefc..aea16adde8 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -638,7 +638,7 @@ static void show_stage_entry(FILE *o, if (!ce) fprintf(o, "%s (missing)\n", label); else - fprintf(o, "%s%06lo %s %d\t%s\n", + fprintf(o, "%s%06o %s %d\t%s\n", label, ntohl(ce->ce_mode), sha1_to_hex(ce->sha1),