Author: astitcher
Date: Fri Jun 27 20:23:28 2014
New Revision: 1606206

URL: http://svn.apache.org/r1606206
Log:
QPID-620: Remove unnecessary wrapped types from proton low level bindings

Modified:
    qpid/proton/trunk/proton-c/bindings/python/cproton.i
    qpid/proton/trunk/proton-c/bindings/ruby/ruby.i
    qpid/proton/trunk/proton-c/include/proton/cproton.i

Modified: qpid/proton/trunk/proton-c/bindings/python/cproton.i
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/python/cproton.i?rev=1606206&r1=1606205&r2=1606206&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/python/cproton.i (original)
+++ qpid/proton/trunk/proton-c/bindings/python/cproton.i Fri Jun 27 20:23:28 
2014
@@ -37,6 +37,12 @@
 %cstring_output_allocate_size(char **ALLOC_OUTPUT, size_t *ALLOC_SIZE, 
free(*$1));
 %cstring_output_maxsize(char *OUTPUT, size_t MAX_OUTPUT_SIZE)
 
+// These are not used/needed in the python binding
+%ignore pn_message_get_id;
+%ignore pn_message_set_id;
+%ignore pn_message_get_correlation_id;
+%ignore pn_message_set_correlation_id;
+
 %typemap(in) pn_bytes_t {
   if ($input == Py_None) {
     $1.start = NULL;
@@ -54,22 +60,30 @@
   $result = PyString_FromStringAndSize($1.start, $1.size);
 }
 
-%typemap(in) pn_decimal128_t {
-  memmove($1.bytes, PyString_AsString($input), 16);
-}
-
-%typemap(out) pn_decimal128_t {
-  $result = PyString_FromStringAndSize($1.bytes, 16);
+%typemap(out) pn_delivery_tag_t {
+  $result = PyString_FromStringAndSize($1.bytes, $1.size);
 }
 
 %typemap(in) pn_uuid_t {
-  memmove($1.bytes, PyString_AsString($input), 16);
+  memset($1.bytes, 0, 16);
+  if ($input == Py_None) {
+    ; // Already zeroed out
+  } else {
+    const char* b = PyString_AsString($input);
+    if (b) {
+        memmove($1.bytes, b, (PyString_Size($input) < 16 ? 
PyString_Size($input) : 16));
+    } else {
+        return NULL;
+    }
+  }
 }
 
 %typemap(out) pn_uuid_t {
   $result = PyString_FromStringAndSize($1.bytes, 16);
 }
 
+%apply pn_uuid_t { pn_decimal128_t };
+
 int pn_message_load(pn_message_t *msg, char *STRING, size_t LENGTH);
 %ignore pn_message_load;
 
@@ -156,8 +170,6 @@ ssize_t pn_transport_input(pn_transport_
 %}
 %ignore pn_delivery;
 
-// Suppress "Warning(451): Setting a const char * variable may leak memory." 
on pn_delivery_tag_t
-%warnfilter(451) pn_delivery_tag_t;
 %rename(pn_delivery_tag) wrap_pn_delivery_tag;
 %inline %{
   void wrap_pn_delivery_tag(pn_delivery_t *delivery, char **ALLOC_OUTPUT, 
size_t *ALLOC_SIZE) {

Modified: qpid/proton/trunk/proton-c/bindings/ruby/ruby.i
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/ruby/ruby.i?rev=1606206&r1=1606205&r2=1606206&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/ruby/ruby.i (original)
+++ qpid/proton/trunk/proton-c/bindings/ruby/ruby.i Fri Jun 27 20:23:28 2014
@@ -344,25 +344,4 @@ bool pn_ssl_get_cipher_name(pn_ssl_t *ss
 bool pn_ssl_get_protocol_name(pn_ssl_t *ssl, char *OUTPUT, size_t 
MAX_OUTPUT_SIZE);
 %ignore pn_ssl_get_protocol_name;
 
-%rename(pn_decimal128_t) Pn_decimal128_t;
-%ignore pn_decimal128_t;
-
-%rename(pn_uuid_t) Pn_uuid_t;
-%ignore pn_uuid_t;
-
-%rename(pn_bytes_t) Pn_bytes_t;
-%ignore pn_bytes_t;
-
-%rename(pn_class_t) Pn_class_t;
-%ignore pn_class_t;
-
-%rename(pn_atom_t) Pn_atom_t;
-%ignore pn_atom_t;
-
-%rename(pn_atom_t_u) Pn_atom_t_u;
-%ignore pn_atom_t_u;
-
-%rename(pn_delivery_tag_t) Pn_delivery_tag_t;
-%ignore pn_delivery_tag_t;
-
 %include "proton/cproton.i"

Modified: qpid/proton/trunk/proton-c/include/proton/cproton.i
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/cproton.i?rev=1606206&r1=1606205&r2=1606206&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/cproton.i (original)
+++ qpid/proton/trunk/proton-c/include/proton/cproton.i Fri Jun 27 20:23:28 2014
@@ -37,6 +37,16 @@ typedef long long int int64_t;
 /* There is no need to wrap pn_class_t aa it is an internal implementation 
detail and cannot be used outside the library */
 %ignore pn_class_t;
 
+/* Ignore C APIs related to pn_atom_t - they can all be achieved with 
pn_data_t */
+%ignore pn_atom_t;
+%ignore pn_atom_t_u; /* Seem to need this even though its nested in pn_atom_t 
*/
+%ignore pn_data_get_atom;
+%ignore pn_data_put_atom;
+
+%ignore pn_delivery_tag_t;
+%ignore pn_decimal128_t;
+%ignore pn_uuid_t;
+
 %include "proton/types.h"
 %ignore pn_string_vformat;
 %ignore pn_string_vaddf;



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

Reply via email to