linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] [PATCH] fix warning in linphonecore.c on amd64


From: Chi-Thanh Christopher Nguyen
Subject: [Linphone-developers] [PATCH] fix warning in linphonecore.c on amd64
Date: Fri, 14 Dec 2007 16:08:39 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de-AT; rv:1.8.1.11) Gecko/20071205 SeaMonkey/1.1.7

Hi,

on amd64, size_t is a 64 bit unsigned int. Thus, the compiler will
generate a warning in the following line of linphonecore.c, because %i
is a 32 bit signed int:

               snprintf(clen,sizeof(clen),"%i",strlen(dtmf_body));

The attached patch changes "%i" to "%zu" and will allow compilation with
-Werror on amd64. Note that the z modifier was introduced in C99, so it
may not be portable regarding older compilers. Ymmv.


Best regards,
Chi-Thanh Christopher Nguyen

Index: linphonecore.c
===================================================================
RCS file: /sources/linphone/linphone/coreapi/linphonecore.c,v
retrieving revision 1.201
diff -u -r1.201 linphonecore.c
--- linphonecore.c      6 Dec 2007 14:52:30 -0000       1.201
+++ linphonecore.c      14 Dec 2007 14:25:30 -0000
@@ -1724,7 +1724,7 @@
                snprintf(dtmf_body, 999, "Signal=%c\r\nDuration=250\r\n", dtmf);
                osip_message_set_body(msg,dtmf_body,strlen(dtmf_body));
                osip_message_set_content_type(msg,"application/dtmf-relay");
-               snprintf(clen,sizeof(clen),"%i",strlen(dtmf_body));
+               snprintf(clen,sizeof(clen),"%zu",strlen(dtmf_body));
                osip_message_set_content_length(msg,clen);
                
                eXosip_lock();

reply via email to

[Prev in Thread] Current Thread [Next in Thread]