fixes wrong use of va_list v1.1

Tue, 12 Dec 2017 15:22:31 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 12 Dec 2017 15:22:31 +0100
branch
v1.1
changeset 339
ad45ba74fe1b
parent 327
a66e0a1f01fc
child 340
9f37d0806200

fixes wrong use of va_list

libidav/davqlexec.c file | annotate | diff | comparison | revisions
libidav/davqlexec.h file | annotate | diff | comparison | revisions
libidav/webdav.c file | annotate | diff | comparison | revisions
--- a/libidav/davqlexec.c	Sat Oct 07 10:25:11 2017 +0200
+++ b/libidav/davqlexec.c	Tue Dec 12 15:22:31 2017 +0100
@@ -66,7 +66,7 @@
     return result;
 }
 
-sstr_t dav_format_string(UcxAllocator *a, sstr_t fstr, va_list ap, davqlerror_t *error) {
+sstr_t dav_format_string(UcxAllocator *a, sstr_t fstr, va_list *ap, davqlerror_t *error) {
     UcxBuffer *buf = ucx_buffer_new(NULL, 128, UCX_BUFFER_AUTOEXTEND);
     
     int placeholder = 0;
@@ -81,17 +81,17 @@
                 int err = 0;
                 switch(c) {
                     case 's': {
-                        char *arg = va_arg(ap, char*);
+                        char *arg = va_arg(*ap, char*);
                         ucx_buffer_puts(buf, arg);
                         break;
                     }
                     case 'd': {
-                        int arg = va_arg(ap, int);
+                        int arg = va_arg(*ap, int);
                         ucx_bprintf(buf, "%d", arg);
                         break;
                     }
                     case 'u': {
-                        unsigned int arg = va_arg(ap, unsigned int);
+                        unsigned int arg = va_arg(*ap, unsigned int);
                         ucx_bprintf(buf, "%u", arg);
                         break;
                     }
@@ -371,7 +371,7 @@
     
     // get path string
     davqlerror_t error;
-    sstr_t path = dav_format_string(mp->allocator, st->path, ap, &error);
+    sstr_t path = dav_format_string(mp->allocator, st->path, &ap, &error);
     if(error) {
         // TODO: cleanup
         ucx_mempool_destroy(mp);
@@ -640,7 +640,7 @@
         }
         case DAVQL_STRING: {
             cmd.type = DAVQL_CMD_STRING;
-            cmd.data.string = dav_format_string(a, src, ap, &error);
+            cmd.data.string = dav_format_string(a, src, &ap, &error);
             ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode);
             break;
         }
--- a/libidav/davqlexec.h	Sat Oct 07 10:25:11 2017 +0200
+++ b/libidav/davqlexec.h	Tue Dec 12 15:22:31 2017 +0100
@@ -138,7 +138,7 @@
 DavResult dav_statement_execv(DavSession *sn, DavQLStatement *st, va_list ap);
 
 UcxBuffer* dav_path_string(sstr_t src, va_list ap, davqlerror_t *error);
-sstr_t dav_format_string(UcxAllocator *a, sstr_t fstr, va_list ap, davqlerror_t *error);
+sstr_t dav_format_string(UcxAllocator *a, sstr_t fstr, va_list *ap, davqlerror_t *error);
 
 DavResult dav_exec_select(DavSession *sn, DavQLStatement *st, va_list ap);
 
--- a/libidav/webdav.c	Sat Oct 07 10:25:11 2017 +0200
+++ b/libidav/webdav.c	Tue Dec 12 15:22:31 2017 +0100
@@ -374,7 +374,7 @@
     }
     
     va_list ap;
-    va_start(ap, query);
+    va_start(ap, query);  
     DavResult result = dav_statement_execv(sn, stmt, ap);
     va_end(ap);
     

mercurial