More wrbuf_buf woes.
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 19 Mar 2007 22:17:41 +0000 (22:17 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 19 Mar 2007 22:17:41 +0000 (22:17 +0000)
client/client.c
client/fhistory.c
src/cclptree.c
test/tst_record_conv.c
test/tstccl.c
test/tstxmlquery.c
util/yaz-xmlquery.c

index 5369d52..31e6077 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: client.c,v 1.329 2007-03-19 14:40:06 adam Exp $
+ * $Id: client.c,v 1.330 2007-03-19 22:17:41 adam Exp $
  */
 /** \file client.c
  *  \brief yaz-client program
  */
 /** \file client.c
  *  \brief yaz-client program
@@ -1017,7 +1017,7 @@ static void display_record(Z_External *r)
         }
         w = wrbuf_alloc();
         yaz_display_grs1(w, r->u.grs1, 0);
         }
         w = wrbuf_alloc();
         yaz_display_grs1(w, r->u.grs1, 0);
-        puts (wrbuf_buf(w));
+        puts (wrbuf_cstr(w));
         wrbuf_destroy(w);
     }
     else if (ent && ent->value == VAL_OPAC)
         wrbuf_destroy(w);
     }
     else if (ent && ent->value == VAL_OPAC)
@@ -1307,10 +1307,7 @@ static char *encode_SRW_term(ODR o, const char *q)
     }
     wrbuf_iconv_write(w, cd, q, strlen(q));
     if (wrbuf_len(w))
     }
     wrbuf_iconv_write(w, cd, q, strlen(q));
     if (wrbuf_len(w))
-    {
-        int len = wrbuf_len(w);
-        res = odr_strdupn(o, wrbuf_buf(w), len);
-    }
+        res = odr_strdup(o, wrbuf_cstr(w));
     else
         res = odr_strdup(o, q);    
     yaz_iconv_close(cd);
     else
         res = odr_strdup(o, q);    
     yaz_iconv_close(cd);
index b75c03d..7fb5f3f 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: fhistory.c,v 1.2 2007-01-24 23:09:48 adam Exp $
+ * $Id: fhistory.c,v 1.3 2007-03-19 22:17:41 adam Exp $
  */
 /** \file fhistory.c
  *  \brief file history implementation
  */
 /** \file fhistory.c
  *  \brief file history implementation
@@ -111,7 +111,7 @@ int file_history_trav(file_history_t fh, void *client_data,
             if (wrbuf_buf(fh->wr)[i] == '\n')
             {
                 wrbuf_buf(fh->wr)[i] = '\0';
             if (wrbuf_buf(fh->wr)[i] == '\n')
             {
                 wrbuf_buf(fh->wr)[i] = '\0';
-                callback(client_data, wrbuf_buf(fh->wr) + off);
+                callback(client_data, wrbuf_cstr(fh->wr) + off);
                 wrbuf_buf(fh->wr)[i] = '\n';
                 i++;
                 break;
                 wrbuf_buf(fh->wr)[i] = '\n';
                 i++;
                 break;
index bcdfe71..e984cdf 100644 (file)
@@ -53,7 +53,7 @@
 /* CCL print rpn tree - infix notation
  * Europagate, 1995
  *
 /* CCL print rpn tree - infix notation
  * Europagate, 1995
  *
- * $Id: cclptree.c,v 1.7 2007-03-19 14:40:07 adam Exp $
+ * $Id: cclptree.c,v 1.8 2007-03-19 22:17:41 adam Exp $
  *
  * Old Europagate Log:
  *
  *
  * Old Europagate Log:
  *
@@ -271,7 +271,6 @@ void ccl_pquery (WRBUF w, struct ccl_rpn_node *p)
         wrbuf_puts (w, " ");
         break;
     }
         wrbuf_puts (w, " ");
         break;
     }
-    wrbuf_cstr(w);
 }
 /*
  * Local variables:
 }
 /*
  * Local variables:
index 6683b84..8fab94e 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 2005-2007, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 2005-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: tst_record_conv.c,v 1.14 2007-03-19 14:40:07 adam Exp $
+ * $Id: tst_record_conv.c,v 1.15 2007-03-19 22:17:41 adam Exp $
  *
  */
 #include <yaz/record_conv.h>
  *
  */
 #include <yaz/record_conv.h>
@@ -182,17 +182,7 @@ static int conv_convert_test(yaz_record_conv_t p,
             {
                 ret = 0;
             }
             {
                 ret = 0;
             }
-            else if (strlen(output_expect_record) != wrbuf_len(output_record))
-            {
-                int expect_len = strlen(output_expect_record);
-                ret = 0;
-                printf("output_record expect-len=%d got-len=%d\n", expect_len,
-                       wrbuf_len(output_record));
-                printf("got-output_record = %s\n", wrbuf_cstr(output_record));
-                printf("output_expect_record = %s\n", output_expect_record);
-            }
-            else if (memcmp(output_expect_record, wrbuf_buf(output_record),
-                            strlen(output_expect_record)))
+            else if (strcmp(output_expect_record, wrbuf_cstr(output_record)))
             {
                 ret = 0;
                 printf("got-output_record = %s\n", wrbuf_cstr(output_record));
             {
                 ret = 0;
                 printf("got-output_record = %s\n", wrbuf_cstr(output_record));
index 6cb694f..f5aac60 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: tstccl.c,v 1.14 2007-03-19 14:40:07 adam Exp $
+ * $Id: tstccl.c,v 1.15 2007-03-19 22:17:41 adam Exp $
  */
 
 /* CCL test */
  */
 
 /* CCL test */
@@ -36,7 +36,7 @@ static int tst_ccl_query(CCL_bibset bibset,
             ccl_pquery(wrbuf, rpn);
             
             /* check expect a result and that it matches */
             ccl_pquery(wrbuf, rpn);
             
             /* check expect a result and that it matches */
-            if (result && !strcmp(wrbuf_buf(wrbuf), result))
+            if (result && !strcmp(wrbuf_cstr(wrbuf), result))
                 ret = 1;
             else
                 ret = 0;
                 ret = 1;
             else
                 ret = 0;
index e0c7999..0857804 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: tstxmlquery.c,v 1.15 2007-03-19 14:40:07 adam Exp $
+ * $Id: tstxmlquery.c,v 1.16 2007-03-19 22:17:41 adam Exp $
  */
 
 #include <stdlib.h>
  */
 
 #include <stdlib.h>
@@ -83,7 +83,7 @@ enum pqf2xml_status pqf2xml_text(const char *pqf, const char *expect_xml,
                     else
                     {
                         status = XML_NO_MATCH;
                     else
                     {
                         status = XML_NO_MATCH;
-                        printf("Result: %s\n", wrbuf_buf(w));
+                        printf("Result: %s\n", wrbuf_cstr(w));
                     }
                     wrbuf_destroy(w);
                 }
                     }
                     wrbuf_destroy(w);
                 }
index 9fcab5a..4cc8196 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: yaz-xmlquery.c,v 1.7 2007-03-19 14:40:08 adam Exp $
+ * $Id: yaz-xmlquery.c,v 1.8 2007-03-19 22:17:41 adam Exp $
  */
 
 #include <stdlib.h>
  */
 
 #include <stdlib.h>
@@ -117,7 +117,7 @@ void xmlquerytopqf(const char *xmlstr)
        {
            WRBUF w = wrbuf_alloc();
            yaz_query_to_wrbuf(w, query);
        {
            WRBUF w = wrbuf_alloc();
            yaz_query_to_wrbuf(w, query);
-           printf("%s\n", wrbuf_buf(w));
+           printf("%s\n", wrbuf_cstr(w));
            wrbuf_destroy(w);
        }
        odr_destroy(odr);
            wrbuf_destroy(w);
        }
        odr_destroy(odr);