Fix warnings from deprecated posix functions
Windows wants ISO C++ _fileno and _unlink instead of posix fileno and unlink. For fileno we have the QT_FILENO macro in qplatformdefs.h, so use it. For unlink we don't have a macro in Qt, so declare one in the test. Change-Id: I56c5c3fb4e500769c744132c46107816f89bb2c3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
069369d867
commit
bbc385150f
|
|
@ -1766,7 +1766,7 @@ void tst_QFile::largeUncFileSupport()
|
|||
// Retry in case of sharing violation
|
||||
QTRY_VERIFY(fOpen(largeFileEncoded, "rb", &fhF));
|
||||
StdioFileGuard fh(fhF);
|
||||
int fd = int(_fileno(fh));
|
||||
int fd = int(QT_FILENO(fh));
|
||||
QFile file;
|
||||
QVERIFY(file.open(fd, QIODevice::ReadOnly));
|
||||
QCOMPARE(file.size(), size);
|
||||
|
|
@ -2854,8 +2854,8 @@ void tst_QFile::handle()
|
|||
StdioFileGuard fp(fopen(qPrintable(m_testSourceFile), "r"));
|
||||
QVERIFY(fp);
|
||||
file2.open(fp, QIODevice::ReadOnly);
|
||||
QCOMPARE(int(file2.handle()), int(fileno(fp)));
|
||||
QCOMPARE(int(file2.handle()), int(fileno(fp)));
|
||||
QCOMPARE(int(file2.handle()), int(QT_FILENO(fp)));
|
||||
QCOMPARE(int(file2.handle()), int(QT_FILENO(fp)));
|
||||
fp.close();
|
||||
|
||||
//test round trip of adopted posix file handle
|
||||
|
|
|
|||
|
|
@ -57,8 +57,10 @@
|
|||
#if defined(Q_OS_WIN)
|
||||
#include <QtCore/qt_windows.h>
|
||||
#include <private/qwinregistry_p.h>
|
||||
#define QT_UNLINK _unlink
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#define QT_UNLINK unlink
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
|
|
@ -1736,7 +1738,7 @@ void tst_QSettings::sync()
|
|||
|
||||
// Now "some other app" will change other.software.org.ini
|
||||
QString userConfDir = settingsPath("__user__") + QDir::separator();
|
||||
unlink((userConfDir + "other.software.org.ini").toLatin1());
|
||||
QT_UNLINK((userConfDir + "other.software.org.ini").toLatin1());
|
||||
rename((userConfDir + "software.org.ini").toLatin1(),
|
||||
(userConfDir + "other.software.org.ini").toLatin1());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue