diff --git a/erpcgen/src/templates/c_coders.template b/erpcgen/src/templates/c_coders.template index 09d2b4d0..028bc1e7 100644 --- a/erpcgen/src/templates/c_coders.template +++ b/erpcgen/src/templates/c_coders.template @@ -3,13 +3,13 @@ uint32_t {$info.stringLocalName}_len; char * {$info.stringLocalName}_local; codec->readString(&{$info.stringLocalName}_len, &{$info.stringLocalName}_local); -{% if info.stringAllocSize != info.stringLocalName + "_len" %} +{% if info.stringAllocSize != info.stringLocalName & "_len" %} if ({$info.stringLocalName}_len <= {$info.stringAllocSize}) { {% set indent = " " >%} {% else %} {% set indent = "" >%} -{% endif -- if info.stringAllocSize != info.stringLocalName + "_len" %} +{% endif -- if info.stringAllocSize != info.stringLocalName & "_len" %} {% if ((source == "client" && info.withoutAlloc == false) or source == "server") %} {$indent}{$info.name} = ({$info.builtinTypeName}) erpc_malloc(({$info.stringAllocSize} + 1) * sizeof(char)); {% if generateAllocErrorChecks == true %} @@ -26,13 +26,13 @@ if ({$info.stringLocalName}_len <= {$info.stringAllocSize}) {% if (((source == "client" && info.withoutAlloc == false) or source == "server") && generateAllocErrorChecks == true) %} {$indent}} {% endif -- withoutAlloc && generateAllocErrorChecks %} -{% if info.stringAllocSize != info.stringLocalName + "_len" %} +{% if info.stringAllocSize != info.stringLocalName & "_len" %} } else { codec->updateStatus(kErpcStatus_InvalidArgument); } -{% endif -- if info.stringAllocSize != info.stringLocalName + "_len" %} +{% endif -- if info.stringAllocSize != info.stringLocalName & "_len" %} {% else %} {% if source == "client" && info.pointerScalarTypes %} codec->read({$info.name}); @@ -243,7 +243,7 @@ codec->readData({$info.name}, {$info.sizeTemp} * sizeof({$info.builtinTypeName}) {% def encodeBuiltinType(info) ----------------- %} {% if info.builtinType == "kStringType" %} uint32_t {$info.stringLocalName}_len = strlen((const char*){$info.name}); -{% if info.stringAllocSize != info.stringLocalName + "_len" %} +{% if info.stringAllocSize != info.stringLocalName & "_len" %} {% if source == "server" %} erpc_assert({$info.stringLocalName}_len <= {$info.stringAllocSize}); @@ -269,7 +269,7 @@ codec->write({$info.name}); {% def encodeBinaryType(info) ----------------- %} {% if info.size != info.maxSize %} {% if source == "server" %} -erpc_assert({$info.size} <= {$info.maxSize} * sizeof({$info.mallocSizeType})); +erpc_assert({$info.sizeTemp} <= {$info.maxSize} * sizeof({$info.mallocSizeType})); {% else %} if ({% if info.pointerScalarTypes %}*{% endif %}{$info.size} > {$info.maxSize})