threads / patch / 8416

patchFix integer type mismatch on 64-bit systems

Subject: [tig PATCH] Fix integer type mismatch on 64-bit systems

## tl;dr

2 messages between Jun 3, 2007 and Jun 4, 2007. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Steven Grimm· Jun 3, 2007, 21:12 UTC · lore
fprintf wants an int parameter for the field width of a "%.*s" expression, but
the code was passing a size_t instead. This potentially broke systems where
sizeof(size_t) != sizeof(int). And even on systems where it did't break,
it still caused a compiler warning.
---
 tig.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to tig.c +1 −1
diff --git a/tig.c b/tig.c
index 6adfb33..b09d91b 100644
--- a/tig.c
+++ b/tig.c
@@ -1153,7 +1153,7 @@ read_option(char *opt, size_t optlen, char *value, size_t valuelen)
 
 	if (status == ERR) {
 		fprintf(stderr, "Error on line %d, near '%.*s': %s\n",
-			config_lineno, optlen, opt, config_msg);
+			config_lineno, (int) optlen, opt, config_msg);
 		config_errors = TRUE;
 	}
 
-- 
1.5.2.35.ga334
Jonas Fonseca· Jun 4, 2007, 06:47 UTC · re: Steven Grimm · lore

Re: [tig PATCH] Fix integer type mismatch on 64-bit systems

On 6/3/07, Steven Grimm <koreth@midwinter.com> wrote:
> fprintf wants an int parameter for the field width of a "%.*s" expression, but
> the code was passing a size_t instead. This potentially broke systems where
> sizeof(size_t) != sizeof(int). And even on systems where it did't break,
> it still caused a compiler warning.
Thanks, I also fixed another such occurrence.
BTW, in good git spirit you are encouraged to sign off your patches. :)
-- 
Jonas Fonseca

← back to recent threads