From: "René Scharfe" <l.s.r@web.de>
To: Git Mailing List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 3/4] archive-tar: use size_t in strbuf_append_ext_header()
Date: Sat, 17 Aug 2019 18:24:13 +0200 [thread overview]
Message-ID: <1933ad5e-612f-b5ce-065b-f435338c3c9c@web.de> (raw)
In-Reply-To: <c77a0081-93ab-7b97-e322-9616f6e7f86c@web.de>
One of its callers already passes in a size_t value. Use it
consistently in this function.
Signed-off-by: René Scharfe <l.s.r@web.de>
---
archive-tar.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/archive-tar.c b/archive-tar.c
index 4395a29ffb..9d09edd547 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -142,10 +142,10 @@ static int stream_blocked(const struct object_id *oid)
* string and appends it to a struct strbuf.
*/
static void strbuf_append_ext_header(struct strbuf *sb, const char *keyword,
- const char *value, unsigned int valuelen)
+ const char *value, size_t valuelen)
{
size_t orig_len = sb->len;
- int len, tmp;
+ size_t len, tmp;
/* "%u %s=%s\n" */
len = 1 + 1 + strlen(keyword) + 1 + valuelen + 1;
@@ -153,14 +153,14 @@ static void strbuf_append_ext_header(struct strbuf *sb, const char *keyword,
len++;
strbuf_grow(sb, len);
- strbuf_addf(sb, "%u %s=", len, keyword);
+ strbuf_addf(sb, "%"PRIuMAX" %s=", (uintmax_t)len, keyword);
strbuf_add(sb, value, valuelen);
strbuf_addch(sb, '\n');
if (len != sb->len - orig_len)
- warning("pax extended header length miscalculated as %d"
+ warning("pax extended header length miscalculated as %"PRIuMAX
", should be %"PRIuMAX,
- len, (uintmax_t)(sb->len - orig_len));
+ (uintmax_t)len, (uintmax_t)(sb->len - orig_len));
}
/*
--
2.23.0
next prev parent reply other threads:[~2019-08-17 16:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-17 16:19 [PATCH 0/4] fix pax extended header length calculation René Scharfe
2019-08-17 16:23 ` [PATCH 1/4] archive-tar: report wrong pax extended header length René Scharfe
2019-08-17 16:24 ` [PATCH 2/4] archive-tar: fix pax extended header length calculation René Scharfe
2019-08-17 18:03 ` Eric Sunshine
2019-08-17 16:24 ` René Scharfe [this message]
2019-08-17 16:24 ` [PATCH 4/4] archive-tar: turn length miscalculation warning into BUG René Scharfe
2019-08-17 16:40 ` [PATCH 0/4] fix pax extended header length calculation brian m. carlson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1933ad5e-612f-b5ce-065b-f435338c3c9c@web.de \
--to=l.s.r@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).