# HG changeset patch # User Rob Landley # Date 1425349670 21600 # Node ID 848969327d774c219ce436aa85983c1073c03622 # Parent 3ac8236754134e17c96fa6933a0ab985c65f4b8d 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.) diff -r 3ac823675413 -r 848969327d77 toys/posix/find.c --- 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; } } diff -r 3ac823675413 -r 848969327d77 toys/posix/printf.c --- a/toys/posix/printf.c Sun Mar 01 16:43:01 2015 -0600 +++ b/toys/posix/printf.c Mon Mar 02 20:27:50 2015 -0600 @@ -130,7 +130,7 @@ 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); } diff -r 3ac823675413 -r 848969327d77 toys/posix/sed.c --- a/toys/posix/sed.c Sun Mar 01 16:43:01 2015 -0600 +++ b/toys/posix/sed.c Mon Mar 02 20:27:50 2015 -0600 @@ -997,7 +997,7 @@ brand: // Reminisce about chestnut trees. - error_exit("bad pattern '%s'@%ld (%c)", errstart, line-errstart+1, *line); + error_exit("bad pattern '%s'@%ld (%c)", errstart, line-errstart+1L, *line); } void sed_main(void)