]> jfr.im git - irc/quakenet/newserv.git/blobdiff - sqlite/sqlite.c
fixes for clang
[irc/quakenet/newserv.git] / sqlite / sqlite.c
index 388965de112b110cc8858f69b1582fe891279eb0..fa85257121488a0a70f5ea0b9a7a712a33dd0dda 100644 (file)
@@ -7,7 +7,10 @@
 #include <stdarg.h>
 #include <string.h>
 
+#ifndef __USE_POSIX199309
 #define __USE_POSIX199309
+#endif
+
 #include <time.h>
 
 #include "../core/config.h"
@@ -234,16 +237,16 @@ int sqliteconnected(void) {
 
 size_t sqliteescapestring(char *buf, char *src, unsigned int len) {
   unsigned int i;
-  char *p;
+  char *p, *d;
 
-  for(p=src,i=0;i<len;i++,p++) {
+  for(p=src,d=buf,i=0;i<len;i++,p++) {
     if(*p == '\'')
-      *buf++ = *p;
-    *buf++ = *p;
+      *d++ = *p;
+    *d++ = *p;
   }
-  *buf = '\0';
+  *d = '\0';
 
-  return buf - p;
+  return d - buf;
 }
 
 SQLiteResult *sqlitegetresult(SQLiteConn *r) {
@@ -321,12 +324,12 @@ static void loadtablerows(SQLiteConn *c, void *tag) {
 
   /* the handlers do all the checking and cleanup */
   if(t->init)
-    (t->init)(c, t->tag);
+    (t->init)(NULL, t->tag);
 
   (t->data)(c, t->tag);
 
   if(t->fini)
-    (t->fini)(c, t->tag);
+    (t->fini)(NULL, t->tag);
 
   nsfree(POOL_SQLITE, t);
 }