Skip to content

Commit

Permalink
Fix Python and NodeJS bindings for 32bits systems, fixes #707
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed May 22, 2024
1 parent d4d65f2 commit 530e414
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bindings/js/minify.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func init() {
}

func goBytes(str *C.char, length C.longlong) []byte {
return (*[1 << 32]byte)(unsafe.Pointer(str))[:length:length]
return (*[1 << 31]byte)(unsafe.Pointer(str))[:length:length]
}

func goStringArray(carr **C.char, length C.longlong) []string {
Expand All @@ -34,7 +34,7 @@ func goStringArray(carr **C.char, length C.longlong) []string {
}

strs := make([]string, length)
arr := (*[1 << 32]*C.char)(unsafe.Pointer(carr))[:length:length]
arr := (*[1 << 31]*C.char)(unsafe.Pointer(carr))[:length:length]
for i := 0; i < int(length); i++ {
strs[i] = C.GoString(arr[i])
}
Expand Down
4 changes: 2 additions & 2 deletions bindings/py/minify.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func init() {
}

func goBytes(str *C.char, length C.longlong) []byte {
return (*[1 << 32]byte)(unsafe.Pointer(str))[:length:length]
return (*[1 << 31]byte)(unsafe.Pointer(str))[:length:length]
}

func goStringArray(carr **C.char, length C.longlong) []string {
Expand All @@ -34,7 +34,7 @@ func goStringArray(carr **C.char, length C.longlong) []string {
}

strs := make([]string, length)
arr := (*[1 << 32]*C.char)(unsafe.Pointer(carr))[:length:length]
arr := (*[1 << 31]*C.char)(unsafe.Pointer(carr))[:length:length]
for i := 0; i < int(length); i++ {
strs[i] = C.GoString(arr[i])
}
Expand Down

0 comments on commit 530e414

Please sign in to comment.