man pages
[yaz-moved-to-github.git] / zoom / zoom-c.c
index 8364312..e081199 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoom-c.c,v 1.40 2002-08-20 08:19:40 adam Exp $
+ * $Id: zoom-c.c,v 1.44 2002-09-13 08:57:03 adam Exp $
  *
  * ZOOM layer for C, connections, result sets, queries.
  */
@@ -639,7 +639,7 @@ static void otherInfo_attach (ZOOM_connection c, Z_APDU *a, ODR out)
     {
         size_t len;
        Z_OtherInformation **oi;
-        char buf[20];
+        char buf[80];
         const char *val;
         const char *cp;
         int oidval;
@@ -1036,7 +1036,7 @@ ZOOM_record_get (ZOOM_record rec, const char *type, int *len)
     if (!strcmp (type, "database"))
     {
        if (len)
-            *len = strlen(npr->databaseName);
+            *len = (npr->databaseName ? strlen(npr->databaseName) : 0);
        return npr->databaseName;
     }
     else if (!strcmp (type, "syntax"))
@@ -1407,8 +1407,8 @@ static int send_sort (ZOOM_connection c)
 
 static int send_present (ZOOM_connection c)
 {
-    Z_APDU *apdu = zget_APDU(c->odr_out, Z_APDU_presentRequest);
-    Z_PresentRequest *req = apdu->u.presentRequest;
+    Z_APDU *apdu = 0;
+    Z_PresentRequest *req = 0;
     int i = 0;
     const char *syntax = 0;
     const char *elementSetName = 0;
@@ -1455,6 +1455,9 @@ static int send_present (ZOOM_connection c)
     if (i == resultset->count)
        return 0;
 
+    apdu = zget_APDU(c->odr_out, Z_APDU_presentRequest);
+    req = apdu->u.presentRequest;
+
     resultset->start += i;
     resultset->count -= i;
     *req->resultSetStartPoint = resultset->start + 1;