From c43f09956bd44115c437e59627088d0825aa27ec Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Thu, 12 Apr 2018 13:49:12 +0200 Subject: [PATCH] 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);} > ~ ~~~~^~~~~~~~~~~ --- src/modules/cdp/diameter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/cdp/diameter.h b/src/modules/cdp/diameter.h index 2be25258c04..5a7cb0e0c53 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) )