Author: rhs
Date: Mon Oct 15 00:37:13 2012
New Revision: 1398156

URL: http://svn.apache.org/viewvc?rev=1398156&view=rev
Log:
minor fixes to php bindings

Modified:
    qpid/proton/trunk/proton-c/bindings/php/php.i
    qpid/proton/trunk/proton-c/bindings/php/proton.php

Modified: qpid/proton/trunk/proton-c/bindings/php/php.i
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/php/php.i?rev=1398156&r1=1398155&r2=1398156&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/php/php.i (original)
+++ qpid/proton/trunk/proton-c/bindings/php/php.i Mon Oct 15 00:37:13 2012
@@ -136,6 +136,20 @@ ssize_t pn_sasl_send(pn_sasl_t *sasl, ch
 %}
 %ignore pn_message_encode;
 
+%rename(pn_message_save) wrap_pn_message_save;
+%inline %{
+    void wrap_pn_message_save(pn_message_t *message, size_t maxCount, char 
**OUTPUT_BUFFER, ssize_t *OUTPUT_LEN) {
+        *OUTPUT_BUFFER = emalloc(sizeof(char) * maxCount);
+        *OUTPUT_LEN = maxCount;
+        int err = pn_message_save(message, *OUTPUT_BUFFER, OUTPUT_LEN);
+        if (err) {
+          *OUTPUT_LEN = err;
+          efree(*OUTPUT_BUFFER);
+        }
+    }
+%}
+%ignore pn_message_save;
+
 %rename(pn_message_data) wrap_pn_message_data;
 // in PHP:  array = pn_message_data("binary message data", MAXLEN);
 //          array[0] = size || error code

Modified: qpid/proton/trunk/proton-c/bindings/php/proton.php
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/php/proton.php?rev=1398156&r1=1398155&r2=1398156&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/php/proton.php (original)
+++ qpid/proton/trunk/proton-c/bindings/php/proton.php Mon Oct 15 00:37:13 2012
@@ -402,7 +402,7 @@ class Message {
   }
 
   public function load($data) {
-    $this->_check(pn_message_load($this->impl, $data));
+    $this->_check(pn_message_load($this->impl, $data, strlen($data)));
   }
 
   public function save() {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to