Author: mcpierce Date: Tue Dec 18 19:08:59 2012 New Revision: 1423582 URL: http://svn.apache.org/viewvc?rev=1423582&view=rev Log: QPID-4416: Perl bindings fail on getContentPtr with null in the content
Contributed by Jimmy Jones <[email protected]> Modified: qpid/trunk/qpid/cpp/include/qpid/qpid.i Modified: qpid/trunk/qpid/cpp/include/qpid/qpid.i URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/qpid.i?rev=1423582&r1=1423581&r2=1423582&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/include/qpid/qpid.i (original) +++ qpid/trunk/qpid/cpp/include/qpid/qpid.i Tue Dec 18 19:08:59 2012 @@ -17,8 +17,33 @@ * under the License. */ +/* + * Need some magic to wrap getContentPtr, otherwise it could return char * + * containing NULL, which would be incorrectly interpreted as end of string + */ +%extend qpid::messaging::Message +{ + mystr getContentPtr() + { + mystr s; + s.ptr = self->getContentPtr(); + s.len = self->getContentSize(); + return s; + } +} +%ignore qpid::messaging::Message::getContentPtr; +%typemap(out,fragment="SWIG_FromCharPtrAndSize") (mystr) { + %append_output(SWIG_FromCharPtrAndSize($1.ptr, $1.len)); +} + %{ +struct mystr +{ + size_t len; + const char *ptr; +}; + #include <qpid/messaging/exceptions.h> #include <qpid/messaging/Address.h> #include <qpid/messaging/Connection.h> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
