iOS: fix add version judgment for JSTypedArray API
This commit is contained in:
parent
7a126531af
commit
e6bdc3d819
@ -123,12 +123,14 @@ static id containerValueToObject(JSGlobalContextRef context, JSContainerConverto
|
|||||||
}
|
}
|
||||||
|
|
||||||
JSObjectRef object = JSValueToObject(context, value, 0);
|
JSObjectRef object = JSValueToObject(context, value, 0);
|
||||||
JSTypedArrayType type = JSValueGetTypedArrayType(context, value, NULL);
|
if (@available(iOS 10.0, *)) {
|
||||||
if (type == kJSTypedArrayTypeArrayBuffer) {
|
JSTypedArrayType type = JSValueGetTypedArrayType(context, value, NULL);
|
||||||
size_t size = JSObjectGetArrayBufferByteLength(context, object, NULL);
|
if (type == kJSTypedArrayTypeArrayBuffer) {
|
||||||
void *ptr = JSObjectGetArrayBufferBytesPtr(context, object, NULL);
|
size_t size = JSObjectGetArrayBufferByteLength(context, object, NULL);
|
||||||
id primitive = [[NSData alloc] initWithBytesNoCopy:ptr length:size freeWhenDone:NO];
|
void *ptr = JSObjectGetArrayBufferBytesPtr(context, object, NULL);
|
||||||
return {value, primitive, ContainerNone};
|
id primitive = [[NSData alloc] initWithBytesNoCopy:ptr length:size freeWhenDone:NO];
|
||||||
|
return {value, primitive, ContainerNone};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (JSValueIsArray(context, value))
|
if (JSValueIsArray(context, value))
|
||||||
return {object, [NSMutableArray array], ContainerArray};
|
return {object, [NSMutableArray array], ContainerArray};
|
||||||
|
Reference in New Issue
Block a user