Merge pull request #654 from typeless/fix-too-large-arrary-error

Fix build failure on Windows/386
This commit is contained in:
mattn 2018-10-24 10:09:38 +09:00 committed by GitHub
commit 276457a170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -19,6 +19,7 @@ extern void unlock_notify_callback(void *arg, int argc);
import "C" import "C"
import ( import (
"fmt" "fmt"
"math"
"sync" "sync"
"unsafe" "unsafe"
) )
@ -59,7 +60,7 @@ func (t *unlock_notify_table) get(h uint) chan struct{} {
//export unlock_notify_callback //export unlock_notify_callback
func unlock_notify_callback(argv unsafe.Pointer, argc C.int) { func unlock_notify_callback(argv unsafe.Pointer, argc C.int) {
for i := 0; i < int(argc); i++ { for i := 0; i < int(argc); i++ {
parg := ((*(*[1 << 30]*[1]uint)(argv))[i]) parg := ((*(*[(math.MaxInt32 - 1) / unsafe.Sizeof(uintptr)]*[1]uint)(argv))[i])
arg := *parg arg := *parg
h := arg[0] h := arg[0]
c := unt.get(h) c := unt.get(h)