From c86db6ae4fe3a965e526927a6df72c7cd65e78a6 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 20 Feb 2012 18:27:34 -0600 Subject: Fix qstrcmp calls --- qtruby/rubylib/qtruby/Qt.cpp | 70 +++++++++++++++++++------------------- qtruby/rubylib/qtruby/handlers.cpp | 50 +++++++++++++-------------- qtruby/rubylib/qtruby/smokeruby.h | 4 +-- 3 files changed, 62 insertions(+), 62 deletions(-) (limited to 'qtruby/rubylib/qtruby') diff --git a/qtruby/rubylib/qtruby/Qt.cpp b/qtruby/rubylib/qtruby/Qt.cpp index edb151af..89684d8f 100644 --- a/qtruby/rubylib/qtruby/Qt.cpp +++ b/qtruby/rubylib/qtruby/Qt.cpp @@ -138,7 +138,7 @@ void *value_to_ptr(VALUE ruby_value) { // ptr on success, null on fail VALUE getPointerObject(void *ptr); bool isTQObject(Smoke *smoke, Smoke::Index classId) { - if(qstrcmp(smoke->classes[classId].className, "TQObject") == 0) + if(tqstrcmp(smoke->classes[classId].className, "TQObject") == 0) return true; for(Smoke::Index *p = smoke->inheritanceList + smoke->classes[classId].parents; *p; @@ -346,7 +346,7 @@ public: void unsupported() { rb_raise(rb_eArgError, "Cannot handle '%s' as return-type of %s::%s", type().name(), - qstrcmp(_smoke->className(method().classId), "TQGlobalSpace") == 0 ? "" : _smoke->className(method().classId), + tqstrcmp(_smoke->className(method().classId), "TQGlobalSpace") == 0 ? "" : _smoke->className(method().classId), _smoke->methodNames[method().name]); } Smoke *smoke() { return _smoke; } @@ -411,7 +411,7 @@ public: } void unsupported() { - if (qstrcmp(_smoke->className(method().classId), "TQGlobalSpace") == 0) { + if (tqstrcmp(_smoke->className(method().classId), "TQGlobalSpace") == 0) { rb_raise(rb_eArgError, "Cannot handle '%s' as argument to %s", type().name(), _smoke->methodNames[method().name]); @@ -954,15 +954,15 @@ get_VALUEtype(VALUE ruby_value) const char *r = ""; if(ruby_value == Qnil) r = "u"; - else if(TYPE(ruby_value) == T_FIXNUM || TYPE(ruby_value) == T_BIGNUM || qstrcmp(classname, "TQt::Integer") == 0) + else if(TYPE(ruby_value) == T_FIXNUM || TYPE(ruby_value) == T_BIGNUM || tqstrcmp(classname, "TQt::Integer") == 0) r = "i"; else if(TYPE(ruby_value) == T_FLOAT) r = "n"; else if(TYPE(ruby_value) == T_STRING) r = "s"; - else if(ruby_value == Qtrue || ruby_value == Qfalse || qstrcmp(classname, "TQt::Boolean") == 0) + else if(ruby_value == Qtrue || ruby_value == Qfalse || tqstrcmp(classname, "TQt::Boolean") == 0) r = "B"; - else if(qstrcmp(classname, "TQt::Enum") == 0) { + else if(tqstrcmp(classname, "TQt::Enum") == 0) { VALUE temp = rb_funcall(qt_internal_module, rb_intern("get_qenum_type"), 1, ruby_value); r = StringValuePtr(temp); } else if(TYPE(ruby_value) == T_DATA) { @@ -1365,9 +1365,9 @@ static Smoke::Index new_qvariant_qmap = 0; while (qt_Smoke->ambiguousMethodList[i] != 0) { const char * argType = qt_Smoke->types[qt_Smoke->argumentList[qt_Smoke->methods[qt_Smoke->ambiguousMethodList[i]].args]].name; - if (qstrcmp(argType, "const TQValueList&" ) == 0) { + if (tqstrcmp(argType, "const TQValueList&" ) == 0) { new_qvariant_qlist = qt_Smoke->ambiguousMethodList[i]; - } else if (qstrcmp(argType, "const TQMap&" ) == 0) { + } else if (tqstrcmp(argType, "const TQMap&" ) == 0) { new_qvariant_qmap = qt_Smoke->ambiguousMethodList[i]; } @@ -1483,11 +1483,11 @@ static TQString * pred = 0; VALUE retval = rb_funcall2(qt_internal_module, rb_intern("do_method_missing"), argc+3, temp_stack); if (_current_method == -1) { const char * op = rb_id2name(SYM2ID(argv[0])); - if ( qstrcmp(op, "-") == 0 - || qstrcmp(op, "+") == 0 - || qstrcmp(op, "/") == 0 - || qstrcmp(op, "%") == 0 - || qstrcmp(op, "|") == 0 ) + if ( tqstrcmp(op, "-") == 0 + || tqstrcmp(op, "+") == 0 + || tqstrcmp(op, "/") == 0 + || tqstrcmp(op, "%") == 0 + || tqstrcmp(op, "|") == 0 ) { // Look for operator methods of the form 'operator+=', 'operator-=' and so on.. char op1[3]; @@ -1862,7 +1862,7 @@ qt_invoke(int /*argc*/, VALUE * argv, VALUE self) // Now, I need to find out if this means me int index; char *slotname; - bool isSignal = qstrcmp(rb_id2name(rb_frame_last_func()), "qt_emit") == 0; + bool isSignal = tqstrcmp(rb_id2name(rb_frame_last_func()), "qt_emit") == 0; VALUE mocArgs = getslotinfo(self, id, slotname, index, isSignal); if(mocArgs == Qnil) { // No ruby slot/signal found, assume the target is a C++ one @@ -2040,17 +2040,17 @@ setMocType(VALUE /*self*/, VALUE ptr, VALUE idx_value, VALUE name_value, VALUE s MocArgument *arg = 0; Data_Get_Struct(ptr, MocArgument, arg); arg[idx].st.set(qt_Smoke, typeId); - if(qstrcmp(static_type, "ptr") == 0) + if(tqstrcmp(static_type, "ptr") == 0) arg[idx].argType = xmoc_ptr; - else if(qstrcmp(static_type, "bool") == 0) + else if(tqstrcmp(static_type, "bool") == 0) arg[idx].argType = xmoc_bool; - else if(qstrcmp(static_type, "int") == 0) + else if(tqstrcmp(static_type, "int") == 0) arg[idx].argType = xmoc_int; - else if(qstrcmp(static_type, "double") == 0) + else if(tqstrcmp(static_type, "double") == 0) arg[idx].argType = xmoc_double; - else if(qstrcmp(static_type, "char*") == 0) + else if(tqstrcmp(static_type, "char*") == 0) arg[idx].argType = xmoc_charstar; - else if(qstrcmp(static_type, "TQString") == 0) + else if(tqstrcmp(static_type, "TQString") == 0) arg[idx].argType = xmoc_QString; return Qtrue; } @@ -2156,16 +2156,16 @@ make_QUParameter(VALUE /*self*/, VALUE name_value, VALUE type_value, VALUE /*ext TQUParameter *p = new TQUParameter; p->name = new char[strlen(name) + 1]; strcpy((char*)p->name, name); - if(qstrcmp(type, "bool") == 0) + if(tqstrcmp(type, "bool") == 0) p->type = &static_QUType_bool; - else if(qstrcmp(type, "int") == 0) + else if(tqstrcmp(type, "int") == 0) p->type = &static_QUType_int; - else if(qstrcmp(type, "double") == 0) + else if(tqstrcmp(type, "double") == 0) p->type = &static_QUType_double; - else if(qstrcmp(type, "char*") == 0 || qstrcmp(type, "const char*") == 0) + else if(tqstrcmp(type, "char*") == 0 || tqstrcmp(type, "const char*") == 0) p->type = &static_QUType_charstar; - else if(qstrcmp(type, "TQString") == 0 || qstrcmp(type, "TQString&") == 0 || - qstrcmp(type, "const TQString") == 0 || qstrcmp(type, "const TQString&") == 0) + else if(tqstrcmp(type, "TQString") == 0 || tqstrcmp(type, "TQString&") == 0 || + tqstrcmp(type, "const TQString") == 0 || tqstrcmp(type, "const TQString&") == 0) p->type = &static_QUType_TQString; else p->type = &static_QUType_ptr; @@ -2503,10 +2503,10 @@ findAllMethods(int argc, VALUE * argv, VALUE /*self*/) #define PUSH_QTRUBY_METHOD \ if ( (methodRef.flags & (Smoke::mf_internal|Smoke::mf_ctor|Smoke::mf_dtor)) == 0 \ - && qstrcmp(qt_Smoke->methodNames[methodRef.name], "operator=") != 0 \ - && qstrcmp(qt_Smoke->methodNames[methodRef.name], "operator!=") != 0 \ - && qstrcmp(qt_Smoke->methodNames[methodRef.name], "operator--") != 0 \ - && qstrcmp(qt_Smoke->methodNames[methodRef.name], "operator++") != 0 \ + && tqstrcmp(qt_Smoke->methodNames[methodRef.name], "operator=") != 0 \ + && tqstrcmp(qt_Smoke->methodNames[methodRef.name], "operator!=") != 0 \ + && tqstrcmp(qt_Smoke->methodNames[methodRef.name], "operator--") != 0 \ + && tqstrcmp(qt_Smoke->methodNames[methodRef.name], "operator++") != 0 \ && tqstrncmp(qt_Smoke->methodNames[methodRef.name], "operator ", strlen("operator ")) != 0 \ && ( (flags == 0 && (methodRef.flags & (Smoke::mf_static|Smoke::mf_enum|Smoke::mf_protected)) == 0) \ || ( flags == Smoke::mf_static \ @@ -2737,7 +2737,7 @@ create_qobject_class(VALUE /*self*/, VALUE package_value) if (TQString(package).startsWith("TQt::")) { klass = rb_define_class_under(qt_module, package+strlen("TQt::"), qt_base_class); - if (qstrcmp(package, "TQt::Application") == 0) { + if (tqstrcmp(package, "TQt::Application") == 0) { rb_define_singleton_method(klass, "new", (VALUE (*) (...)) new_qapplication, -1); rb_define_method(klass, "ARGV", (VALUE (*) (...)) qapplication_argv, 0); } @@ -2778,16 +2778,16 @@ create_qt_class(VALUE /*self*/, VALUE package_value) klass = kde_package_to_class(package, qt_base_class); } - if (qstrcmp(package, "TQt::MetaObject") == 0) { + if (tqstrcmp(package, "TQt::MetaObject") == 0) { qmetaobject_class = klass; - } else if (qstrcmp(package, "TQt::Variant") == 0) { + } else if (tqstrcmp(package, "TQt::Variant") == 0) { qvariant_class = klass; rb_define_singleton_method(qvariant_class, "new", (VALUE (*) (...)) new_qvariant, -1); - } else if (qstrcmp(package, "TQt::ByteArray") == 0) { + } else if (tqstrcmp(package, "TQt::ByteArray") == 0) { rb_define_method(klass, "data", (VALUE (*) (...)) qbytearray_data, 0); rb_define_method(klass, "size", (VALUE (*) (...)) qbytearray_size, 0); rb_define_method(klass, "setRawData", (VALUE (*) (...)) qbytearray_setRawData, 1); - } else if (qstrcmp(package, "TQt::Char") == 0) { + } else if (tqstrcmp(package, "TQt::Char") == 0) { rb_define_method(klass, "to_s", (VALUE (*) (...)) qchar_to_s, 0); } diff --git a/qtruby/rubylib/qtruby/handlers.cpp b/qtruby/rubylib/qtruby/handlers.cpp index ae952c0e..1c1733c6 100644 --- a/qtruby/rubylib/qtruby/handlers.cpp +++ b/qtruby/rubylib/qtruby/handlers.cpp @@ -184,15 +184,15 @@ smokeruby_free(void * p) unmapPointer(o, o->classId, 0); object_count --; - if ( qstrcmp(className, "TQObject") == 0 - || qstrcmp(className, "TQListBoxItem") == 0 - || qstrcmp(className, "TQStyleSheetItem") == 0 - || qstrcmp(className, "KCommand") == 0 - || qstrcmp(className, "KNamedCommand") == 0 - || qstrcmp(className, "KMacroCommand") == 0 - || qstrcmp(className, "KAboutData") == 0 - || qstrcmp(className, "KCmdLineArgs") == 0 - || qstrcmp(className, "TQSqlCursor") == 0 ) + if ( tqstrcmp(className, "TQObject") == 0 + || tqstrcmp(className, "TQListBoxItem") == 0 + || tqstrcmp(className, "TQStyleSheetItem") == 0 + || tqstrcmp(className, "KCommand") == 0 + || tqstrcmp(className, "KNamedCommand") == 0 + || tqstrcmp(className, "KMacroCommand") == 0 + || tqstrcmp(className, "KAboutData") == 0 + || tqstrcmp(className, "KCmdLineArgs") == 0 + || tqstrcmp(className, "TQSqlCursor") == 0 ) { // Don't delete instances of these classes for now free(o); @@ -203,19 +203,19 @@ smokeruby_free(void * p) free(o); return; } - } else if (qstrcmp(className, "TQIconViewItem") == 0) { + } else if (tqstrcmp(className, "TQIconViewItem") == 0) { TQIconViewItem * item = (TQIconViewItem *) o->ptr; if (item->iconView() != 0) { free(o); return; } - } else if (qstrcmp(className, "TQCheckListItem") == 0) { + } else if (tqstrcmp(className, "TQCheckListItem") == 0) { TQCheckListItem * item = (TQCheckListItem *) o->ptr; if (item->parent() != 0 || item->listView() != 0) { free(o); return; } - } else if (qstrcmp(className, "TQListViewItem") == 0) { + } else if (tqstrcmp(className, "TQListViewItem") == 0) { TQListViewItem * item = (TQListViewItem *) o->ptr; if (item->parent() != 0 || item->listView() != 0) { free(o); @@ -227,7 +227,7 @@ smokeruby_free(void * p) free(o); return; } - } else if (qstrcmp(className, "TQPopupMenu") == 0) { + } else if (tqstrcmp(className, "TQPopupMenu") == 0) { TQPopupMenu * item = (TQPopupMenu *) o->ptr; if (item->parentWidget(false) != 0) { free(o); @@ -401,7 +401,7 @@ matches_arg(Smoke *smoke, Smoke::Index meth, Smoke::Index argidx, const char *ar { Smoke::Index *arg = smoke->argumentList + smoke->methods[meth].args + argidx; SmokeType type = SmokeType(smoke, *arg); - return type.name() && qstrcmp(type.name(), argtype) == 0; + return type.name() && tqstrcmp(type.name(), argtype) == 0; } void * @@ -809,9 +809,9 @@ static void init_codec() { VALUE temp = rb_gv_get("$KCODE"); KCODE = StringValuePtr(temp); - if (qstrcmp(KCODE, "EUC") == 0) { + if (tqstrcmp(KCODE, "EUC") == 0) { codec = TQTextCodec::codecForName("eucJP"); - } else if (qstrcmp(KCODE, "SJIS") == 0) { + } else if (tqstrcmp(KCODE, "SJIS") == 0) { codec = TQTextCodec::codecForName("Shift-JIS"); } } @@ -823,13 +823,13 @@ qstringFromRString(VALUE rstring) { } TQString * s; - if (qstrcmp(KCODE, "UTF8") == 0) + if (tqstrcmp(KCODE, "UTF8") == 0) s = new TQString(TQString::fromUtf8(StringValuePtr(rstring), RSTRING(rstring)->len)); - else if (qstrcmp(KCODE, "EUC") == 0) + else if (tqstrcmp(KCODE, "EUC") == 0) s = new TQString(codec->toUnicode(StringValuePtr(rstring))); - else if (qstrcmp(KCODE, "SJIS") == 0) + else if (tqstrcmp(KCODE, "SJIS") == 0) s = new TQString(codec->toUnicode(StringValuePtr(rstring))); - else if(qstrcmp(KCODE, "NONE") == 0) + else if(tqstrcmp(KCODE, "NONE") == 0) s = new TQString(TQString::fromLatin1(StringValuePtr(rstring))); else s = new TQString(TQString::fromLocal8Bit(StringValuePtr(rstring), RSTRING(rstring)->len)); @@ -842,13 +842,13 @@ rstringFromTQString(TQString * s) { init_codec(); } - if (qstrcmp(KCODE, "UTF8") == 0) + if (tqstrcmp(KCODE, "UTF8") == 0) return rb_str_new2(s->utf8()); - else if (qstrcmp(KCODE, "EUC") == 0) + else if (tqstrcmp(KCODE, "EUC") == 0) return rb_str_new2(codec->fromUnicode(*s)); - else if (qstrcmp(KCODE, "SJIS") == 0) + else if (tqstrcmp(KCODE, "SJIS") == 0) return rb_str_new2(codec->fromUnicode(*s)); - else if (qstrcmp(KCODE, "NONE") == 0) + else if (tqstrcmp(KCODE, "NONE") == 0) return rb_str_new2(s->latin1()); else return rb_str_new2(s->local8Bit()); @@ -1779,7 +1779,7 @@ void marshall_ValueItemList(Marshall *m) { smokeruby_object *o = value_obj_info(item); // Special case for the TQValueList type - if ( qstrcmp(ItemSTR, "TQVariant") == 0 + if ( tqstrcmp(ItemSTR, "TQVariant") == 0 && (!o || !o->ptr || o->classId != o->smoke->idClass("TQVariant")) ) { // If the value isn't a TQt::Variant, then try and construct diff --git a/qtruby/rubylib/qtruby/smokeruby.h b/qtruby/rubylib/qtruby/smokeruby.h index dd3b81bb..a24aa0dc 100644 --- a/qtruby/rubylib/qtruby/smokeruby.h +++ b/qtruby/rubylib/qtruby/smokeruby.h @@ -66,7 +66,7 @@ public: bool operator ==(const SmokeType &b) const { const SmokeType &a = *this; if(a.name() == b.name()) return true; - if(a.name() && b.name() && qstrcmp(a.name(), b.name()) == 0) + if(a.name() && b.name() && tqstrcmp(a.name(), b.name()) == 0) return true; return false; } @@ -100,7 +100,7 @@ public: bool operator ==(const SmokeClass &b) const { const SmokeClass &a = *this; if(a.className() == b.className()) return true; - if(a.className() && b.className() && qstrcmp(a.className(), b.className()) == 0) + if(a.className() && b.className() && tqstrcmp(a.className(), b.className()) == 0) return true; return false; } -- cgit v1.2.3