mirror of https://github.com/mattn/go-sqlite3.git
use math.MaxInt32. related issue #238
This commit is contained in:
parent
09259a5557
commit
fdc70a0fab
|
@ -22,22 +22,21 @@ import "C"
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
//export callbackTrampoline
|
//export callbackTrampoline
|
||||||
func callbackTrampoline(ctx *C.sqlite3_context, argc int, argv **C.sqlite3_value) {
|
func callbackTrampoline(ctx *C.sqlite3_context, argc int, argv **C.sqlite3_value) {
|
||||||
// TODO should create slice dynamically?
|
args := (*[math.MaxInt32 - 1]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc]
|
||||||
args := (*[1 << 20]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc]
|
|
||||||
fi := (*functionInfo)(unsafe.Pointer(C.sqlite3_user_data(ctx)))
|
fi := (*functionInfo)(unsafe.Pointer(C.sqlite3_user_data(ctx)))
|
||||||
fi.Call(ctx, args)
|
fi.Call(ctx, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
//export stepTrampoline
|
//export stepTrampoline
|
||||||
func stepTrampoline(ctx *C.sqlite3_context, argc int, argv **C.sqlite3_value) {
|
func stepTrampoline(ctx *C.sqlite3_context, argc int, argv **C.sqlite3_value) {
|
||||||
// TODO should create slice dynamically?
|
args := (*[math.MaxInt32 - 1]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc]
|
||||||
args := (*[1 << 20]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc]
|
|
||||||
ai := (*aggInfo)(unsafe.Pointer(C.sqlite3_user_data(ctx)))
|
ai := (*aggInfo)(unsafe.Pointer(C.sqlite3_user_data(ctx)))
|
||||||
ai.Step(ctx, args)
|
ai.Step(ctx, args)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue