aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-05-02 10:02:38 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-05-02 10:02:38 +0200
commit38159428d2b1e95a2c6fa91775f7b3678aef2f1f (patch)
tree470099c4ed9789ffbed11dab46687771ac4320ac
parent4a8b938348b9503decd2794b33a71d340fe9414f (diff)
mgcp: Fix compiler warning on 64bit builds
ENDPOINT_NUMBER takes the difference of two pointers. On 64bit builds the difference is a long and the compiler then complains about the usage of abs. We will never have thousands of endpoints so silence the warning by casting the ENDPOINT_NUMBER to int. mgcp_vty.c:1381:34: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value] rtp_port = rtp_calculate_port(ENDPOINT_NUMBER(endp), ^ ../../include/openbsc/mgcp_internal.h:206:31: note: expanded from macro 'ENDPOINT_NUMBER' #define ENDPOINT_NUMBER(endp) abs(endp - endp->tcfg->endpoints) ^ mgcp_vty.c:1381:34: note: use function 'labs' instead
-rw-r--r--openbsc/include/openbsc/mgcp_internal.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/openbsc/include/openbsc/mgcp_internal.h b/openbsc/include/openbsc/mgcp_internal.h
index 6778064b3..9caab0b21 100644
--- a/openbsc/include/openbsc/mgcp_internal.h
+++ b/openbsc/include/openbsc/mgcp_internal.h
@@ -203,7 +203,7 @@ struct mgcp_endpoint {
} osmux;
};
-#define ENDPOINT_NUMBER(endp) abs(endp - endp->tcfg->endpoints)
+#define ENDPOINT_NUMBER(endp) abs((int)(endp - endp->tcfg->endpoints))
struct mgcp_msg_ptr {
unsigned int start;