Fix a bug about delegate invoke method
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 21 Feb 2022 03:30:00 +0000 (12:30 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 21 Feb 2022 03:58:48 +0000 (12:58 +0900)
The first parcel data has to be <UPPERCASE_PREFIX>_<UPPERCASE_NAME>_METHOD_CALLBACK_.

Change-Id: If4bc8bc64eec007117fa7e3236655cf6608a1212
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
idlc/gen/c_stub_body_gen.cc
idlc/gen/c_stub_body_gen_cb.h

index 60e168a4192b28fde210cd280bc67f87a023ce5d..728017f7202349903c57c1b604bb216b8312c060 100644 (file)
@@ -368,6 +368,14 @@ void CStubBodyGen::GenInterfaceDelegateBase(std::ofstream& stream,
   code = ReplaceAll(code, "<DELEGATE_PARCEL_WRITE>",
       GenDelegateParcelWrite(iface, decl));
 
+  std::string prefix = GetHandlePrefix();
+  std::transform(prefix.begin(), prefix.end(), prefix.begin(), ::toupper);
+  code = ReplaceAll(code, "<UPPERCASE_PREFIX>", prefix);
+
+  std::string name = iface.GetID();
+  std::transform(name.begin(), name.end(), name.begin(), ::toupper);
+  code = ReplaceAll(code, "<UPPERCASE_NAME>", name);
+
   stream << SmartIndent(code);
 }
 
index d9dc5e4a8fb28018aff61dbfec4eb7112232bf83..6c63fb59abf470d84f90b15976b0efded0d2d194 100644 (file)
@@ -432,6 +432,8 @@ static void __<PREFIX>_<NAME>_remove_context(<PREFIX>_<NAME>_context_h context)
  * <DELEGATE_PARAMS_CHECK> The implementation to check whether arguments are nullptr or not
  * <DELEGATE_ENUM_VALUE> The enumeration value of the method.
  * <DELEGATE_PARCEL_WRITE> The implementation to write arguments to the parcel.
+ * <UPPERCASE_PREFIX> The uppercase prefix of the interface.
+ * <UPPERCASE_NAME> The uppercase name of the interface.
  */
 constexpr const char CB_INTERFACE_DELEGATE_BASE[] =
 R"__c_cb(
@@ -638,7 +640,7 @@ int <PREFIX>_<NAME>_<DELEGATE_NAME>_invoke(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h<D
     return ret_;
   }
 
-  rpc_port_parcel_write_int32(parcel_, <DELEGATE_ENUM_VALUE>);
+  rpc_port_parcel_write_int32(parcel_, <UPPERCASE_PREFIX>_<UPPERCASE_NAME>_METHOD_CALLBACK_);
 
   rpc_port_parcel_write(parcel_, &h->parcelable, h);