From f99dba3967f05f5ed65a919b597405c377a19ef4 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Sat, 24 Mar 2012 22:18:20 +0100 Subject: [PATCH] Remove implicit casts Cast parameters of htonl in uint32_t in IN6_IS_ADDR_GLOBAL and IN6_IS_ADDR_ULA definitions. Remove comparison with 0 in while statement of vfmatch, http_SendMessage and http_MakeMessage. (cherry picked from commit 804088d85902305e949d9f7002d06b1b97a360da) --- ChangeLog | 9 +++++++++ upnp/src/api/upnpapi.c | 8 ++++---- upnp/src/genlib/net/http/httpparser.c | 2 +- upnp/src/genlib/net/http/httpreadwrite.c | 4 ++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8bd41a..8eccf68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -332,6 +332,15 @@ Version 1.8.0 Version 1.6.17 ******************************************************************************* +2012-03-24 Fabrice Fontaine + + Remove implicit casts + + Cast parameters of htonl in uint32_t in IN6_IS_ADDR_GLOBAL and + IN6_IS_ADDR_ULA definitions. + Remove comparison with 0 in while statement of vfmatch, + http_SendMessage and http_MakeMessage. + 2012-03-24 Yoichi NAKAYAMA SF Bug Tracker id 3510693 - build fail with --disable-device diff --git a/upnp/src/api/upnpapi.c b/upnp/src/api/upnpapi.c index d93bdaa..0ec2ad1 100644 --- a/upnp/src/api/upnpapi.c +++ b/upnp/src/api/upnpapi.c @@ -84,14 +84,14 @@ #ifndef IN6_IS_ADDR_GLOBAL #define IN6_IS_ADDR_GLOBAL(a) \ - ((((__const uint32_t *) (a))[0] & htonl(0x70000000)) \ - == htonl (0x20000000)) + ((((__const uint32_t *) (a))[0] & htonl((uint32_t)0x70000000)) \ + == htonl ((uint32_t)0x20000000)) #endif /* IS ADDR GLOBAL */ #ifndef IN6_IS_ADDR_ULA #define IN6_IS_ADDR_ULA(a) \ - ((((__const uint32_t *) (a))[0] & htonl(0xfe000000)) \ - == htonl (0xfc000000)) + ((((__const uint32_t *) (a))[0] & htonl((uint32_t)0xfe000000)) \ + == htonl ((uint32_t)0xfc000000)) #endif /* IS ADDR ULA */ /*! This structure is for virtual directory callbacks */ diff --git a/upnp/src/genlib/net/http/httpparser.c b/upnp/src/genlib/net/http/httpparser.c index ff23b55..4ac73fe 100644 --- a/upnp/src/genlib/net/http/httpparser.c +++ b/upnp/src/genlib/net/http/httpparser.c @@ -979,7 +979,7 @@ static parse_status_t vfmatch( save_pos = scanner->cursor; status = PARSE_OK; - while( ( ( c = *fmt_ptr++ ) != 0 ) && + while( ( c = *fmt_ptr++ ) && ( status == ( parse_status_t ) PARSE_OK ) ) { if( c == '%' ) { c = *fmt_ptr++; diff --git a/upnp/src/genlib/net/http/httpreadwrite.c b/upnp/src/genlib/net/http/httpreadwrite.c index 839749c..27d3e1e 100644 --- a/upnp/src/genlib/net/http/httpreadwrite.c +++ b/upnp/src/genlib/net/http/httpreadwrite.c @@ -443,7 +443,7 @@ int http_SendMessage(SOCKINFO *info, int *TimeOut, const char *fmt, ...) memset(Chunk_Header, 0, sizeof(Chunk_Header)); va_start(argp, fmt); - while ((c = *fmt++) != 0) { + while ((c = *fmt++)) { if (c == 'I') { Instr = va_arg(argp, struct SendInstruction *); if (Instr->ReadSendSize >= 0) @@ -1478,7 +1478,7 @@ int http_MakeMessage(membuffer *buf, int http_major_version, memset(tempbuf, 0, sizeof(tempbuf)); va_start(argp, fmt); - while ((c = *fmt++) != 0) { + while ((c = *fmt++)) { if (c == 's') { /* C string */ s = (char *)va_arg(argp, char *);