From 5585f3a3a52b59ebd2fb543a7b9b0fc3a854821b Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Mon, 24 Aug 2009 18:04:21 +0000 Subject: Fixed Ruby typemaps so 64-bit values are handled correctly on 32-bit architectures. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@807323 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/bindings/qmf/ruby/ruby.i | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'cpp/bindings') diff --git a/cpp/bindings/qmf/ruby/ruby.i b/cpp/bindings/qmf/ruby/ruby.i index 8c2da1b494..b7fed403bd 100644 --- a/cpp/bindings/qmf/ruby/ruby.i +++ b/cpp/bindings/qmf/ruby/ruby.i @@ -38,7 +38,7 @@ %typemap (out) uint16_t { - $result = UINT2NUM((unsigned short) $1); + $result = UINT2NUM((uint16_t) $1); } %typemap (in) uint32_t @@ -51,7 +51,7 @@ %typemap (out) uint32_t { - $result = UINT2NUM((unsigned int) $1); + $result = UINT2NUM((uint32_t) $1); } %typemap (in) int32_t @@ -64,7 +64,7 @@ %typemap (out) int32_t { - $result = INT2NUM((int) $1); + $result = INT2NUM((int32_t) $1); } %typemap (typecheck, precedence=SWIG_TYPECHECK_INTEGER) uint32_t { @@ -73,25 +73,28 @@ %typemap (in) uint64_t { - $1 = NUM2ULONG ($input); + if (TYPE($input) == T_BIGNUM) + $1 = NUM2ULL($input); + else + $1 = (uint64_t) FIX2LONG($input); } %typemap (out) uint64_t { - $result = ULONG2NUM((long) $1); + $result = ULL2NUM((uint64_t) $1); } %typemap (in) int64_t { if (TYPE($input) == T_BIGNUM) - $1 = NUM2LONG($input); + $1 = NUM2LL($input); else - $1 = FIX2LONG($input); + $1 = (int64_t) FIX2LONG($input); } %typemap (out) int64_t { - $result = LONG2NUM((long) $1); + $result = LL2NUM((int64_t) $1); } %typemap (typecheck, precedence=SWIG_TYPECHECK_INTEGER) uint64_t { -- cgit v1.2.1