Skip to content

Commit c66f97a

Browse files
Merge pull request #240 from ACRIOS-Systems/bugfix/generating_struct_methods
Fixed serialization of list/binary types
2 parents e3ae201 + 0ac5c86 commit c66f97a

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

erpcgen/src/CGenerator.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,12 @@ DataType *CGenerator::findChildDataType(set<DataType *> &dataTypes, DataType *da
329329

330330
if (isBinaryStruct(structType) || isListStruct(structType))
331331
{
332+
DataType *memberDataType = structType->getMembers()[0]->getDataType();
333+
if (memberDataType->isList())
334+
{
335+
ListType *memberListDataType = dynamic_cast<ListType *>(memberDataType);
336+
findChildDataType(dataTypes, memberListDataType->getElementType());
337+
}
332338
break;
333339
}
334340

erpcgen/test/test_struct.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ test_client.cpp:
3232
- static void write_A_struct(erpc::Codec * codec, const A * data)
3333
test_server.cpp:
3434
- static void read_A_struct(erpc::Codec * codec, A * data)
35+
3536
---
3637
name: return list struct
3738
idl: |
@@ -52,6 +53,7 @@ test_server.cpp:
5253
- read_list_int32_1_t_struct
5354
- write_list_int32_1_t_struct
5455
- free_list_int32_1_t_struct
56+
5557
---
5658
name: binary struct c
5759
idl: |
@@ -75,6 +77,41 @@ test_client.cpp:
7577
- write_binary_t_struct
7678
- write_Vector_struct
7779
- not: read
80+
81+
---
82+
name: in out binary struct c
83+
idl: |
84+
struct Vector {
85+
list<binary> i
86+
}
87+
88+
interface I {
89+
foo(Vector a) -> void
90+
bar() -> Vector
91+
}
92+
test.h:
93+
- typedef struct binary_t binary_t;
94+
- typedef struct Vector Vector;
95+
- struct binary_t
96+
- struct Vector
97+
test_server.cpp:
98+
- read_Vector_struct
99+
- read_binary_t_struct
100+
- read_list_binary_1_t_struct
101+
- write_Vector_struct
102+
- write_binary_t_struct
103+
- write_list_binary_1_t_struct
104+
- free_Vector_struct
105+
- free_binary_t_struct
106+
- free_list_binary_1_t_struct
107+
test_client.cpp:
108+
- write_Vector_struct
109+
- write_binary_t_struct
110+
- write_list_binary_1_t_struct
111+
- read_Vector_struct
112+
- read_binary_t_struct
113+
- read_list_binary_1_t_struct
114+
78115
---
79116
name: binary struct py
80117
lang: py
@@ -89,4 +126,4 @@ idl: |
89126
test/common.py:
90127
- class Vector
91128
- def _read
92-
- def _write
129+
- def _write

0 commit comments

Comments
 (0)