Fix a bug about C generator 89/197089/2
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 9 Jan 2019 10:41:20 +0000 (19:41 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 9 Jan 2019 10:42:38 +0000 (19:42 +0900)
Change-Id: I4a303e54934ee37180b92d9c33844739c3b1973f
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
idlc/c_gen/c_body_gen_base.cc
idlc/c_gen/c_body_gen_base_cb.h

index b744b49..8f8cde2 100644 (file)
@@ -651,6 +651,11 @@ std::string CBodyGeneratorBase::GetParcelReadString(const std::string& id,
           s += GetSetterString("h->" + id + "[i]", "value");
           return s;
         });
+  } else if (type.IsUserDefinedType()) {
+    str += GenTemplateString(ReplaceAll(CB_READ_USER_DEFINED_BLOCK, "##", id),
+        [&]()->std::string {
+          return GetFullNameFromType(type);
+        });
   } else {
     str += GenTemplateString(parcel,
         [&]()->std::string {
index a27cc54..a9d7ef1 100644 (file)
@@ -257,6 +257,18 @@ do {
 } while (0);
 )__c_cb";
 
+const char CB_READ_USER_DEFINED_BLOCK[] =
+R"__c_cb(do {
+    rpc_port_$$_create(&h->##);
+    if (!h->##) {
+        _E("Failed to create handle");
+        return;
+    }
+
+    rpc_port_parcel_read(parcel, &h->##->parcelable, h->##);
+} while (0);
+)__c_cb";
+
 const char CB_FINALIZE_LIST_BLOCK[] =
 R"__c_cb(
 do {