mirror of
https://github.com/simon987/fastimagehash-go.git
synced 2025-04-19 10:26:45 +00:00
Update fastimagehash.go
This commit is contained in:
parent
8bf61096c8
commit
4c7782f655
@ -106,7 +106,7 @@ var LibVersion = C.GoString(C.Version)
|
|||||||
|
|
||||||
func retHash(hash *C.uchar, hashSize int, ret C.int) (*Hash, Code) {
|
func retHash(hash *C.uchar, hashSize int, ret C.int) (*Hash, Code) {
|
||||||
if ret == Ok {
|
if ret == Ok {
|
||||||
goHash := C.GoBytes(unsafe.Pointer(hash), C.int(hashSize))
|
goHash := C.GoBytes(unsafe.Pointer(hash), C.int(hashSize * hashSize / 8))
|
||||||
C.free(unsafe.Pointer(hash))
|
C.free(unsafe.Pointer(hash))
|
||||||
|
|
||||||
return &Hash{
|
return &Hash{
|
||||||
@ -123,11 +123,11 @@ func retHash(hash *C.uchar, hashSize int, ret C.int) (*Hash, Code) {
|
|||||||
|
|
||||||
func retMultiHash(m *C.multi_hash_t, hashSize int, ret C.int) (*MultiHash, Code) {
|
func retMultiHash(m *C.multi_hash_t, hashSize int, ret C.int) (*MultiHash, Code) {
|
||||||
if ret == Ok {
|
if ret == Ok {
|
||||||
goPHash := C.GoBytes(unsafe.Pointer(m.phash), C.int(hashSize))
|
goPHash := C.GoBytes(unsafe.Pointer(m.phash), C.int(hashSize * hashSize / 8))
|
||||||
goAHash := C.GoBytes(unsafe.Pointer(m.ahash), C.int(hashSize))
|
goAHash := C.GoBytes(unsafe.Pointer(m.ahash), C.int(hashSize * hashSize / 8))
|
||||||
goDHash := C.GoBytes(unsafe.Pointer(m.dhash), C.int(hashSize))
|
goDHash := C.GoBytes(unsafe.Pointer(m.dhash), C.int(hashSize * hashSize / 8))
|
||||||
goWHash := C.GoBytes(unsafe.Pointer(m.whash), C.int(hashSize))
|
goWHash := C.GoBytes(unsafe.Pointer(m.whash), C.int(hashSize * hashSize / 8))
|
||||||
goMHash := C.GoBytes(unsafe.Pointer(m.mhash), C.int(hashSize))
|
goMHash := C.GoBytes(unsafe.Pointer(m.mhash), C.int(hashSize * hashSize / 8))
|
||||||
C.multi_hash_destroy(m)
|
C.multi_hash_destroy(m)
|
||||||
|
|
||||||
return &MultiHash{
|
return &MultiHash{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user