Esempio n. 1
0
func (d VoiceAttributes) get(k C.CFStringRef) (s string) {
	cs := C.CFDictionaryGetValue(d.cfd, unsafe.Pointer(k))
	if cs != nil {
		s = cfstringGo(C.CFStringRef(cs))
	}
	return
}
Esempio n. 2
0
func getCFDictValueRef(dict C.CFDictionaryRef, key C.CFTypeRef) (C.CFTypeRef, error) {
	var retVal C.CFTypeRef
	exist := C.CFDictionaryGetValueIfPresent(dict, unsafe.Pointer(key), (*unsafe.Pointer)(retVal))
	// log.Debugf("retVal: %#v", retVal)
	if exist == C.Boolean(0) {
		return nil, errors.New("getCFDictValueRef: Key doesn't exist")
	}
	// return retVal, nil

	return (C.CFTypeRef)(C.CFDictionaryGetValue(dict, unsafe.Pointer(key))), nil
}