[sr-dev] git:5.3:7bf0fc43: core: remove compiler warnings [-Wstring-plus-int]

Daniel-Constantin Mierla miconda at gmail.com
Thu Jun 11 21:37:13 CEST 2020


Module: kamailio
Branch: 5.3
Commit: 7bf0fc433008f4a0e0bd1e7eb7583fb989df973c
URL: https://github.com/kamailio/kamailio/commit/7bf0fc433008f4a0e0bd1e7eb7583fb989df973c

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-06-11T21:36:57+02:00

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

> core/parser/parse_fline.c:241:17: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
>                                        SIP_VERSION+1, SIP_VERSION_LEN-1)) {
>                                        ~~~~~~~~~~~^~
>
> core/parser/parse_fline.c:241:17: note: use array indexing to silence this warning
>                                        SIP_VERSION+1, SIP_VERSION_LEN-1)) {
>                                                   ^
>                                        &          [ ]
> core/parser/parse_fline.c:247:18: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
>                                        HTTP_VERSION+1, HTTP_VERSION_LEN-1)) {
>                                        ~~~~~~~~~~~~^~
>
> core/parser/parse_fline.c:247:18: note: use array indexing to silence this warning
>                                        HTTP_VERSION+1, HTTP_VERSION_LEN-1)) {
>                                                    ^
>                                        &           [ ]
>
> 2 warnings generated.

(cherry picked from commit f2959f422bb8171241728f5148d4b21c9cc2c681)

---

Modified: src/core/parser/parse_fline.c

---

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

---

diff --git a/src/core/parser/parse_fline.c b/src/core/parser/parse_fline.c
index a5aefb7ee8..5016a31d59 100644
--- a/src/core/parser/parse_fline.c
+++ b/src/core/parser/parse_fline.c
@@ -238,13 +238,13 @@ char* parse_first_line(char* buffer, unsigned int len, struct msg_start* fl)
 				&& (fl->u.request.version.s[0]=='S'
 					|| fl->u.request.version.s[0]=='s')
 				&& !strncasecmp(fl->u.request.version.s+1,
-					SIP_VERSION+1, SIP_VERSION_LEN-1)) {
+					&SIP_VERSION[1], SIP_VERSION_LEN-1)) {
 			fl->flags|=FLINE_FLAG_PROTO_SIP;
 		} else if(fl->u.request.version.len >= HTTP_VERSION_LEN
 				&& (fl->u.request.version.s[0]=='H'
 					|| fl->u.request.version.s[0]=='h')
 				&& !strncasecmp(fl->u.request.version.s+1,
-					HTTP_VERSION+1, HTTP_VERSION_LEN-1)) {
+					&HTTP_VERSION[1], HTTP_VERSION_LEN-1)) {
 			fl->flags|=FLINE_FLAG_PROTO_HTTP;
 		}
 	}




More information about the sr-dev mailing list