Skip to content

Commit

Permalink
core: remove compiler warnings [-Wstring-plus-int]
Browse files Browse the repository at this point in the history
> 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 &&     \
>                                  ~~~~~~~~~~~~^~

(cherry picked from commit 2b070a6)
  • Loading branch information
linuxmaniac authored and miconda committed Jun 11, 2020
1 parent f8b0994 commit 1797a30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/parser/msg_parser.h
Expand Up @@ -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; \
Expand Down
6 changes: 3 additions & 3 deletions src/core/parser/parse_fline.c
Expand Up @@ -90,15 +90,15 @@ 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;
fl->u.reply.version.len=SIP_VERSION_LEN;
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)==' ') ){
Expand All @@ -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;
Expand Down

0 comments on commit 1797a30

Please sign in to comment.