Fix compile warnings with MSVC

Calling a static function non statically causes an unused variable
warning for the optimised away d pointer.
sscanf causes an insecure functions warning. (Even though it was used
safely in this case)

Change-Id: I07700e2155284ef3ebbe7d604ed59b2e61ee7f95
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
Shane Kearns 2012-05-22 12:31:23 +01:00 committed by Qt by Nokia
parent 856ca268f8
commit 9149aebac9
2 changed files with 8 additions and 2 deletions

View File

@ -1043,7 +1043,14 @@ QDateTime QNetworkHeadersPrivate::fromHttpDate(const QByteArray &value)
if (pos == 3) {
char month_name[4];
int day, year, hour, minute, second;
#ifdef Q_CC_MSVC
// Use secure version to avoid compiler warning
if (sscanf_s(value.constData(), "%*3s, %d %3s %d %d:%d:%d 'GMT'", &day, month_name, 4, &year, &hour, &minute, &second) == 6)
#else
// The POSIX secure mode is %ms (which allocates memory), too bleeding edge for now
// In any case this is already safe as field width is specified.
if (sscanf(value.constData(), "%*3s, %d %3s %d %d:%d:%d 'GMT'", &day, month_name, &year, &hour, &minute, &second) == 6)
#endif
dt = QDateTime(QDate(year, name_to_month(month_name), day), QTime(hour, minute, second));
} else {
QLocale c = QLocale::c();

View File

@ -1378,8 +1378,7 @@ QAbstractSocket::~QAbstractSocket()
*/
void QAbstractSocket::resume()
{
Q_D(QAbstractSocket);
d->resumeSocketNotifiers(this);
QAbstractSocketPrivate::resumeSocketNotifiers(this);
}
/*!