ext/cproton/cproton.c in qpid_proton-0.33.0 vs ext/cproton/cproton.c in qpid_proton-0.34.0

- old
+ new

@@ -1,8 +1,8 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.12 + * Version 4.0.1 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. @@ -305,10 +305,11 @@ #endif /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 +#define SWIG_POINTER_NO_NULL 0x4 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -943,10 +944,13 @@ # define RSTRUCT_LEN(x) RSTRUCT(x)->len #endif #ifndef RSTRUCT_PTR # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr #endif +#ifndef RTYPEDDATA_P +# define RTYPEDDATA_P(x) (TYPE(x) != T_DATA) +#endif /* * Need to be very careful about how these macros are defined, especially @@ -959,30 +963,22 @@ * VOIDFUNC(f) is a macro used to typecast a C function that implements * either the "mark" or "free" stuff for a Ruby Data object, so that it * can be passed as an argument to API functions like Data_Wrap_Struct() * and Data_Make_Struct(). */ - -#ifdef __cplusplus -# ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */ -# define PROTECTFUNC(f) ((VALUE (*)()) f) -# define VALUEFUNC(f) ((VALUE (*)()) f) -# define VOIDFUNC(f) ((void (*)()) f) -# else -# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */ -# define PROTECTFUNC(f) ((VALUE (*)()) f) -# define VALUEFUNC(f) ((VALUE (*)()) f) -# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) -# else /* These definitions should work for Ruby 1.7+ */ -# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f) -# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f) -# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) -# endif -# endif +#if defined(__cplusplus) && !defined(RB_METHOD_DEFINITION_DECL) +# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f) +# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f) +# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) +# define VOID_ANYARGS_FUNC(f) ((void (*)(ANYARGS))(f)) +# define INT_ANYARGS_FUNC(f) ((int (*)(ANYARGS))(f)) #else +# define PROTECTFUNC(f) (f) # define VALUEFUNC(f) (f) # define VOIDFUNC(f) (f) +# define VOID_ANYARGS_FUNC(f) (f) +# define INT_ANYARGS_FUNC(f) (f) #endif /* Don't use for expressions have side effect */ #ifndef RB_STRING_VALUE #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s))) @@ -1166,11 +1162,11 @@ } /* ----------------------------------------------------------------------------- * rubytracking.swg * - * This file contains support for tracking mappings from + * This file contains support for tracking mappings from * Ruby objects to C++ objects. This functionality is needed * to implement mark functions for Ruby's mark and sweep * garbage collector. * ----------------------------------------------------------------------------- */ @@ -1193,25 +1189,25 @@ #else # error sizeof(void*) is not the same as long or long long #endif /* Global hash table to store Trackings from C/C++ - structs to Ruby Objects. + structs to Ruby Objects. */ static st_table* swig_ruby_trackings = NULL; -static VALUE swig_ruby_trackings_count(ANYARGS) { +static VALUE swig_ruby_trackings_count(ID id, VALUE *var) { return SWIG2NUM(swig_ruby_trackings->num_entries); } /* Setup a hash table to store Trackings */ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) { /* Create a hash table to store Trackings from C++ objects to Ruby objects. */ - /* Try to see if some other .so has already created a + /* Try to see if some other .so has already created a tracking hash table, which we keep hidden in an instance var in the SWIG module. This is done to allow multiple DSOs to share the same tracking table. */ @@ -1234,11 +1230,11 @@ rb_ivar_set( _mSWIG, trackings_id, SWIG2NUM(swig_ruby_trackings) ); } else { swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value); } - rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", swig_ruby_trackings_count, NULL); + rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", VALUEFUNC(swig_ruby_trackings_count), VOID_ANYARGS_FUNC((rb_gvar_setter_t*)NULL)); } /* Add a Tracking from a C/C++ struct to a Ruby object */ SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) { /* Store the mapping to the global hash table. */ @@ -1266,33 +1262,34 @@ st_delete(swig_ruby_trackings, (st_data_t *)&ptr, NULL); } /* This is a helper method that unlinks a Ruby object from its underlying C++ object. This is needed if the lifetime of the - Ruby object is longer than the C++ object */ + Ruby object is longer than the C++ object. */ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) { VALUE object = SWIG_RubyInstanceFor(ptr); if (object != Qnil) { - if (TYPE(object) != T_DATA) - abort(); + // object might have the T_ZOMBIE type, but that's just + // because the GC has flagged it as such for a deferred + // destruction. Until then, it's still a T_DATA object. DATA_PTR(object) = 0; } } /* This is a helper method that iterates over all the trackings passing the C++ object pointer and its related Ruby object to the passed callback function. */ /* Proxy method to abstract the internal trackings datatype */ -static int swig_ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) { - (*meth)(ptr, obj); +static int swig_ruby_internal_iterate_callback(st_data_t ptr, st_data_t obj, st_data_t meth) { + ((void (*) (void *, VALUE))meth)((void *)ptr, (VALUE)obj); return ST_CONTINUE; } SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) { - st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&swig_ruby_internal_iterate_callback, (st_data_t)meth); + st_foreach(swig_ruby_trackings, INT_ANYARGS_FUNC(swig_ruby_internal_iterate_callback), (st_data_t)meth); } #ifdef __cplusplus } #endif @@ -1505,22 +1502,23 @@ int track; char *klass_name; swig_class *sklass; VALUE klass; VALUE obj; - + if (!ptr) return Qnil; - + + assert(type); if (type->clientdata) { sklass = (swig_class *) type->clientdata; /* Are we tracking this class and have we already returned this Ruby object? */ track = sklass->trackObjects; if (track) { obj = SWIG_RubyInstanceFor(ptr); - + /* Check the object's type and make sure it has the correct type. It might not in cases where methods do things like downcast methods. */ if (obj != Qnil) { VALUE value = rb_iv_get(obj, "@__swigtype__"); @@ -1548,11 +1546,11 @@ klass = rb_const_get(_mSWIG, rb_intern(klass_name)); free((void *) klass_name); obj = Data_Wrap_Struct(klass, 0, 0, ptr); } rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name)); - + return obj; } /* Create a new class instance (always owned) */ SWIGRUNTIME VALUE @@ -1580,11 +1578,11 @@ } swig_ruby_owntype; SWIGRUNTIME swig_ruby_owntype SWIG_Ruby_AcquirePtr(VALUE obj, swig_ruby_owntype own) { swig_ruby_owntype oldown = {0, 0}; - if (obj) { + if (TYPE(obj) == T_DATA && !RTYPEDDATA_P(obj)) { oldown.datafree = RDATA(obj)->dfree; RDATA(obj)->dfree = own.datafree; } return oldown; } @@ -1599,13 +1597,13 @@ /* Grab the pointer */ if (NIL_P(obj)) { if (ptr) *ptr = 0; - return SWIG_OK; + return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; } else { - if (TYPE(obj) != T_DATA) { + if (TYPE(obj) != T_DATA || (TYPE(obj) == T_DATA && RTYPEDDATA_P(obj))) { return SWIG_ERROR; } Data_Get_Struct(obj, void, vptr); } @@ -1696,11 +1694,11 @@ r = SWIG_PackData(r, ptr, sz); strcpy(r, type->name); return rb_str_new2(result); } -/* Convert a packed value value */ +/* Convert a packed pointer value */ SWIGRUNTIME int SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) { swig_cast_info *tc; const char *c; @@ -1884,11 +1882,11 @@ #define SWIG_RUBY_THREAD_BEGIN_BLOCK #define SWIG_RUBY_THREAD_END_BLOCK -#define SWIGVERSION 0x030012 +#define SWIGVERSION 0x040001 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) (void *)((const void *)(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) @@ -1913,19 +1911,20 @@ # define RSTRING_PTR(x) (RSTRING(x)->ptr) #endif SWIGINTERN VALUE -SWIG_ruby_failed(void) +SWIG_ruby_failed(VALUE SWIGUNUSEDPARM(arg1), VALUE SWIGUNUSEDPARM(arg2)) { return Qnil; } -/*@SWIG:/usr/share/swig/3.0.12/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ -SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args) +/*@SWIG:/usr/share/swig/4.0.1/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE arg) { + VALUE *args = (VALUE *)arg; VALUE obj = args[0]; VALUE type = TYPE(obj); unsigned long *res = (unsigned long *)(args[1]); *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj); return obj; @@ -1939,11 +1938,11 @@ if ((type == T_FIXNUM) || (type == T_BIGNUM)) { unsigned long v; VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } } return SWIG_TypeError; @@ -1964,13 +1963,14 @@ # define SWIG_LONG_LONG_AVAILABLE #endif #ifdef SWIG_LONG_LONG_AVAILABLE -/*@SWIG:/usr/share/swig/3.0.12/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ -SWIGINTERN VALUE SWIG_AUX_NUM2ULL(VALUE *args) +/*@SWIG:/usr/share/swig/4.0.1/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2ULL(VALUE arg) { + VALUE *args = (VALUE *)arg; VALUE obj = args[0]; VALUE type = TYPE(obj); long long *res = (long long *)(args[1]); *res = type == T_FIXNUM ? NUM2ULL(obj) : rb_big2ull(obj); return obj; @@ -1984,11 +1984,11 @@ if ((type == T_FIXNUM) || (type == T_BIGNUM)) { unsigned long long v; VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } } return SWIG_TypeError; @@ -2294,13 +2294,14 @@ return result; } -/*@SWIG:/usr/share/swig/3.0.12/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ -SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args) +/*@SWIG:/usr/share/swig/4.0.1/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE arg) { + VALUE *args = (VALUE *)arg; VALUE obj = args[0]; VALUE type = TYPE(obj); long *res = (long *)(args[1]); *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj); return obj; @@ -2314,11 +2315,11 @@ if ((type == T_FIXNUM) || (type == T_BIGNUM)) { long v; VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } } return SWIG_TypeError; @@ -2570,11 +2571,11 @@ /* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */ #ifndef SWIG_isfinite /* isfinite() is a macro for C99 */ # if defined(isfinite) # define SWIG_isfinite(X) (isfinite(X)) -# elif defined __cplusplus && __cplusplus >= 201103L +# elif defined(__cplusplus) && __cplusplus >= 201103L /* Use a template so that this works whether isfinite() is std::isfinite() or * in the global namespace. The reality seems to vary between compiler * versions. * * Make sure namespace std exists to avoid compiler warnings. @@ -2586,10 +2587,16 @@ inline int SWIG_isfinite_func(T x) { using namespace std; return isfinite(x); } # define SWIG_isfinite(X) (SWIG_isfinite_func(X)) +# elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) +# define SWIG_isfinite(X) (__builtin_isfinite(X)) +# elif defined(__clang__) && defined(__has_builtin) +# if __has_builtin(__builtin_isfinite) +# define SWIG_isfinite(X) (__builtin_isfinite(X)) +# endif # elif defined(_MSC_VER) # define SWIG_isfinite(X) (_finite(X)) # elif defined(__sun) && defined(__SVR4) # include <ieeefp.h> # define SWIG_isfinite(X) (finite(X)) @@ -2603,13 +2610,14 @@ #else # define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX)) #endif -/*@SWIG:/usr/share/swig/3.0.12/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ -SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args) +/*@SWIG:/usr/share/swig/4.0.1/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE arg) { + VALUE *args = (VALUE *)arg; VALUE obj = args[0]; VALUE type = TYPE(obj); double *res = (double *)(args[1]); *res = NUM2DBL(obj); (void)type; return obj; @@ -2623,11 +2631,11 @@ if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) { double v; VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2DBL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } } return SWIG_TypeError; @@ -2692,13 +2700,14 @@ return res; } #ifdef SWIG_LONG_LONG_AVAILABLE -/*@SWIG:/usr/share/swig/3.0.12/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ -SWIGINTERN VALUE SWIG_AUX_NUM2LL(VALUE *args) +/*@SWIG:/usr/share/swig/4.0.1/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2LL(VALUE arg) { + VALUE *args = (VALUE *)arg; VALUE obj = args[0]; VALUE type = TYPE(obj); long long *res = (long long *)(args[1]); *res = type == T_FIXNUM ? NUM2LL(obj) : rb_big2ll(obj); return obj; @@ -2712,11 +2721,11 @@ if ((type == T_FIXNUM) || (type == T_BIGNUM)) { long long v; VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } } return SWIG_TypeError; @@ -19627,19 +19636,19 @@ set up already */ if (init == 0) return; /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: size %d\n", swig_module.size); + printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); @@ -19711,11 +19720,11 @@ #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } @@ -19828,11 +19837,11 @@ rb_define_module_function(mCproton, "pni_connection_driver_transport", _wrap_pni_connection_driver_transport, -1); rb_define_module_function(mCproton, "pni_connection_driver_read_copy", _wrap_pni_connection_driver_read_copy, -1); rb_define_module_function(mCproton, "pni_connection_driver", _wrap_pni_connection_driver, -1); rb_define_const(mCproton, "PROTON_IMPORT_EXPORT_H", SWIG_From_int((int)(1))); rb_define_const(mCproton, "PN_VERSION_MAJOR", SWIG_From_int((int)(0))); - rb_define_const(mCproton, "PN_VERSION_MINOR", SWIG_From_int((int)(33))); + rb_define_const(mCproton, "PN_VERSION_MINOR", SWIG_From_int((int)(34))); rb_define_const(mCproton, "PN_VERSION_POINT", SWIG_From_int((int)(0))); rb_define_const(mCproton, "PROTON_TYPES_H", SWIG_From_int((int)(1))); rb_define_const(mCproton, "PN_MILLIS_MAX", SWIG_From_unsigned_SS_int((unsigned int)((~0U)))); rb_define_module_function(mCproton, "pn_bytes", _wrap_pn_bytes, -1); rb_define_singleton_method(mCproton, "pn_bytes_null", _wrap_pn_bytes_null_get, 0); @@ -20278,9 +20287,10 @@ rb_define_const(mCproton, "PN_RAW_CONNECTION_NEED_READ_BUFFERS", SWIG_From_int((int)(PN_RAW_CONNECTION_NEED_READ_BUFFERS))); rb_define_const(mCproton, "PN_RAW_CONNECTION_NEED_WRITE_BUFFERS", SWIG_From_int((int)(PN_RAW_CONNECTION_NEED_WRITE_BUFFERS))); rb_define_const(mCproton, "PN_RAW_CONNECTION_READ", SWIG_From_int((int)(PN_RAW_CONNECTION_READ))); rb_define_const(mCproton, "PN_RAW_CONNECTION_WRITTEN", SWIG_From_int((int)(PN_RAW_CONNECTION_WRITTEN))); rb_define_const(mCproton, "PN_RAW_CONNECTION_WAKE", SWIG_From_int((int)(PN_RAW_CONNECTION_WAKE))); + rb_define_const(mCproton, "PN_RAW_CONNECTION_DRAIN_BUFFERS", SWIG_From_int((int)(PN_RAW_CONNECTION_DRAIN_BUFFERS))); rb_define_module_function(mCproton, "pn_event_type_name", _wrap_pn_event_type_name, -1); rb_define_module_function(mCproton, "pn_collector", _wrap_pn_collector, -1); rb_define_module_function(mCproton, "pn_collector_free", _wrap_pn_collector_free, -1); rb_define_module_function(mCproton, "pn_collector_release", _wrap_pn_collector_release, -1); rb_define_module_function(mCproton, "pn_collector_drain", _wrap_pn_collector_drain, -1);