The undefined number of element value of serial _array_start

is now (size_t)-1 and no longer 0.
Moreoever, a serialization interface may refuse outputting data
if it doesn't know the number of elements.
In which case, the container shall explictly compute the number
of elements and recall the serial object _array_start method.
This commit is contained in:
Patrick Pelissier committed 2023-04-27 00:01:50 +02:00
1 parent a913d0947c
commit 0a39a17d36
3 files changed
+10 -4

No files matched your search

+5 -1
View File
@@ -789,7 +789,11 @@
m_serial_return_code_t ret; \
m_serial_local_t local; \
bool first_done = false; \
ret = f->m_interface->write_array_start(local, f, 0); \
ret = f->m_interface->write_array_start(local, f, (size_t)-1); \
if (ret == M_SERIAL_FAIL_RETRY) { \
size_t n = M_F(name, _size)(list); \
ret = f->m_interface->write_array_start(local, f, n); \
} \
it_t it; \
for (M_F(name, _it)(it, list) ; \
!M_F(name, _end_p)(it); \