summaryrefslogtreecommitdiff
path: root/qpid/cpp/include
diff options
context:
space:
mode:
authorDarryl L. Pierce <mcpierce@apache.org>2012-12-18 19:08:59 +0000
committerDarryl L. Pierce <mcpierce@apache.org>2012-12-18 19:08:59 +0000
commit67f72ab698c8684af3a0e0a6f1c6e5f68ad60456 (patch)
treed3b3ff6807555183e31f3ac3f4c1f2af3ff1ce0c /qpid/cpp/include
parente49088b19e8e0a4e9ba9a1f172ab0987a2c51287 (diff)
downloadqpid-python-67f72ab698c8684af3a0e0a6f1c6e5f68ad60456.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@1423582 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/include')
-rw-r--r--qpid/cpp/include/qpid/qpid.i25
1 files changed, 25 insertions, 0 deletions
diff --git a/qpid/cpp/include/qpid/qpid.i b/qpid/cpp/include/qpid/qpid.i
index 7b3e898082..28a9064ebb 100644
--- a/qpid/cpp/include/qpid/qpid.i
+++ b/qpid/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>