Adjustments to make YAZ compile as C++ code.
[yaz-moved-to-github.git] / src / zoom-c.c
index e497718..8befe19 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: zoom-c.c,v 1.148 2007-09-11 08:40:28 adam Exp $
+ * $Id: zoom-c.c,v 1.152 2007-11-30 11:44:47 adam Exp $
  */
 /**
  * \file zoom-c.c
@@ -49,7 +49,7 @@ static char *cql2pqf(ZOOM_connection c, const char *cql);
  * if it could cause failure when a lookup fails, but that's hard.
  */
 static Odr_oid *zoom_yaz_str_to_z3950oid(ZOOM_connection c,
-                                     int oid_class, const char *str) {
+                                     oid_class oid_class, const char *str) {
     Odr_oid *res = yaz_string_to_oid_odr(yaz_oid_std(), oid_class, str,
                                      c->odr_out);
     if (res == 0)
@@ -174,13 +174,6 @@ static void set_dset_error(ZOOM_connection c, int error,
     }
 }
 
-#if YAZ_HAVE_XML2
-static void set_HTTP_error(ZOOM_connection c, int error,
-                           const char *addinfo, const char *addinfo2)
-{
-    set_dset_error(c, error, "HTTP", addinfo, addinfo2);
-}
-
 static int uri_to_code(const char *uri)
 {
     int code = 0;       
@@ -190,6 +183,13 @@ static int uri_to_code(const char *uri)
     return code;
 }
 
+#if YAZ_HAVE_XML2
+static void set_HTTP_error(ZOOM_connection c, int error,
+                           const char *addinfo, const char *addinfo2)
+{
+    set_dset_error(c, error, "HTTP", addinfo, addinfo2);
+}
+
 static void set_SRU_error(ZOOM_connection c, Z_SRW_diagnostic *d)
 {
     const char *uri = d->uri;
@@ -399,7 +399,7 @@ ZOOM_API(ZOOM_connection)
     c->m_queue_front = 0;
     c->m_queue_back = 0;
 
-    c->sru_version = xstrdup("1.1");
+    c->sru_version = 0;
     return c;
 }
 
@@ -548,7 +548,7 @@ ZOOM_API(void)
 
     xfree(c->sru_version);
     val = ZOOM_options_get(c->options, "sru_version");
-    c->sru_version = xstrdup(val ? val : "1.1");
+    c->sru_version = xstrdup(val ? val : "1.2");
 
     ZOOM_options_set(c->options, "host", c->host_port);
 
@@ -1356,7 +1356,7 @@ static zoom_ret ZOOM_connection_send_init(ZOOM_connection c)
                     odr_prepend(c->odr_out, "ZOOM-C",
                                 ireq->implementationName));
     
-    version = odr_strdup(c->odr_out, "$Revision: 1.148 $");
+    version = odr_strdup(c->odr_out, "$Revision: 1.152 $");
     if (strlen(version) > 10)   /* check for unexpanded CVS strings */
         version[strlen(version)-2] = '\0';
     ireq->implementationVersion = 
@@ -2243,6 +2243,7 @@ static void record_cache_add(ZOOM_resultset r, Z_NamePlusRecord *npr,
     rc->rec.schema = odr_strdup_null(r->odr, schema);
     rc->rec.diag_set = 0;
     rc->rec.diag_uri = 0;
+    rc->rec.diag_message = 0;
     rc->rec.diag_details = 0;
     if (diag)
     {
@@ -3397,7 +3398,7 @@ static Z_APDU *create_update_package(ZOOM_package p)
         {
             Z_IUCorrelationInfo *ci;
             ci = notToKeep->elements[0]->correlationInfo =
-                odr_malloc(p->odr_out, sizeof(*ci));
+                (Z_IUCorrelationInfo *) odr_malloc(p->odr_out, sizeof(*ci));
             ci->note = odr_strdup_null(p->odr_out, correlationInfo_note);
             ci->id = correlationInfo_id ?
                 odr_intdup(p->odr_out, atoi(correlationInfo_id)) : 0;