From 75aa16d69f91e2c3aba76fd08b66387abd88053a Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Sun, 19 Aug 2018 18:13:24 +0200 Subject: [PATCH] CFRef are no more internally represented as pointer but as integers This is due to improvements in CGO compiler for darwin OS --- enumerator/usb_go1.10_darwin.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/enumerator/usb_go1.10_darwin.go b/enumerator/usb_go1.10_darwin.go index 27249f8..4640918 100644 --- a/enumerator/usb_go1.10_darwin.go +++ b/enumerator/usb_go1.10_darwin.go @@ -144,12 +144,12 @@ func (me *C.io_registry_entry_t) GetStringProperty(key string) (string, error) { k := cfStringCreateWithString(key) defer C.CFRelease(C.CFTypeRef(k)) property := C.IORegistryEntryCreateCFProperty(*me, k, C.kCFAllocatorDefault, 0) - if property == nil { + if property == 0 { return "", errors.New("Property not found: " + key) } defer C.CFRelease(property) - if ptr := C.CFStringGetCStringPtr((C.CFStringRef)(unsafe.Pointer(property)), 0); ptr != nil { + if ptr := C.CFStringGetCStringPtr(C.CFStringRef(property), 0); ptr != nil { return C.GoString(ptr), nil } // in certain circumstances CFStringGetCStringPtr may return NULL @@ -165,7 +165,7 @@ func (me *C.io_registry_entry_t) GetIntProperty(key string, intType C.CFNumberTy k := cfStringCreateWithString(key) defer C.CFRelease(C.CFTypeRef(k)) property := C.IORegistryEntryCreateCFProperty(*me, k, C.kCFAllocatorDefault, 0) - if property == nil { + if property == 0 { return 0, errors.New("Property not found: " + key) } defer C.CFRelease(property)