On Thursday 01 November 2012 18:21:22 Darrell Anderson wrote:
I noticed the following warning when building
tdewebdev:
execbutton.cpp:210:55: warning: comparison with string literal results in
unspecified behaviour [-Waddress]
From what I gather the problem is trying to compare incompatible data
types, usually strings to pointers.
Somebody please review the proposed patch:
======================================
diff -urN tdewebdev/kommander/widgets/execbutton.cpp
tdewebdev.new/kommander/widgets/execbutton.cpp ---
tdewebdev/kommander/widgets/execbutton.cpp 2012-10-21 13:12:11.000000000
-0500 +++ tdewebdev.new/kommander/widgets/execbutton.cpp 2012-11-01
11:10:09.000000000 -0500 @@ -207,7 +207,7 @@
TQWidget * w;
while ( (w=it.current()) != 0 ) { // for each widget...
++it;
- if (w->name() == args[0] && w->className() ==
"PopupMenu")
+ if (strcmp(w->name(), args[0]) && w->className() ==
"PopupMenu")
{
TQPopupMenu *popup =
dynamic_cast<TQPopupMenu*>(w->child("unnamed",
"KPopupMenu"));
this->setPopup(popup);
======================================
Thanks!
Darrell
You reversed the sense of comparison,
strcmp(w->name(), args[0]) meaning "is not equal".
Correct:
if (0 == strcmp(w->name(), args[0]) && w->className() ==
"PopupMenu")
In any case, this seems a workaround. I guess that args[0] is TQString, so the
comparison should be valid. Try to reverse order of arguments, like:
if (args[0] == w->name() && w->className() == "PopupMenu")
--
Serghei