aboutsummaryrefslogtreecommitdiffstats
path: root/audio/liblo
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2014-12-04 07:06:56 +0800
committerdim <dim@FreeBSD.org>2014-12-04 07:06:56 +0800
commit618ece2edb960ee8c0e550087d76b9298b9184c2 (patch)
treec3ebfcb123839eb60b2334e4bb457ec0c48f7f35 /audio/liblo
parent08872ccce85065ff27448efcf969be7d43e0bff3 (diff)
downloadfreebsd-ports-gnome-618ece2edb960ee8c0e550087d76b9298b9184c2.tar.gz
freebsd-ports-gnome-618ece2edb960ee8c0e550087d76b9298b9184c2.tar.zst
freebsd-ports-gnome-618ece2edb960ee8c0e550087d76b9298b9184c2.zip
Fix audio/liblo build with clang 3.5.0
On 64-bit arches, audio/liblo will fail to compile with clang 3.5.0, due to the following -Werror warning: message.c:1000:17: error: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value] abs((char *) d - (char *) end), m); ^ On 64-bit arches, pointer differences are usually longs, but simply replacing the abs() call with labs() is also not a good solution, because then the code is incorrect for 32-bit arches. Fix this by using a ternary operator expression, which is type-safe. While here, fix the printf format conversion specifier for printing ptrdiff_t's. Approved by: portmgr (antoine)
Diffstat (limited to 'audio/liblo')
-rw-r--r--audio/liblo/files/patch-src-messages.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/audio/liblo/files/patch-src-messages.c b/audio/liblo/files/patch-src-messages.c
new file mode 100644
index 000000000000..0eb8820b8e97
--- /dev/null
+++ b/audio/liblo/files/patch-src-messages.c
@@ -0,0 +1,13 @@
+--- src/message.c.orig 2014-01-20 12:49:42.000000000 +0100
++++ src/message.c 2014-12-03 23:02:28.000000000 +0100
+@@ -996,8 +996,8 @@ void lo_message_pp(lo_message m)
+ putchar('\n');
+ if (d != end) {
+ fprintf(stderr,
+- "liblo warning: type and data do not match (off by %d) in message %p\n",
+- abs((char *) d - (char *) end), m);
++ "liblo warning: type and data do not match (off by %td) in message %p\n",
++ d >= end ? (char *) d - (char *) end : (char *) end - (char *) d, m);
+ }
+ }
+