gsoap 2.8.30 broke array serialization
Development toolkit for Web Services and XML data bindings for C & C++
Brought to you by:
engelen
Given this snippet:
struct user { unsigned int id; }; struct userArray { unsigned int __size; struct user *__ptr; };
as input to soapcpp2 -z1 test.h
, 2.8.22 and 2.8.30 generate different output. In particular, 2.8.22 walks through the array:
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_userArray(struct soap *soap, const struct userArray *a) { (void)soap; (void)a; /* appease -Wall -Werror */ #ifndef WITH_NOIDREF if (a->__ptr) { int i; for (i = 0; i < a->__size; i++) { soap_embedded(soap, a->__ptr + i, SOAP_TYPE_user); soap_serialize_user(soap, a->__ptr + i); } } #endif }
2.8.30 no longer does that.
SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_userArray(struct soap *soap, const struct userArray *a) { (void)soap; (void)a; /* appease -Wall -Werror */ #ifndef WITH_NOIDREF soap_serialize_PointerTouser(soap, &a->__ptr); #endif }
It appears I can work around it by changing to int
or size_t
, but gsoap changing behavior just like that is really bad :-(
You should not use
unsigned int
for the size (see databinding documentation, so the corrected definition is: