Skip to content

Commit 79910f2

Browse files
committed
fix for warning cases, not just errors
1 parent bf037c6 commit 79910f2

File tree

6 files changed

+31
-18
lines changed

6 files changed

+31
-18
lines changed

auth.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package sqlite
22

33
// #include <stdint.h>
44
// #include <sqlite3.h>
5+
// #include "wrappers.h"
56
//
6-
// extern int c_auth_tramp(void*, int, const char*, const char*, const char*, const char*);
77
// static int sqlite3_go_set_authorizer(sqlite3* conn, uintptr_t id) {
88
// return sqlite3_set_authorizer(conn, c_auth_tramp, (void*)id);
99
// }

func.go

+9-13
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ package sqlite
1919
// #include <sqlite3.h>
2020
// #include "wrappers.h"
2121
//
22-
// extern void func_tramp(sqlite3_context*, int, sqlite3_value**);
23-
// extern void step_tramp(sqlite3_context*, int, sqlite3_value**);
24-
// extern void final_tramp(sqlite3_context*);
25-
//
2622
// static int go_sqlite3_create_function_v2(
2723
// sqlite3 *db,
2824
// const char *zFunctionName,
@@ -167,10 +163,10 @@ func (conn *Conn) CreateFunction(name string, deterministic bool, numArgs int, x
167163

168164
var funcfn, stepfn, finalfn *[0]byte
169165
if xFunc == nil {
170-
stepfn = (*[0]byte)(C.step_tramp)
171-
finalfn = (*[0]byte)(C.final_tramp)
166+
stepfn = (*[0]byte)(C.c_step_tramp)
167+
finalfn = (*[0]byte)(C.c_final_tramp)
172168
} else {
173-
funcfn = (*[0]byte)(C.func_tramp)
169+
funcfn = (*[0]byte)(C.c_func_tramp)
174170
}
175171

176172
res := C.go_sqlite3_create_function_v2(
@@ -197,8 +193,8 @@ func getxfuncs(ctx *C.sqlite3_context) *xfunc {
197193
return x
198194
}
199195

200-
//export func_tramp
201-
func func_tramp(ctx *C.sqlite3_context, n C.int, valarray **C.sqlite3_value) {
196+
//export go_func_tramp
197+
func go_func_tramp(ctx *C.sqlite3_context, n C.int, valarray **C.sqlite3_value) {
202198
x := getxfuncs(ctx)
203199
var vals []Value
204200
if n > 0 {
@@ -207,8 +203,8 @@ func func_tramp(ctx *C.sqlite3_context, n C.int, valarray **C.sqlite3_value) {
207203
x.xFunc(Context{ptr: ctx}, vals...)
208204
}
209205

210-
//export step_tramp
211-
func step_tramp(ctx *C.sqlite3_context, n C.int, valarray **C.sqlite3_value) {
206+
//export go_step_tramp
207+
func go_step_tramp(ctx *C.sqlite3_context, n C.int, valarray **C.sqlite3_value) {
212208
x := getxfuncs(ctx)
213209
var vals []Value
214210
if n > 0 {
@@ -217,8 +213,8 @@ func step_tramp(ctx *C.sqlite3_context, n C.int, valarray **C.sqlite3_value) {
217213
x.xStep(Context{ptr: ctx}, vals...)
218214
}
219215

220-
//export final_tramp
221-
func final_tramp(ctx *C.sqlite3_context) {
216+
//export go_final_tramp
217+
func go_final_tramp(ctx *C.sqlite3_context) {
222218
x := getxfuncs(ctx)
223219
x.xFinal(Context{ptr: ctx})
224220
}

session.go

-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ package sqlite
1919
// #include <sqlite3.h>
2020
// #include "wrappers.h"
2121
//
22-
// extern int go_strm_w_tramp(uintptr_t, char*, int);
23-
// extern int go_strm_r_tramp(uintptr_t, char*, int*);
24-
//
2522
// static int go_sqlite3session_changeset_strm(
2623
// sqlite3_session *pSession,
2724
// int (*xOutput)(void *pOut, const void *pData, int nData),

sqlite.go

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ package sqlite
5252
// return sqlite3_bind_blob(stmt, col, p, n, SQLITE_TRANSIENT);
5353
// }
5454
//
55-
// extern void c_log_fn(void*, int, char*);
5655
// static void enable_logging() {
5756
// sqlite3_config(SQLITE_CONFIG_LOG, c_log_fn, NULL);
5857
// }

wrappers.c

+15
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ int c_xapply_filter_tramp(void* pCtx, const char* zTab) {
4242
return go_xapply_filter_tramp((uintptr_t)pCtx, (char*)zTab);
4343
}
4444

45+
extern void go_func_tramp(sqlite3_context*, int, sqlite3_value**);
46+
void c_func_tramp(sqlite3_context* ctx, int n, sqlite3_value** valarray) {
47+
return go_func_tramp(ctx, n, valarray);
48+
}
49+
50+
extern void go_step_tramp(sqlite3_context*, int, sqlite3_value**);
51+
void c_step_tramp(sqlite3_context* ctx, int n, sqlite3_value** valarray) {
52+
return go_step_tramp(ctx, n, valarray);
53+
}
54+
55+
extern void go_final_tramp(sqlite3_context*);
56+
void c_final_tramp(sqlite3_context* ctx) {
57+
return go_final_tramp(ctx);
58+
}
59+
4560
extern void go_destroy_tramp(uintptr_t);
4661
void c_destroy_tramp(void* ptr) {
4762
return go_destroy_tramp((uintptr_t)ptr);

wrappers.h

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ int c_strm_r_tramp(void*, const void*, int*);
2626
int c_xapply_conflict_tramp(void*, int, sqlite3_changeset_iter*);
2727
int c_xapply_filter_tramp(void*, const char*);
2828

29+
void c_log_fn(void*, int, char*);
30+
int c_auth_tramp(void*, int, const char*, const char*, const char*, const char*);
31+
32+
void c_func_tramp(sqlite3_context*, int, sqlite3_value**);
33+
void c_step_tramp(sqlite3_context*, int, sqlite3_value**);
34+
void c_final_tramp(sqlite3_context*);
2935
void c_destroy_tramp(void*);
3036

3137
#endif // WRAPPERS_H

0 commit comments

Comments
 (0)