Skip to content

Commit 6f69325

Browse files
avargitster
authored andcommitted
gettext API users: don't explicitly cast ngettext()'s "n"
Change a few stray users of the inline gettext.h Q_() function to stop casting its "n" argument, the vast majority of the users of that wrapper API use the implicit cast to "unsigned long". The ngettext() function (which Q_() resolves to) takes an "unsigned long int", and so does our Q_() wrapper for it, see 0c9ea33 (i18n: add stub Q_() wrapper for ngettext, 2011-03-09). The function isn't ours, but provided by e.g. GNU libintl. This amends code added in added in 7171a0b (index-pack: correct "len" type in unpack_data(), 2016-07-13). The cast it added for the printf format to die() was needed, but not the cast to Q_(). Likewise the casts in strbuf.c added in 8f354a1 (l10n: localizable upload progress messages, 2019-07-02) and for builtin/merge-recursive.c in ccf7813 (i18n: merge-recursive: mark error messages for translation, 2016-09-15) weren't needed. In the latter case the cast was copy/pasted from the argument to warning() itself, added in b74d779 (MinGW: Fix compiler warning in merge-recursive, 2009-05-23). The cast for warning() is needed, but not the one for ngettext()'s "n" argument. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c216290 commit 6f69325

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

builtin/index-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ static void *unpack_data(struct object_entry *obj,
583583
if (!n)
584584
die(Q_("premature end of pack file, %"PRIuMAX" byte missing",
585585
"premature end of pack file, %"PRIuMAX" bytes missing",
586-
(unsigned int)len),
586+
len),
587587
(uintmax_t)len);
588588
from += n;
589589
len -= n;

builtin/merge-recursive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
5858
"Ignoring %s.",
5959
"cannot handle more than %d bases. "
6060
"Ignoring %s.",
61-
(int)ARRAY_SIZE(bases)-1),
61+
ARRAY_SIZE(bases)-1),
6262
(int)ARRAY_SIZE(bases)-1, argv[i]);
6363
}
6464
if (argc - i != 3) /* "--" "<head>" "<remote>" */

strbuf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,9 +875,9 @@ static void strbuf_humanise(struct strbuf *buf, off_t bytes,
875875
strbuf_addf(buf,
876876
humanise_rate == 0 ?
877877
/* TRANSLATORS: IEC 80000-13:2008 byte */
878-
Q_("%u byte", "%u bytes", (unsigned)bytes) :
878+
Q_("%u byte", "%u bytes", bytes) :
879879
/* TRANSLATORS: IEC 80000-13:2008 byte/second */
880-
Q_("%u byte/s", "%u bytes/s", (unsigned)bytes),
880+
Q_("%u byte/s", "%u bytes/s", bytes),
881881
(unsigned)bytes);
882882
}
883883
}

0 commit comments

Comments
 (0)