From 9f9d0f87a03b881d6133338b7f085b661832950f Mon Sep 17 00:00:00 2001 From: Edouard Tisserant Date: Tue, 14 Jun 2016 11:35:46 +0200 Subject: [PATCH] Fixing crash when calling encrypt on message with outgoing color known as grey (continued). --- src/gen_cpp_Engine.ysl2 | 59 ++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/src/gen_cpp_Engine.ysl2 b/src/gen_cpp_Engine.ysl2 index 915bcd6..a009bf6 100644 --- a/src/gen_cpp_Engine.ysl2 +++ b/src/gen_cpp_Engine.ysl2 @@ -42,14 +42,7 @@ tstylesheet { || apply "parm[in]", mode=in; - choose { - when "count(parm[returns|creates]) > 1" { - apply "parm[creates|returns]", mode=out - } - when "count(parm[returns|creates]) = 1" { - apply "parm[creates|returns]", mode=out with "name", "'result'"; - } - } + apply "parm[creates|returns]", mode=out; || PEP_STATUS status = ::«@name»(session`apply "parm", mode=call`); @@ -75,33 +68,38 @@ tstylesheet { apply "parm[returns|creates]", mode=setresult with "jtype" > org/pEp/jniadapter/Engine$_«@name»_Return + + || + return result_; + || } - when "count(parm[returns|creates]) = 1" choose { - when "ancestor::namespace/child::enum[@name=$rettype]" apply "parm[returns|creates]", mode=return { - with "name", "'result'"; - with "jtype", "$jtype"; - with "jnitype", "'jint'"; - with "sig", "'(I)V'"; - } + when "count(parm[returns|creates]) = 1" { + choose { + when "ancestor::namespace/child::enum[@name=$rettype]" apply "parm[returns|creates]", mode=return { + with "jtype", "$jtype"; + with "jnitype", "'jint'"; + with "sig", "'(I)V'"; + } - when "$rettype = 'message'" apply "parm[returns|creates]", mode=return { - with "name", "'result'"; - with "jtype", "$jtype"; - with "jnitype", "'jlong'"; - with "sig", "'(J)V'"; - } + when "$rettype = 'message'" apply "parm[returns|creates]", mode=return { + with "jtype", "$jtype"; + with "jnitype", "'jlong'"; + with "sig", "'(J)V'"; + } - when "$rettype = 'stringlist'" apply "parm[returns|creates]", mode=return{ - with "name", "'result'"; + when "$rettype = 'stringlist'" apply "parm[returns|creates]", mode=return; + + otherwise error | # not implemented: return type "«$rettype»"; } - otherwise error | # not implemented: return type "«$rettype»" + || + return «name(parm[returns|creates]/*[3])»_; + || } } || - return result_; } || @@ -189,8 +187,9 @@ tstylesheet { otherwise { | jobject «$name»_ = NULL; indent(0); + if "$retname != 'result'" > if (_«$retname») + > {\n || - if (_«$retname») { jclass clazz_«$name»_ = findClass(env, "org/pEp/jniadapter/«$jtype»"); assert(clazz_«$name»_); jmethodID constructor_«$name»_ = env->GetMethodID(clazz_«$name»_, "", "«$sig»"); @@ -247,13 +246,7 @@ tstylesheet { when "$dir = 'Cconst'" value "*[3]"; when "$dir = 'creates' or $dir = 'returns'" { - > & - choose { - when "count(../parm[returns|creates]) = 1" - > _result - otherwise - > _«$name» - } + > &_«$name» } otherwise { > _«$name»