[sr-dev] git:master:2b2febf9: xmpp: fix gcc 7 warnings

Victor Seva linuxmaniac at torreviejawireless.org
Fri Dec 15 11:44:12 CET 2017


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

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2017-12-15T11:44:03+01:00

xmpp: fix gcc 7 warnings

> CC (gcc) [M xmpp.so]		xode.o
> xode.c: In function 'xode_get_tag':
> xode.c:346:77: warning: comparison between pointer and zero character constant [-Wpointer-compare]
>      if(parent == NULL || parent->firstchild == NULL || name == NULL || name == '\0') return NULL;
>                                                                              ^~
> xode.c:346:72: note: did you mean to dereference the pointer?
>      if(parent == NULL || parent->firstchild == NULL || name == NULL || name == '\0') return NULL;
>                                                                         ^
> CC (gcc) [M xmpp.so]		xstream.o
> xstream.c: In function '_xode_put_expatattribs':
> xstream.c:34:20: warning: comparison between pointer and zero character constant [-Wpointer-compare]
>      while (atts[i] != '\0')
>                     ^~
> xstream.c:34:12: note: did you mean to dereference the pointer?
>      while (atts[i] != '\0')
>             ^
> CC (gcc) [M xmpp.so]		xode_from.o
> xode_from.c: In function '_xode_put_expatattribs':
> xode_from.c:35:20: warning: comparison between pointer and zero character constant [-Wpointer-compare]
>      while (atts[i] != '\0')
>                     ^~
> xode_from.c:35:12: note: did you mean to dereference the pointer?
>      while (atts[i] != '\0')
>             ^

---

Modified: src/modules/xmpp/xode.c
Modified: src/modules/xmpp/xode_from.c
Modified: src/modules/xmpp/xstream.c

---

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

---

diff --git a/src/modules/xmpp/xode.c b/src/modules/xmpp/xode.c
index 4909f6345e..8cc086aa3f 100644
--- a/src/modules/xmpp/xode.c
+++ b/src/modules/xmpp/xode.c
@@ -343,7 +343,7 @@ xode xode_get_tag(xode parent, const char* name)
     char *str, *slash, *qmark, *equals;
     xode step, ret;
 
-    if(parent == NULL || parent->firstchild == NULL || name == NULL || name == '\0') return NULL;
+    if(parent == NULL || parent->firstchild == NULL || name == NULL || *name == '\0') return NULL;
 
     if(strstr(name, "/") == NULL && strstr(name,"?") == NULL)
         return _xode_search(parent->firstchild, name, XODE_TYPE_TAG);
diff --git a/src/modules/xmpp/xode_from.c b/src/modules/xmpp/xode_from.c
index 8a78f4ba4d..60d49fa0ca 100644
--- a/src/modules/xmpp/xode_from.c
+++ b/src/modules/xmpp/xode_from.c
@@ -32,7 +32,7 @@ static void _xode_put_expatattribs(xode current, const char **atts)
 {
     int i = 0;
     if (atts == NULL) return;
-    while (atts[i] != '\0')
+    while (*(atts[i]) != '\0')
     {
         xode_put_attrib(current, atts[i], atts[i+1]);
         i += 2;
diff --git a/src/modules/xmpp/xstream.c b/src/modules/xmpp/xstream.c
index b4367b3aa1..41a6c1e386 100644
--- a/src/modules/xmpp/xstream.c
+++ b/src/modules/xmpp/xstream.c
@@ -31,7 +31,7 @@ static void _xode_put_expatattribs(xode owner, const char** atts)
 {
     int i = 0;
     if (atts == NULL) return;
-    while (atts[i] != '\0')
+    while (*(atts[i]) != '\0')
     {
         xode_put_attrib(owner, atts[i], atts[i+1]);
         i += 2;




More information about the sr-dev mailing list