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

Author: Victor Seva <linuxman...@torreviejawireless.org>
Committer: Victor Seva <linuxman...@torreviejawireless.org>
Date: 2020-03-07T11:35:55+01:00

core: remove compiler warnings [-Wstring-plus-int]

> core/parser/parse_fline.c:93:34: warning: adding 'int' to a string does not 
> append to the string [-Wstring-plus-int]
>               strncasecmp( tmp+1, SIP_VERSION+1, SIP_VERSION_LEN-1)==0 &&
>                                   ~~~~~~~~~~~^~
>
> core/parser/parse_fline.c:121:9: warning: adding 'int' to a string does not 
> append to the string [-Wstring-plus-int]
>       } else IFISMETHOD( INVITE, 'I' )
>              ^~~~~~~~~~~~~~~~~~~~~~~~~
>
> core/parser/msg_parser.h:131:35: note: expanded from macro 'IFISMETHOD'
>              strncasecmp( tmp+1, #methodname +1, methodname##_LEN-1)==0 &&    
>  \
>                                  ~~~~~~~~~~~~^~

---

Modified: src/core/parser/msg_parser.h
Modified: src/core/parser/parse_fline.c

---

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

---

diff --git a/src/core/parser/msg_parser.h b/src/core/parser/msg_parser.h
index f3ea088eb8..ceedf2cda9 100644
--- a/src/core/parser/msg_parser.h
+++ b/src/core/parser/msg_parser.h
@@ -128,7 +128,7 @@ typedef enum request_method {
 
 #define IFISMETHOD(methodname,firstchar)                                  \
 if (  (*tmp==(firstchar) || *tmp==((firstchar) | 32)) &&                  \
-               strncasecmp( tmp+1, #methodname +1, methodname##_LEN-1)==0 &&   
  \
+               strncasecmp( tmp+1, &#methodname[1], methodname##_LEN-1)==0 &&  
   \
                *(tmp+methodname##_LEN)==' ') {                                 
  \
                                fl->type=SIP_REQUEST;                           
          \
                                fl->u.request.method.len=methodname##_LEN;      
          \
diff --git a/src/core/parser/parse_fline.c b/src/core/parser/parse_fline.c
index c535b49a4c..a5aefb7ee8 100644
--- a/src/core/parser/parse_fline.c
+++ b/src/core/parser/parse_fline.c
@@ -90,7 +90,7 @@ char* parse_first_line(char* buffer, unsigned int len, struct 
msg_start* fl)
        tmp=buffer;
        /* is it perhaps a reply, ie does it start with "SIP...." ? */
        if (    (*tmp=='S' || *tmp=='s') && 
-               strncasecmp( tmp+1, SIP_VERSION+1, SIP_VERSION_LEN-1)==0 &&
+               strncasecmp( tmp+1, &SIP_VERSION[1], SIP_VERSION_LEN-1)==0 &&
                (*(tmp+SIP_VERSION_LEN)==' ')) {
                        fl->type=SIP_REPLY;
                        fl->flags|=FLINE_FLAG_PROTO_SIP;
@@ -98,7 +98,7 @@ char* parse_first_line(char* buffer, unsigned int len, struct 
msg_start* fl)
                        tmp=buffer+SIP_VERSION_LEN;
        } else if (http_reply_parse != 0 && (*tmp=='H' || *tmp=='h')) {
                        /* 'HTTP/1.' */
-                       if (strncasecmp( tmp+1, HTTP_VERSION+1, 
HTTP_VERSION_LEN-1)==0 &&
+                       if (strncasecmp( tmp+1, &HTTP_VERSION[1], 
HTTP_VERSION_LEN-1)==0 &&
                          /* [0|1] */
                          ((*(tmp+HTTP_VERSION_LEN)=='0') || 
(*(tmp+HTTP_VERSION_LEN)=='1')) &&
                          (*(tmp+HTTP_VERSION_LEN+1)==' ')  ){ 
@@ -111,7 +111,7 @@ char* parse_first_line(char* buffer, unsigned int len, 
struct msg_start* fl)
                                  fl->u.reply.version.len=HTTP_VERSION_LEN+1 
/*include last digit*/;
           tmp=buffer+HTTP_VERSION_LEN+1 /* last digit */;
                        /* 'HTTP/2' */
-                       } else if (strncasecmp( tmp+1, HTTP2_VERSION+1, 
HTTP2_VERSION_LEN-1)==0 &&
+                       } else if (strncasecmp( tmp+1, &HTTP2_VERSION[1], 
HTTP2_VERSION_LEN-1)==0 &&
                                                (*(tmp+HTTP2_VERSION_LEN)==' 
')) {
                                        fl->type=SIP_REPLY;
                                        fl->flags|=FLINE_FLAG_PROTO_HTTP;


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to