Don't use deprecated functions on Mac OS X
io/qfilesystemwatcher_fsevents.cpp:346:15: warning: 'stat64' is deprecated [-Wdeprecated-declarations] if (::stat64(it->absolutePath, &newInfo) == 0) { ^ According to 'man 2 stat' on Mac OS X, the stat64() function is deprecated in 10.6 and above. Instead, we are supposed to define the _DARWIN_USE_64_BIT_INODE which enables the 64-bit ino_t member in the stat struct and uses function symbol suffixes to call the correct version of stat with 64-bit inode support. Change-Id: I697374186c7f4d69df783f06962ca5644222194d Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
This commit is contained in:
parent
578e6d6834
commit
0109f86e51
@ -39,7 +39,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define _DARWIN_USE_64_BIT_INODE
|
||||||
#include <qplatformdefs.h>
|
#include <qplatformdefs.h>
|
||||||
|
|
||||||
#include "qfilesystemwatcher.h"
|
#include "qfilesystemwatcher.h"
|
||||||
@ -72,7 +72,7 @@ static bool operator==(const struct ::timespec &left, const struct ::timespec &r
|
|||||||
&& left.tv_nsec == right.tv_nsec;
|
&& left.tv_nsec == right.tv_nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool operator==(const struct ::stat64 &left, const struct ::stat64 &right)
|
static bool operator==(const struct ::stat &left, const struct ::stat &right)
|
||||||
{
|
{
|
||||||
return left.st_dev == right.st_dev
|
return left.st_dev == right.st_dev
|
||||||
&& left.st_mode == right.st_mode
|
&& left.st_mode == right.st_mode
|
||||||
@ -85,7 +85,7 @@ static bool operator==(const struct ::stat64 &left, const struct ::stat64 &right
|
|||||||
&& left.st_flags == right.st_flags;
|
&& left.st_flags == right.st_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool operator!=(const struct ::stat64 &left, const struct ::stat64 &right)
|
static bool operator!=(const struct ::stat &left, const struct ::stat &right)
|
||||||
{
|
{
|
||||||
return !(operator==(left, right));
|
return !(operator==(left, right));
|
||||||
}
|
}
|
||||||
@ -342,8 +342,8 @@ void QFSEventsFileSystemWatcherEngine::updateList(PathInfoList &list, bool direc
|
|||||||
PathInfoList::iterator End = list.end();
|
PathInfoList::iterator End = list.end();
|
||||||
PathInfoList::iterator it = list.begin();
|
PathInfoList::iterator it = list.begin();
|
||||||
while (it != End) {
|
while (it != End) {
|
||||||
struct ::stat64 newInfo;
|
struct ::stat newInfo;
|
||||||
if (::stat64(it->absolutePath, &newInfo) == 0) {
|
if (::stat(it->absolutePath, &newInfo) == 0) {
|
||||||
if (emitSignals) {
|
if (emitSignals) {
|
||||||
if (newInfo != it->savedInfo) {
|
if (newInfo != it->savedInfo) {
|
||||||
it->savedInfo = newInfo;
|
it->savedInfo = newInfo;
|
||||||
|
@ -75,7 +75,7 @@ typedef uint64_t FSEventStreamEventId;
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||||
// Yes, I use a stat64 element here. QFileInfo requires too much knowledge about implementation
|
// Yes, I use a stat element here. QFileInfo requires too much knowledge about implementation
|
||||||
// details to be used as a long-standing record. Since I'm going to have to store this information, I can
|
// details to be used as a long-standing record. Since I'm going to have to store this information, I can
|
||||||
// do the stat myself too.
|
// do the stat myself too.
|
||||||
struct PathInfo {
|
struct PathInfo {
|
||||||
@ -83,7 +83,7 @@ struct PathInfo {
|
|||||||
: originalPath(path), absolutePath(absPath) {}
|
: originalPath(path), absolutePath(absPath) {}
|
||||||
QString originalPath; // The path we need to emit
|
QString originalPath; // The path we need to emit
|
||||||
QByteArray absolutePath; // The path we need to stat.
|
QByteArray absolutePath; // The path we need to stat.
|
||||||
struct ::stat64 savedInfo; // All the info for the path so we can compare it.
|
struct ::stat savedInfo; // All the info for the path so we can compare it.
|
||||||
};
|
};
|
||||||
typedef QLinkedList<PathInfo> PathInfoList;
|
typedef QLinkedList<PathInfo> PathInfoList;
|
||||||
typedef QHash<QString, PathInfoList> PathHash;
|
typedef QHash<QString, PathInfoList> PathHash;
|
||||||
|
Loading…
Reference in New Issue
Block a user