diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-11 12:52:49 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-11 12:52:49 -0500 |
commit | ef7a60860d18e9be343b6fa5fe8d76fd080cead0 (patch) | |
tree | 640a3f17c9f0e1d133b05f1eb434d13057a78e8d /korundum/rubylib/korundum/Korundum.cpp | |
parent | 46659f992d49f86347c43528a8705657b6896cb7 (diff) | |
download | tdebindings-ef7a60860d18e9be343b6fa5fe8d76fd080cead0.tar.gz tdebindings-ef7a60860d18e9be343b6fa5fe8d76fd080cead0.zip |
Fix FTBS on ruby 1.9.x
Thanks to Darrell Anderson for the majority of the patch!
Diffstat (limited to 'korundum/rubylib/korundum/Korundum.cpp')
-rw-r--r-- | korundum/rubylib/korundum/Korundum.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/korundum/rubylib/korundum/Korundum.cpp b/korundum/rubylib/korundum/Korundum.cpp index cc3ce2ab..124e2a16 100644 --- a/korundum/rubylib/korundum/Korundum.cpp +++ b/korundum/rubylib/korundum/Korundum.cpp @@ -40,6 +40,14 @@ #include <smokeruby.h> #include <smoke.h> +#include "config.h" + +#ifndef HAVE_RUBY_1_9 +#define RARRAY_LEN(x) (RARRAY(x)->len) +#define RSTRING_LEN(x) (RSTRING(x)->len) +#define rb_str_catf_1 rb_str_catf +#endif + extern "C" { extern VALUE qt_internal_module; extern VALUE kconfigskeleton_class; @@ -805,7 +813,7 @@ public: // isn't in the Smoke runtime TQValueList<DCOPRef> windowList; - for (long i = 0; i < RARRAY(result)->len; i++) { + for (long i = 0; i < RARRAY_LEN(result); i++) { VALUE item = rb_ary_entry(result, i); smokeruby_object *o = value_obj_info(item); if( !o || !o->ptr) @@ -822,7 +830,7 @@ public: // And special case this type too TQValueList<TQCString> propertyList; - for (long i = 0; i < RARRAY(result)->len; i++) { + for (long i = 0; i < RARRAY_LEN(result); i++) { VALUE item = rb_ary_entry(result, i); propertyList.append(TQCString(StringValuePtr(item))); } @@ -836,7 +844,7 @@ public: // Convert the ruby hash to an array of key/value arrays VALUE temp = rb_funcall(result, rb_intern("to_a"), 0); - for (long i = 0; i < RARRAY(temp)->len; i++) { + for (long i = 0; i < RARRAY_LEN(temp); i++) { VALUE action = rb_ary_entry(rb_ary_entry(temp, i), 0); VALUE item = rb_ary_entry(rb_ary_entry(temp, i), 1); @@ -926,7 +934,7 @@ k_dcop_signal(int argc, VALUE * argv, VALUE self) { VALUE dcopObject = rb_funcall(kde_module, rb_intern("createDCOPObject"), 1, self); - TQString signalname(rb_id2name(rb_frame_last_func())); + TQString signalname(rb_id2name(rb_frame_this_func())); VALUE args = getdcopinfo(self, signalname); if(args == Qnil) return Qfalse; @@ -1020,7 +1028,7 @@ new_kde(int argc, VALUE * argv, VALUE klass) if (rb_funcall(kde_module, rb_intern("hasDCOPSignals"), 1, klass) == Qtrue) { VALUE signalNames = rb_funcall(kde_module, rb_intern("getDCOPSignalNames"), 1, klass); - for (long index = 0; index < RARRAY(signalNames)->len; index++) { + for (long index = 0; index < RARRAY_LEN(signalNames); index++) { VALUE signal = rb_ary_entry(signalNames, index); rb_define_method(klass, StringValuePtr(signal), (VALUE (*) (...)) k_dcop_signal, -1); } @@ -1088,9 +1096,9 @@ konsole_part_startprogram(VALUE self, VALUE value_program, VALUE value_args) TQStrList *args = new TQStrList; if (value_args != Qnil) { - for (long i = 0; i < RARRAY(value_args)->len; i++) { + for (long i = 0; i < RARRAY_LEN(value_args); i++) { VALUE item = rb_ary_entry(value_args, i); - args->append(TQString::fromLatin1(StringValuePtr(item), RSTRING(item)->len)); + args->append(TQString::fromLatin1(StringValuePtr(item), RSTRING_LEN(item))); } } |