Fix bugs about C generator 58/195558/2
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 14 Dec 2018 08:21:58 +0000 (17:21 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 14 Dec 2018 08:21:58 +0000 (17:21 +0900)
This patch is to fix bugs about user-defined types.

Change-Id: I0478da6b617499ad3680b16057008cfce3327dad
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
idlc/c_gen/c_body_gen_base.cc
idlc/c_gen/c_header_gen_base.cc

index 00332cf7bfbac7387fb3b84725cceb25a4e62565..b744b493815ee96215ad705b894e2d50b17e0746 100644 (file)
@@ -241,9 +241,6 @@ void CBodyGeneratorBase::GenStructureGetter(std::ofstream& stream,
             return GetStructIdWithNamespace(st);
           },
           [&]()->std::string {
-            if (i->GetType().IsUserDefinedType())
-              return GetParcelParamTypeString(i->GetType());
-
             if (i->GetType().ToString() == "array")
               return GetStringFromElementType(i->GetType()) + "*";
 
@@ -265,7 +262,7 @@ void CBodyGeneratorBase::GenStructureGetter(std::ofstream& stream,
               std::string str;
               str += "!";
               str += i->GetID();
-              str += "|| ";
+              str += " || ";
               str += "!" + i->GetID() + "_size";
               return str;
             }
@@ -446,7 +443,7 @@ std::string CBodyGeneratorBase::GetParcelWriteString(const std::string& id,
       },
       [&]()->std::string {
         if (type.IsUserDefinedType())
-          return "&h->" + id + ", h->" + id;
+          return "&h->" + id + "->parcelable, h->" + id;
         if (type.ToString() == "list")
           return "g_list_length(h->" + id + ")";
         if (type.ToString() == "array")
@@ -661,7 +658,7 @@ std::string CBodyGeneratorBase::GetParcelReadString(const std::string& id,
         },
         [&]()->std::string {
           if (type.IsUserDefinedType())
-            return "&h->" + id + "h->" + id;
+            return "&h->" + id + "->parcelable, h->" + id;
           return "&h->" + id;
         });
   }
@@ -869,7 +866,8 @@ std::string CBodyGeneratorBase::GetGetterString(const std::string& id,
     }
 
     if (type.IsUserDefinedType()) {
-      str += GetSetterString(type, id, "h->" + id);
+      str += GetHandlePrefix() + GetFullNameFromType(type) +
+        "_clone(h->"+ id + ", " + id +");" + NLine(1);
     } else {
       str += GetSetterString(type, "*" + id, "h->" + id);
     }
index c726d2fef0238ba504675b4ff1c54458e42ada0e..ee86046d11531c8020d6031dbbaa78d43e177150 100644 (file)
@@ -185,9 +185,6 @@ void CHeaderGeneratorBase::GenStructureGetter(std::ofstream& stream,
           return GetStructIdWithNamespace(st);
         },
         [&]()->std::string {
-          if (i->GetType().IsUserDefinedType())
-            return GetParcelParamTypeString(i->GetType());
-
           if (i->GetType().ToString() == "array")
               return GetStringFromElementType(i->GetType()) + "*";