qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [19/24] qpid-proton git commit: PROTON-883: Wrap pn_transport_peek for Ruby.
Date Fri, 22 May 2015 19:45:42 GMT
PROTON-883: Wrap pn_transport_peek for Ruby.

Returns an array consisting of the number of bytes returned an a String
packed with the bytes in the buffer.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/585b306b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/585b306b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/585b306b

Branch: refs/heads/go1
Commit: 585b306bd22f500cdfc268c759ed2b9c7738940e
Parents: ff159e8
Author: Darryl L. Pierce <mcpierce@gmail.com>
Authored: Mon May 11 10:01:46 2015 -0400
Committer: Darryl L. Pierce <mcpierce@gmail.com>
Committed: Tue May 19 08:06:49 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/ruby.i | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/585b306b/proton-c/bindings/ruby/ruby.i
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/ruby.i b/proton-c/bindings/ruby/ruby.i
index e0ffb17..7380068 100644
--- a/proton-c/bindings/ruby/ruby.i
+++ b/proton-c/bindings/ruby/ruby.i
@@ -273,6 +273,20 @@ ssize_t pn_transport_input(pn_transport_t *transport, char *STRING, size_t
LENGT
 %}
 %ignore pn_transport_output;
 
+%rename(pn_transport_peek) wrap_pn_transport_peek;
+%inline %{
+  int wrap_pn_transport_peek(pn_transport_t *transport, char *OUTPUT, size_t *OUTPUT_SIZE)
{
+    ssize_t sz = pn_transport_peek(transport, OUTPUT, OUTPUT_SIZE);
+    if(sz >= 0) {
+      *OUTPUT_SIZE = sz;
+    } else {
+      *OUTPUT_SIZE = 0;
+    }
+    return sz;
+  }
+%}
+%ignore pn_transport_peek;
+
 %rename(pn_delivery) wrap_pn_delivery;
 %inline %{
   pn_delivery_t *wrap_pn_delivery(pn_link_t *link, char *STRING, size_t LENGTH) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message