From 40fc5798f331dbd258da05947ea4ff092640c17a Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Mon, 12 Mar 2018 18:02:46 +0900 Subject: [PATCH] Fix bug about generated type Change-Id: I18921881c0c9946ddfcf7bd1d625f2a0baf90d54 Signed-off-by: Junghoon Park --- idlc/c_gen/c_gen_base.cc | 8 ++++++-- idlc/c_gen/c_gen_base.h | 3 ++- idlc/c_gen/c_proxy_body_gen.cc | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/idlc/c_gen/c_gen_base.cc b/idlc/c_gen/c_gen_base.cc index 68368ee..1204f8f 100644 --- a/idlc/c_gen/c_gen_base.cc +++ b/idlc/c_gen/c_gen_base.cc @@ -104,7 +104,8 @@ std::string CGeneratorBase::GetFullNameFromType(const BaseType& type) { return str; } -std::string CGeneratorBase::GetParcelParamTypeString(const BaseType& type) { +std::string CGeneratorBase::GetParcelParamTypeString(const BaseType& type, + bool is_pointer) { if (type.IsUserDefinedType()) return "rpc_port_" + type.ToString() + "_h "; @@ -115,7 +116,10 @@ std::string CGeneratorBase::GetParcelParamTypeString(const BaseType& type) { if (type.ToString() == "string") return "char *"; - return type.ToString() + " *"; + if (is_pointer) + return type.ToString() + " *"; + + return type.ToString() + " "; } std::string CGeneratorBase::GetReturnTypeString(const BaseType& type) { diff --git a/idlc/c_gen/c_gen_base.h b/idlc/c_gen/c_gen_base.h index d5707af..4981162 100644 --- a/idlc/c_gen/c_gen_base.h +++ b/idlc/c_gen/c_gen_base.h @@ -55,7 +55,8 @@ class CGeneratorBase : public Generator { std::string ConvertTypeToString(ParameterType::Direction direction, const BaseType& type); std::string GetFullNameFromType(const BaseType& type); - std::string GetParcelParamTypeString(const BaseType& type); + std::string GetParcelParamTypeString(const BaseType& type, + bool is_pointer = true); std::string GetReturnTypeString(const BaseType& type); std::string GetParamTypeString(ParameterType::Direction direction, const BaseType& type); diff --git a/idlc/c_gen/c_proxy_body_gen.cc b/idlc/c_gen/c_proxy_body_gen.cc index 1e544e3..a03f4d9 100644 --- a/idlc/c_gen/c_proxy_body_gen.cc +++ b/idlc/c_gen/c_proxy_body_gen.cc @@ -227,9 +227,9 @@ void CProxyBodyGen::GenInterfaceDelegatorInvoker( int cnt = 0; for (auto& i : decl.GetParameters().GetParams()) { str += GetParcelParamTypeString( - i->GetParameterType().GetBaseType()) + + i->GetParameterType().GetBaseType(), false) + i->GetID() + ";" + NLine(1); - cnt++; + cnt++; } if (cnt > 0) str += NLine(1); -- 2.7.4