Re: FTBFS if "-Werror=format-security" flag is used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/11/2013 11:00 PM, Kevin Kofler wrote:
Brendan Jones wrote:
What is the best way to handle this case:

qWarning(QObject::tr("Client name '%1' occupied.").arg(name).toUtf8());

something like, or can I make it simpler:

qWarning("%s",qPrintable(QObject::tr("Client name '%1'
occupied.").arg(name).toUtf8()));

Use one of:
qWarning() << QObject::tr("Client name '%1' occupied.").arg(name);
or:
qWarning("%s", QObject::tr("Client name '%1'
occupied.").arg(name).toLocal8Bit().data());

Note that hardcoding toUtf8() is also a bad idea here, the right encoding to
use is toLocal8Bit(), or this will print junk in non-UTF-8 locales. (In our
default UTF-8 locales, it will make no difference.)

         Kevin Kofler


Thanks!
--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux