From 7bcbef11eb17d0b5f756acd74762d1a285aa134f Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 14 Sep 2016 00:18:45 +0200 Subject: [PATCH] ape: fix format clash, %z is for size_t (which is a long currently), not pointer sized --- sys/src/ape/lib/fmt/dofmt.c | 2 +- sys/src/ape/lib/fmt/test.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/src/ape/lib/fmt/dofmt.c b/sys/src/ape/lib/fmt/dofmt.c index 3422e62cd..a3b42ae7a 100644 --- a/sys/src/ape/lib/fmt/dofmt.c +++ b/sys/src/ape/lib/fmt/dofmt.c @@ -544,7 +544,7 @@ __flagfmt(Fmt *f) break; case 'z': f->flags |= FmtLong; - if(sizeof(void*) == sizeof(vlong)) + if(sizeof(size_t) == sizeof(vlong)) f->flags |= FmtVLong; break; } diff --git a/sys/src/ape/lib/fmt/test.c b/sys/src/ape/lib/fmt/test.c index 3d082a816..b968d726d 100644 --- a/sys/src/ape/lib/fmt/test.c +++ b/sys/src/ape/lib/fmt/test.c @@ -12,6 +12,7 @@ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. */ #include +#include #include #include "fmt.h" @@ -36,6 +37,6 @@ main(int argc, char *argv[]) print("%d\n", 23); print("%i\n", 23); print("%p\n", argv); - print("%zd\n", &argv[1] - &argv[0]); + print("%zd\n", (size_t)-1); return 0; }