aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/printf.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-03-02 20:27:50 -0600
committerRob Landley <rob@landley.net>2015-03-02 20:27:50 -0600
commit38e5485c6a8ece99aa8aac2f318f14764857ee24 (patch)
tree2be9f3999a430d19664701480c3696aab142c52c /toys/posix/printf.c
parent5f1f34ae1a227edbb4b0bba7fe99009d4efd94bd (diff)
downloadtoybox-38e5485c6a8ece99aa8aac2f318f14764857ee24.tar.gz
On 64 bit, subtracting two pointers produces a long result. On 32 bit, it's an int. Even though long _is_ 32 bits on a 32 bit systems, gcc warns about it because reasons.
Also, the warning being that "expects int, but type is wchar_t"... no, type is not wchar_t. Type is probably long. Specify the ACTUAL TYPE, not the random typedef alias for it. If the translated type _did_ match, there wouldn't be a warning! (This is why c89 promoted all arguments to int, precisely so this wasn't a problem.)
Diffstat (limited to 'toys/posix/printf.c')
-rw-r--r--toys/posix/printf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/printf.c b/toys/posix/printf.c
index 1c2c5471..4c9de286 100644
--- a/toys/posix/printf.c
+++ b/toys/posix/printf.c
@@ -130,7 +130,7 @@ void printf_main(void)
sprintf(to, "*.*L%c", c);
printf(toybuf, wp[0], wp[1], ld);
- } else error_exit("bad %%%c@%ld", c, f-*toys.optargs);
+ } else error_exit("bad %%%c@%ld", c, (long)(f-*toys.optargs));
if (end && (errno || *end)) perror_msg("bad %%%c %s", c, aa);
}