This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/main by this push:
     new 48d19e567 PROTON-2820: [Ruby] Change mapping of pn_handle_t to intptr_t
48d19e567 is described below

commit 48d19e56729515c3b34f9b3964d83f5bbc5f9a38
Author: Andrew Stitcher <[email protected]>
AuthorDate: Thu May 2 17:37:39 2024 -0400

    PROTON-2820: [Ruby] Change mapping of pn_handle_t to intptr_t
    
    This avoids the swig conversion code from raising an error when the
    handle is an address that is a negative integer.
---
 c/include/proton/cproton.i | 6 +++---
 ruby/cproton.i             | 2 +-
 ruby/lib/util/wrapper.rb   | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/c/include/proton/cproton.i b/c/include/proton/cproton.i
index af109ae66..22d892158 100644
--- a/c/include/proton/cproton.i
+++ b/c/include/proton/cproton.i
@@ -26,10 +26,10 @@ typedef unsigned long int uint32_t;
 typedef long int int32_t;
 typedef unsigned long long int uint64_t;
 typedef long long int int64_t;
-#if UINTPTR_SIZE==8
-typedef unsigned long long int uintptr_t;
+#if INTPTR_SIZE==8
+typedef long long int intptr_t;
 #else
-typedef unsigned long int uintptr_t;
+typedef long int intptr_t;
 #endif
 
 /* Parse these interface header files to generate APIs for script languages */
diff --git a/ruby/cproton.i b/ruby/cproton.i
index ae2a7ef7b..ffd6f665a 100644
--- a/ruby/cproton.i
+++ b/ruby/cproton.i
@@ -56,7 +56,7 @@ Keep preprocessor directives and macro expansions in the 
normal header section.
 %}
 
 /* Treat pn_handle_t like uintptr_t - syntactically it is a C void* but really 
it's just an int */
-%apply uintptr_t { pn_handle_t };
+%apply intptr_t { pn_handle_t };
 
 %typemap(in) pn_bytes_t {
   if ($input == Qnil) {
diff --git a/ruby/lib/util/wrapper.rb b/ruby/lib/util/wrapper.rb
index e2f8592bb..50c9a33c4 100644
--- a/ruby/lib/util/wrapper.rb
+++ b/ruby/lib/util/wrapper.rb
@@ -111,7 +111,7 @@ module Qpid::Proton
         end
         return result
       end
-      RBCTX = self.hash.to_i
+      RBCTX = self.hash
     end
 
     # @private


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

Reply via email to