[Bug 229368] New: yast2-qt-2.14.3-7: comparison with string literal
https://bugzilla.novell.com/show_bug.cgi?id=229368 Summary: yast2-qt-2.14.3-7: comparison with string literal Product: openSUSE 10.3 Version: unspecified Platform: All OS/Version: SuSE Other Status: NEW Severity: Normal Priority: P5 - None Component: YaST2 AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: dcb314@hotmail.com QAContact: jsrain@novell.com I just tried to compile package yast2-qt-2.14.3-7 The compiler said /include/YQi18n.h:30: warning: comparison with string literal The source code is return msgid == "" ? "" : QString::fromUtf8( gettext(msgid ) ); Most unfortunate. Suggest new code return (msgid[ 0] == 0) ? "" : QString::fromUtf8( gettext(msgid ) ); -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=229368 chrubis@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bnc-team- |sh@novell.com |screening@forge.provo.novell| |.com | -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=229368 ------- Comment #1 from sndirsch@novell.com 2007-01-16 15:30 MST ------- Feel free to close as duplicate of Bug #233655. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=229368 sh@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #2 from sh@novell.com 2007-01-17 11:05 MST ------- Well, it's a very valid bug report. That code probably only works because the compiler silently merges identical string literals. IIRC that code was a hot fix done in a hurry: gettext() returns the .POT file header (which translator, translation date, etc.) if called with an empty string -- not what people would expect on the GUI. I should have done the correct checking to begin with. And while I am at it, a check against NULL pointers might be worth while, too. --- include/YQi18n.h (Revision 35285) +++ include/YQi18n.h (Arbeitskopie) @@ -27,7 +27,7 @@ inline QString _( const char * msgid ) { - return msgid == "" ? "" : QString::fromUtf8( gettext(msgid ) ); + return ( !msgid || !*msgid ) ? "" : QString::fromUtf8( gettext(msgid ) ); } Will be available with yast2-qt-2.13.78 (SLES-10 SP1), will be merged back to the 10.3 code base after the SLES-10 SP1 beta phase. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
participants (1)
-
bugzilla_noreply@novell.com