diff options
| author | Darryl L. Pierce <mcpierce@apache.org> | 2012-12-18 19:08:59 +0000 |
|---|---|---|
| committer | Darryl L. Pierce <mcpierce@apache.org> | 2012-12-18 19:08:59 +0000 |
| commit | 234c4a2478d06e3e1cdb6701ed761dd8e9a4438c (patch) | |
| tree | 1f1a647a5bcf8c1f71b22fdeaef9c758c7d226a9 /cpp | |
| parent | 696d6d556d16717a717c21edba04ee9a1e47de16 (diff) | |
| download | qpid-python-234c4a2478d06e3e1cdb6701ed761dd8e9a4438c.tar.gz | |
QPID-4416: Perl bindings fail on getContentPtr with null in the content
Contributed by Jimmy Jones <jimmyjones2@gmx.co.uk>
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1423582 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
| -rw-r--r-- | cpp/include/qpid/qpid.i | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/cpp/include/qpid/qpid.i b/cpp/include/qpid/qpid.i index 7b3e898082..28a9064ebb 100644 --- a/cpp/include/qpid/qpid.i +++ b/cpp/include/qpid/qpid.i @@ -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> |
