Strip white-space characters from attribute names gathered via gsoap.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Mon, 7 Aug 2006 09:04:15 +0000 (09:04 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Mon, 7 Aug 2006 09:04:15 +0000 (09:04 +0000)
org.glite.jp.index/Makefile
org.glite.jp.index/examples/jpis-client.c
org.glite.jp.index/src/common.c [new file with mode: 0644]
org.glite.jp.index/src/common.h [new file with mode: 0644]
org.glite.jp.index/src/ws_is_typeref.c

index 6f3dd95..0886580 100644 (file)
@@ -61,11 +61,12 @@ ps_prefix:=jpps_
 SRCS:= conf.c bones_server.c soap_ops.c soap_ps_calls.c \
        ws_ps_typeref.c ws_is_typeref.c db_ops.c context.c common_server.c \
        ${is_prefix}ServerLib.c \
-       ${ps_prefix}ClientLib.c ${ps_prefix}C.c \
+       ${ps_prefix}ClientLib.c ${ps_prefix}C.c
 
 EXA_TEST_SRCS:=jpis-test.c ${is_prefix}C.c ${is_prefix}Client.c context.c db_ops.c conf.c
 EXA_DB_SRCS:=jpis-db-internal.c db_ops.c conf.c context.c
-EXA_CLIENT_SRCS:=jpis-client.c ${is_client_prefix}C.c ${is_client_prefix}Client.c
+EXA_CLIENT_SRCS:=jpis-client.c common.c \
+       ${is_client_prefix}C.c ${is_client_prefix}Client.c
 #                ${is_prefix}C.c
 
 OBJS:=${SRCS:.c=.o}
index 1703d53..fb551ce 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "soap_version.h"
 #include "jpis_client_.nsmap"
+#include "common.h"
 
 
 /* 'jpisclient' as future namespace */
@@ -190,6 +191,8 @@ static void query_example_fill(struct soap *soap, struct _jpisclient__QueryJobs
  * read the XML query
  */
 static int query_recv(struct soap *soap, int fd, struct _jpisclient__QueryJobs *qj) {
+       int i;
+
        memset(qj, 0, sizeof(*qj));
 
        soap->recvfd = fd;
@@ -203,6 +206,12 @@ static int query_recv(struct soap *soap, int fd, struct _jpisclient__QueryJobs *
        soap_end_recv(soap);
        soap_free(soap); /* don't destroy the data we want */
 
+       /* strip white-space characters from attributes */
+       for (i = 0; i < qj->__sizeattributes; i++)
+               glite_jpis_trim_soap(soap, &qj->attributes[i]);
+       for (i = 0; i < qj->__sizeconditions; i++)
+               glite_jpis_trim_soap(soap, &qj->conditions[i]->attr);
+
        return 0;
 }
 
diff --git a/org.glite.jp.index/src/common.c b/org.glite.jp.index/src/common.c
new file mode 100644 (file)
index 0000000..8ffdaeb
--- /dev/null
@@ -0,0 +1,25 @@
+#ident "$Header$"
+
+#include <string.h>
+#include <stdsoap2.h>
+
+#include "common.h"
+
+#define WHITE_SPACE_SET "\n\r \t"
+
+
+void glite_jpis_trim_soap(struct soap *soap, char **soap_str) {
+       size_t pos, len;
+       char *s;
+
+       if (!*soap_str) return;
+
+       pos = strspn(*soap_str, WHITE_SPACE_SET);
+       len = strcspn(*soap_str + pos, WHITE_SPACE_SET);
+       s = soap_malloc(soap, len + 1);
+       memcpy(s, *soap_str + pos, len);
+       s[len] = '\0';
+
+       soap_dealloc(soap, *soap_str);
+       *soap_str = s;
+}
diff --git a/org.glite.jp.index/src/common.h b/org.glite.jp.index/src/common.h
new file mode 100644 (file)
index 0000000..04ef8bf
--- /dev/null
@@ -0,0 +1,8 @@
+#ident "$Header$"
+
+#ifndef GLITE_JPIS_COMMON_H
+#define GLITE_JPIS_COMMON_H
+
+void glite_jpis_trim_soap(struct soap *soap, char **soap_str);
+
+#endif
index a1b8346..17e1935 100644 (file)
@@ -80,7 +80,6 @@ static int SoapToQueryCond(
         glite_jp_query_rec_t           **out)
 {
        glite_jp_query_rec_t    *qr;    
-       int                     i;
 
 
        assert(in); assert(out);