Skip to content

Commit

Permalink
PROTON-2820: [Ruby] Change mapping of pn_handle_t to intptr_t
Browse files Browse the repository at this point in the history
This avoids the swig conversion code from raising an error when the
handle is an address that is a negative integer.
  • Loading branch information
astitcher committed May 2, 2024
1 parent a2e9eb6 commit 48d19e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions c/include/proton/cproton.i
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion ruby/cproton.i
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion ruby/lib/util/wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def fetch_instance(impl, attachment_method = nil)
end
return result
end
RBCTX = self.hash.to_i
RBCTX = self.hash
end

# @private
Expand Down

0 comments on commit 48d19e5

Please sign in to comment.