Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 3 Dec 2009 21:24:02 +0000 (22:24 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 3 Dec 2009 21:24:02 +0000 (22:24 +0100)
src/odr_int.c
src/seshigh.c
src/srwutil.c
src/tcpip.c
ztest/ztest.c

index 606f59b..5e3ed97 100644 (file)
@@ -35,7 +35,7 @@ int odr_integer(ODR o, Odr_int **p, int opt, const char *name)
     if (o->direction == ODR_PRINT)
     {
         odr_prname(o, name);
-        odr_printf(o, "%d\n", **p);
+        odr_printf(o, ODR_INT_PRINTF "\n", **p);
         return 1;
     }
     if (cons)
index b0349e7..bdfb499 100644 (file)
@@ -2755,7 +2755,9 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb,
 
         comp.which = Z_RecordComp_simple;
         /* how many records does the user agent want, then? */
-        if (bsrt->hits <= *req->smallSetUpperBound)
+        if (bsrt->hits < 0)
+            *toget = 0;
+        else if (bsrt->hits <= *req->smallSetUpperBound)
         {
             *toget = bsrt->hits;
             if ((comp.u.simple = req->smallSetElementSetNames))
index d011233..b0d387e 100644 (file)
@@ -14,8 +14,9 @@
 #include <yaz/yaz-iconv.h>
 
 /** \brief decodes HTTP path (which should hold SRU database)
-    \param o memory for returned result
+    \param n memory for returned result
     \param uri URI path (up to but not including ?)
+    \param len URI len (up to but not including ?)
     \returns ODR allocated database
 */
 static char *yaz_decode_sru_dbpath_odr(ODR n, const char *uri, size_t len)
index 50c0622..cb2883c 100644 (file)
@@ -423,7 +423,7 @@ void *tcpip_straddr(COMSTACK h, const char *str)
 {
     tcpip_state *sp = (tcpip_state *)h->cprivate;
     const char *port = "210";
-    struct addrinfo *ai;
+    struct addrinfo *ai = 0;
     if (h->protocol == PROTO_HTTP)
         port = "80";
     if (!tcpip_init())
index c95c471..8011e0f 100644 (file)
@@ -38,9 +38,9 @@ int ztest_delete(void *handle, bend_delete_rr *rr);
     Only terms  that looks a numeric is used.. Returns -1 if
     no sub tree has a hit count term
 */
-static int get_term_hit(Z_RPNStructure *s)
+static Odr_int get_term_hit(Z_RPNStructure *s)
 {
-    int h = -1;
+    Odr_int h = -1;
     switch(s->which)
     {
     case Z_RPNStructure_simple:
@@ -51,7 +51,17 @@ static int get_term_hit(Z_RPNStructure *s)
             {
                 Odr_oct *oct = apt->term->u.general;
                 if (oct->len > 0 && oct->buf[0] >= '0' && oct->buf[0] <= '9')
-                    h = atoi_n((const char *) oct->buf, oct->len);
+                {
+                    char *endptr;
+                    WRBUF hits_str = wrbuf_alloc();
+                    wrbuf_write(hits_str, (const char *) oct->buf, oct->len);
+#ifdef WIN32
+                    h = _strtoui64(wrbuf_cstr(hits_str), &endptr, 10);
+#else
+                    h = strtoll(wrbuf_cstr(hits_str), &endptr, 10);
+#endif
+                    wrbuf_destroy(hits_str);
+                }
             }
         }
         break;
@@ -73,9 +83,9 @@ static int get_term_hit(Z_RPNStructure *s)
     have a way to trigger a certain hit count. Good for testing of
     client applications etc
 */
-static int get_hit_count(Z_Query *q)
+static Odr_int get_hit_count(Z_Query *q)
 {
-    int h = -1;
+    Odr_int h = -1;
     if (q->which == Z_Query_type_1 || q->which == Z_Query_type_101)
         h = get_term_hit(q->u.type_1->RPNStructure);
     if (h == -1)