mirror of
https://github.com/simon987/fastimagehash-go.git
synced 2025-04-10 14:16:48 +00:00
Add LibVersion string
This commit is contained in:
parent
41fab32cee
commit
51613b1541
@ -6,6 +6,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
fmt.Println(fastimagehash.LibVersion);
|
||||||
|
|
||||||
hash, ret := fastimagehash.PHashFile("/path/to/image.jpg", 8, 4)
|
hash, ret := fastimagehash.PHashFile("/path/to/image.jpg", 8, 4)
|
||||||
|
|
||||||
if ret == fastimagehash.Ok {
|
if ret == fastimagehash.Ok {
|
||||||
|
@ -13,6 +13,8 @@ import (
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
const char* Version = FASTIMAGEHASH_VERSION;
|
||||||
|
|
||||||
char *hash_to_hex_string_reversed_wr(void *h, int size) {
|
char *hash_to_hex_string_reversed_wr(void *h, int size) {
|
||||||
char *out = malloc(size * 2 + 1);
|
char *out = malloc(size * 2 + 1);
|
||||||
hash_to_hex_string_reversed((uchar*)h, out, size);
|
hash_to_hex_string_reversed((uchar*)h, out, size);
|
||||||
@ -100,6 +102,8 @@ type MultiHash struct {
|
|||||||
MHash Hash
|
MHash Hash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user