In working on the stable Ruby APIs on top of Swig I've hit an
interesting problem with this API.

The stable API for this is Qpid::Proton::get_message_data(msg, size)
and returns an array that is the size of the string and the string
itself, respectively. The swig wrapper currently is:

%rename (pn_message_save) wrap_pn_message_save;
%inline %{
  int wrap_pn_message_save(pn_message_t *msg, char *OUTPUT, size_t 
     ssize_t sz = pn_message_save(msg, OUTPUT, OUTPUT_SIZE);

     if (sz < 0) *OUTPUT_SIZE = 0; 
     return *OUTPUT_SIZE;
%ignore pn_message_save;

One test I've written is to generate random strings of various lengths,
throwing them at the message and then getting them back to verify they
were saved properly. And what I'm seeing happening is that, at certain
lengths (2 specifically), the APIs fail.

Initially, when the length hits either 129 or 257 bytes, the string
returned does not match the string submitted. If it gets past 129 then
it ALWAYS fails at 257 bytes. And if I tell it to ignore anything before
257 then it always fails at 513.

Not sure on first glance what's causing the problem.

Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.

Attachment: pgpj48KCcL9Ut.pgp
Description: PGP signature

Reply via email to