Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings in JSI #23201

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions ReactCommon/jsi/JSCRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,16 @@ jsi::Object JSCRuntime::createObject(std::shared_ptr<jsi::HostObject> ho) {
}
return rt.valueRef(ret);
}

#define JSC_UNUSED(x) (void) (x);

static bool setProperty(
JSContextRef ctx,
JSObjectRef object,
JSStringRef propName,
JSValueRef value,
JSValueRef* exception) {
JSC_UNUSED(ctx);
auto proxy = static_cast<HostObjectProxy*>(JSObjectGetPrivate(object));
auto& rt = proxy->runtime;
jsi::PropNameID sym = rt.createPropNameID(propName);
Expand Down Expand Up @@ -612,13 +615,16 @@ jsi::Object JSCRuntime::createObject(std::shared_ptr<jsi::HostObject> ho) {
JSContextRef ctx,
JSObjectRef object,
JSPropertyNameAccumulatorRef propertyNames) noexcept {
JSC_UNUSED(ctx);
auto proxy = static_cast<HostObjectProxy*>(JSObjectGetPrivate(object));
auto& rt = proxy->runtime;
auto names = proxy->hostObject->getPropertyNames(rt);
for (auto& name : names) {
JSPropertyNameAccumulatorAddName(propertyNames, stringRef(name));
}
}

#undef JSC_UNUSED

static void finalize(JSObjectRef obj) {
auto hostObject = static_cast<HostObjectProxy*>(JSObjectGetPrivate(obj));
Expand Down Expand Up @@ -818,7 +824,7 @@ size_t JSCRuntime::size(const jsi::Array& arr) {

jsi::Value JSCRuntime::getValueAtIndex(const jsi::Array& arr, size_t i) {
JSValueRef exc = nullptr;
auto res = JSObjectGetPropertyAtIndex(ctx_, objectRef(arr), i, &exc);
auto res = JSObjectGetPropertyAtIndex(ctx_, objectRef(arr), (int)i, &exc);
checkException(exc);
return createValue(res);
}
Expand All @@ -828,7 +834,7 @@ void JSCRuntime::setValueAtIndexImpl(
size_t i,
const jsi::Value& value) {
JSValueRef exc = nullptr;
JSObjectSetPropertyAtIndex(ctx_, objectRef(arr), i, valueRef(value), &exc);
JSObjectSetPropertyAtIndex(ctx_, objectRef(arr), (int)i, valueRef(value), &exc);
checkException(exc);
}

Expand Down