Skip to content

Commit

Permalink
Fix warnings in JSI (facebook#23201)
Browse files Browse the repository at this point in the history
Summary:
His PR is related to facebook#22609

There are still some warnings related to folly, but I plan to make the correction and send the PR to the repo of the folly.

Changelog:
[IOS][Changed] - Fix warning in JSCRuntime
Pull Request resolved: facebook#23201

Differential Revision: D13859393

Pulled By: cpojer

fbshipit-source-id: 95df2b76b28b460f890d11e1395fddb6b1cc8fed
  • Loading branch information
rafaellincoln authored and facebook-github-bot committed Jan 29, 2019
1 parent 8587ee2 commit 45ada81
Showing 1 changed file with 8 additions and 2 deletions.
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

0 comments on commit 45ada81

Please sign in to comment.