[sr-dev] git:master:c43f0995: cdp: fix compilation warning

Victor Seva linuxmaniac at torreviejawireless.org
Thu Apr 12 13:58:58 CEST 2018


Module: kamailio
Branch: master
Commit: c43f09956bd44115c437e59627088d0825aa27ec
URL: https://github.com/kamailio/kamailio/commit/c43f09956bd44115c437e59627088d0825aa27ec

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2018-04-12T13:49:12+02:00

cdp: fix compilation warning

> CC (clang) [M cdp.so]		authstatemachine.o
> authstatemachine.c:748:3: warning: implicit conversion from 'int' to 'char' changes value from 209 to -47 [-Wconstant-conversion]
>                 set_4bytes(x, AAA_SUCCESS);
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ./diameter.h:77:44: note: expanded from macro 'set_4bytes'
>         (_b)[2]=((_v)&0x0000ff00)>>8;(_b)[3]=((_v)&0x000000ff);}
>                                             ~ ~~~~^~~~~~~~~~~
> authstatemachine.c:758:3: warning: implicit conversion from 'int' to 'char' changes value from 209 to -47 [-Wconstant-conversion]
>                 set_4bytes(x, AAA_SUCCESS);
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ./diameter.h:77:44: note: expanded from macro 'set_4bytes'
>         (_b)[2]=((_v)&0x0000ff00)>>8;(_b)[3]=((_v)&0x000000ff);}
>                                             ~ ~~~~^~~~~~~~~~~

> ocs_avp_helper.c:329:3: warning: implicit conversion from 'int' to 'char' changes value from 128 to -128 [-Wconstant-conversion]
>                 set_4bytes(x, 86400);
>                 ^~~~~~~~~~~~~~~~~~~~
> ./../cdp/diameter.h:77:44: note: expanded from macro 'set_4bytes'
>         (_b)[2]=((_v)&0x0000ff00)>>8;(_b)[3]=((_v)&0x000000ff);}
>                                             ~ ~~~~^~~~~~~~~~~

---

Modified: src/modules/cdp/diameter.h

---

Diff:  https://github.com/kamailio/kamailio/commit/c43f09956bd44115c437e59627088d0825aa27ec.diff
Patch: https://github.com/kamailio/kamailio/commit/c43f09956bd44115c437e59627088d0825aa27ec.patch

---

diff --git a/src/modules/cdp/diameter.h b/src/modules/cdp/diameter.h
index 2be25258c0..5a7cb0e0c5 100644
--- a/src/modules/cdp/diameter.h
+++ b/src/modules/cdp/diameter.h
@@ -74,7 +74,7 @@
 
 #define set_4bytes(_b,_v) \
 	{(_b)[0]=((_v)&0xff000000)>>24;(_b)[1]=((_v)&0x00ff0000)>>16;\
-	(_b)[2]=((_v)&0x0000ff00)>>8;(_b)[3]=((_v)&0x000000ff);}
+	(_b)[2]=((_v)&0x0000ff00)>>8;(_b)[3]=(unsigned char)((_v)&0x000000ff);}
 
 #define to_32x_len( _len_ ) \
 	( (_len_)+(((_len_)&3)?4-((_len_)&3):0) )




More information about the sr-dev mailing list