Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yazpp
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 29 Oct 2013 17:11:47 +0000 (18:11 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 29 Oct 2013 17:11:47 +0000 (18:11 +0100)
src/Makefile.am
src/gdu.cpp
src/test_gdu.cpp [new file with mode: 0644]
src/test_query.cpp [new file with mode: 0644]
src/tstquery.cpp [deleted file]

index b79b6d1..fca2afc 100644 (file)
@@ -1,5 +1,5 @@
 
-check_PROGRAMS = tstquery
+check_PROGRAMS = test_query test_gdu
 noinst_PROGRAMS = yaz-my-server yaz-my-client
 bin_SCRIPTS = yazpp-config
 
@@ -27,6 +27,7 @@ yaz_my_client_SOURCES=yaz-my-client.cpp
 
 yaz_my_server_SOURCES=yaz-my-server.cpp yaz-marc-sample.cpp
 
-tstquery_SOURCES=tstquery.cpp
+test_query_SOURCES=test_query.cpp
+test_gdu_SOURCES=test_gdu.cpp
 
 LDADD=libyazpp.la $(YAZLALIB)
index fb87251..467ded2 100644 (file)
@@ -44,7 +44,8 @@ void GDU::base(Z_GDU *gdu, ODR encode)
         char *buf = odr_getbuf(encode, &len, 0);
 
         odr_setbuf(m_decode, buf, len, 0);
-        z_GDU(m_decode, &m_gdu, 0, 0);
+        if (!z_GDU(m_decode, &m_gdu, 0, 0))
+            m_gdu = 0;
     }
     odr_destroy(encode);
 }
diff --git a/src/test_gdu.cpp b/src/test_gdu.cpp
new file mode 100644 (file)
index 0000000..31319d9
--- /dev/null
@@ -0,0 +1,49 @@
+/* This file is part of the yazpp toolkit.
+ * Copyright (C) 1998-2013 Index Data and Mike Taylor
+ * See the file LICENSE for details.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdlib.h>
+#include <yazpp/gdu.h>
+#include <yaz/test.h>
+#include <yaz/log.h>
+
+using namespace yazpp_1;
+
+static void tst1(void)
+{
+    ODR odr = odr_createmem(ODR_ENCODE);
+
+    const char *url =
+        "http://localhost:9036/XXX/cproxydebug-7/node102/p/105/c=content_connector"
+        "a=usr/pw#&? r=cfusr/cfpw p=1.2.3.4:80/www.indexdata.com/staff/";
+    int use_full_host = 0;
+    Z_GDU *gdu_req = z_get_HTTP_Request_uri(odr, url, 0, use_full_host);
+
+    GDU a(gdu_req);
+    GDU b;
+
+    b = a;
+
+    odr_destroy(odr);
+}
+
+int main(int argc, char **argv)
+{
+    YAZ_CHECK_INIT(argc, argv);
+    tst1();
+    YAZ_CHECK_TERM;
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
diff --git a/src/test_query.cpp b/src/test_query.cpp
new file mode 100644 (file)
index 0000000..28acf6a
--- /dev/null
@@ -0,0 +1,55 @@
+/* This file is part of the yazpp toolkit.
+ * Copyright (C) 1998-2013 Index Data and Mike Taylor
+ * See the file LICENSE for details.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdlib.h>
+#include <yazpp/z-query.h>
+#include <yaz/test.h>
+#include <yaz/log.h>
+
+using namespace yazpp_1;
+
+int tst1(const char *query_str_in, const char *query_expected)
+{
+    Yaz_Z_Query q;
+
+    q = query_str_in;
+
+    Yaz_Z_Query q2;
+
+    q2 = q;
+
+    char query_str_out[100];
+    q2.print(query_str_out, sizeof(query_str_out)-1);
+
+    if (strcmp(query_str_out, query_expected))
+    {
+       yaz_log(YLOG_LOG, "query mismatch out=%s expected=%s",
+               query_str_out, query_expected);
+        return 0;
+    }
+    return 1;
+}
+
+int main(int argc, char **argv)
+{
+    YAZ_CHECK_INIT(argc, argv);
+    YAZ_CHECK(tst1("", ""));
+    YAZ_CHECK(tst1("x", "RPN @attrset Bib-1 x"));
+    YAZ_CHECK(tst1("@and a b", "RPN @attrset Bib-1 @and a b"));
+    YAZ_CHECK_TERM;
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
diff --git a/src/tstquery.cpp b/src/tstquery.cpp
deleted file mode 100644 (file)
index 28acf6a..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* This file is part of the yazpp toolkit.
- * Copyright (C) 1998-2013 Index Data and Mike Taylor
- * See the file LICENSE for details.
- */
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdlib.h>
-#include <yazpp/z-query.h>
-#include <yaz/test.h>
-#include <yaz/log.h>
-
-using namespace yazpp_1;
-
-int tst1(const char *query_str_in, const char *query_expected)
-{
-    Yaz_Z_Query q;
-
-    q = query_str_in;
-
-    Yaz_Z_Query q2;
-
-    q2 = q;
-
-    char query_str_out[100];
-    q2.print(query_str_out, sizeof(query_str_out)-1);
-
-    if (strcmp(query_str_out, query_expected))
-    {
-       yaz_log(YLOG_LOG, "query mismatch out=%s expected=%s",
-               query_str_out, query_expected);
-        return 0;
-    }
-    return 1;
-}
-
-int main(int argc, char **argv)
-{
-    YAZ_CHECK_INIT(argc, argv);
-    YAZ_CHECK(tst1("", ""));
-    YAZ_CHECK(tst1("x", "RPN @attrset Bib-1 x"));
-    YAZ_CHECK(tst1("@and a b", "RPN @attrset Bib-1 @and a b"));
-    YAZ_CHECK_TERM;
-}
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-