Skip to content

Commit

Permalink
Fix the warning get() operation on unique_ptr is extra (project-chip#…
Browse files Browse the repository at this point in the history
…31256)

* Fix the warning get() operation on unique_ptr is extra

* reformat code
  • Loading branch information
yufengwangca authored Jan 5, 2024
1 parent 4b3da13 commit 3a8b789
Show file tree
Hide file tree
Showing 2 changed files with 801 additions and 801 deletions.
4 changes: 2 additions & 2 deletions src/controller/java/templates/CHIPReadCallbacks-src.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallb
std::unique_ptr<CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallback, decltype(&maybeDestroy)> cppCallback(reinterpret_cast<CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallback *>(context), maybeDestroy);

// It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback.
javaCallbackRef = cppCallback.get()->javaCallbackRef;
javaCallbackRef = cppCallback->javaCallbackRef;
VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null"));

jmethodID javaMethod;
Expand All @@ -83,7 +83,7 @@ void CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallb
std::unique_ptr<CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallback, decltype(&maybeDestroy)> cppCallback(reinterpret_cast<CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallback *>(context), maybeDestroy);

// It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback.
javaCallbackRef = cppCallback.get()->javaCallbackRef;
javaCallbackRef = cppCallback->javaCallbackRef;
VerifyOrReturn(javaCallbackRef != nullptr, ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null"));

jmethodID javaMethod;
Expand Down
Loading

0 comments on commit 3a8b789

Please sign in to comment.