DiskIO (macOS): add support

This commit is contained in:
李通洲
2023-10-08 15:57:31 +08:00
parent 085d0924db
commit b2130477ae
3 changed files with 74 additions and 25 deletions
+23
View File
@@ -83,6 +83,29 @@ const char* ffCfDictGetInt(CFDictionaryRef dict, CFStringRef key, int* result)
return "TypeID is neither 'CFNumber' nor 'CFData'";
}
const char* ffCfDictGetInt64(CFDictionaryRef dict, CFStringRef key, int64_t* result)
{
CFTypeRef cf = (CFTypeRef)CFDictionaryGetValue(dict, key);
if(cf == NULL)
return "CFDictionaryGetValue() failed";
if(CFGetTypeID(cf) == CFNumberGetTypeID())
{
if(!CFNumberGetValue((CFNumberRef)cf, kCFNumberSInt64Type, result))
return "Number type is not SInt64";
return NULL;
}
else if(CFGetTypeID(cf) == CFDataGetTypeID())
{
if(CFDataGetLength((CFDataRef)cf) != sizeof(int64_t))
return "Data length is not sizeof(int64_t)";
CFDataGetBytes((CFDataRef)cf, CFRangeMake(0, sizeof(int64_t)), (uint8_t*)result);
return NULL;
}
return "TypeID is neither 'CFNumber' nor 'CFData'";
}
const char* ffCfDictGetData(CFDictionaryRef dict, CFStringRef key, uint32_t offset, uint32_t size, uint8_t* result, uint32_t* length)
{
CFTypeRef cf = (CFTypeRef)CFDictionaryGetValue(dict, key);
+1
View File
@@ -11,6 +11,7 @@ const char* ffCfStrGetString(CFStringRef str, FFstrbuf* result);
const char* ffCfDictGetString(CFDictionaryRef dict, CFStringRef key, FFstrbuf* result);
const char* ffCfDictGetBool(CFDictionaryRef dict, CFStringRef key, bool* result);
const char* ffCfDictGetInt(CFDictionaryRef dict, CFStringRef key, int* result);
const char* ffCfDictGetInt64(CFDictionaryRef dict, CFStringRef key, int64_t* result);
const char* ffCfDictGetData(CFDictionaryRef dict, CFStringRef key, uint32_t offset, uint32_t size, uint8_t* result, uint32_t* length);
const char* ffCfDictGetDict(CFDictionaryRef dict, CFStringRef key, CFDictionaryRef* result);