Mercurial > hg > toybox
diff toys/posix/find.c @ 1719:848969327d77 draft
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.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 02 Mar 2015 20:27:50 -0600 |
parents | e85e5f3b87c2 |
children | 9adb0ccb617e |
line wrap: on
line diff
--- a/toys/posix/find.c Sun Mar 01 16:43:01 2015 -0600 +++ b/toys/posix/find.c Mon Mar 02 20:27:50 2015 -0600 @@ -165,7 +165,7 @@ // encode back to utf8, something is wrong with your libc. But just // in case somebody finds an exploit... len = wcrtomb(new, c, 0); - if (len < 1) error_exit("bad utf8 %x", c); + if (len < 1) error_exit("bad utf8 %x", (int)c); new += len; } }