Date: Wed, 4 Jul 2018 09:30:56 +0000 (UTC) From: Adriaan de Groot <adridg@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r473874 - head/x11-fm/qtfm/files Message-ID: <201807040930.w649UuUY080441@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adridg Date: Wed Jul 4 09:30:56 2018 New Revision: 473874 URL: https://svnweb.freebsd.org/changeset/ports/473874 Log: x11-wm/qtfm Fix build with Clang6 mymodel.cpp:166:12: error: no viable conversion from returned value of type 'bool' to function return type 'QString' Presumably, false -> 0 -> NULL -> QString(char *) was at some point a viable conversion. Return an empty QString explicitly. Reported by: linimon Modified: head/x11-fm/qtfm/files/patch-src_mymodel.cpp Modified: head/x11-fm/qtfm/files/patch-src_mymodel.cpp ============================================================================== --- head/x11-fm/qtfm/files/patch-src_mymodel.cpp Wed Jul 4 09:20:14 2018 (r473873) +++ head/x11-fm/qtfm/files/patch-src_mymodel.cpp Wed Jul 4 09:30:56 2018 (r473874) @@ -1,159 +1,11 @@ ---- src/mymodel.cpp.orig 2012-07-11 18:21:24.302333223 -0500 -+++ src/mymodel.cpp 2012-07-11 18:59:06.428956406 -0500 -@@ -21,7 +21,6 @@ +--- src/mymodel.cpp.orig 2018-07-04 09:21:07 UTC ++++ src/mymodel.cpp +@@ -166,7 +166,7 @@ QString myModel::filePath(const QModelIn - #include <mainwindow.h> - #include "mymodel.h" --#include <sys/inotify.h> - #include <unistd.h> - #include <sys/ioctl.h> + if(item) return item->absoluteFilePath(); -@@ -63,10 +62,8 @@ myModel::myModel(bool realMime) - - iconFactory = new QFileIconProvider(); - -- inotifyFD = inotify_init(); -- notifier = new QSocketNotifier(inotifyFD, QSocketNotifier::Read, this); -- connect(notifier, SIGNAL(activated(int)), this, SLOT(notifyChange())); -- connect(&eventTimer,SIGNAL(timeout()),this,SLOT(eventTimeout())); -+ watcher = new QFileSystemWatcher(this); -+ connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(notifyChange(QString))); - - realMimeTypes = realMime; +- return false; ++ return QString(); } -@@ -189,62 +186,9 @@ QString myModel::getMimeType(const QMode - } //--------------------------------------------------------------------------------------- --void myModel::notifyChange() -+void myModel::notifyChange(QString const& path) - { -- notifier->setEnabled(0); -- -- int buffSize = 0; -- ioctl(inotifyFD, FIONREAD, (char *) &buffSize); -- -- QByteArray buffer; -- buffer.resize(buffSize); -- read(inotifyFD,buffer.data(),buffSize); -- const char *at = buffer.data(); -- const char * const end = at + buffSize; -- -- while (at < end) -- { -- const inotify_event *event = reinterpret_cast<const inotify_event *>(at); -- -- int w = event->wd; -- -- if(eventTimer.isActive()) -- { -- if(w == lastEventID) -- eventTimer.start(40); -- else -- { -- eventTimer.stop(); -- notifyProcess(lastEventID); -- lastEventID = w; -- eventTimer.start(40); -- } -- } -- else -- { -- lastEventID = w; -- eventTimer.start(40); -- } -- -- at += sizeof(inotify_event) + event->len; -- } -- -- notifier->setEnabled(1); --} -- --//--------------------------------------------------------------------------------------- --void myModel::eventTimeout() --{ -- notifyProcess(lastEventID); -- eventTimer.stop(); --} -- --//--------------------------------------------------------------------------------------- --void myModel::notifyProcess(int eventID) --{ -- if(watchers.contains(eventID)) -- { -- myModelItem *parent = rootItem->matchPath(watchers.value(eventID).split(SEPARATOR)); -+ myModelItem *parent = rootItem->matchPath(path.split(SEPARATOR)); - - if(parent) - { -@@ -265,9 +209,7 @@ void myModel::notifyProcess(int eventID) - //must of been deleted, remove from model - if(child->fileInfo().isDir()) - { -- int wd = watchers.key(child->absoluteFilePath()); -- inotify_rm_watch(inotifyFD,wd); -- watchers.remove(wd); -+ watcher->removePath(child->absoluteFilePath()); - } - beginRemoveRows(index(parent->absoluteFilePath()),child->childNumber(),child->childNumber()); - parent->removeChild(child); -@@ -282,20 +224,19 @@ void myModel::notifyProcess(int eventID) - endInsertRows(); - } - } -- } -- else -- { -- inotify_rm_watch(inotifyFD,eventID); -- watchers.remove(eventID); -- } -+ else -+ { -+ watcher->removePath(path); -+ } - } - - //--------------------------------------------------------------------------------- --void myModel::addWatcher(myModelItem *item) -+void myModel::addToWatcher(myModelItem *item) - { - while(item != rootItem) - { -- watchers.insert(inotify_add_watch(inotifyFD, item->absoluteFilePath().toLocal8Bit(), IN_MOVE | IN_CREATE | IN_DELETE),item->absoluteFilePath()); //IN_ONESHOT | IN_ALL_EVENTS) -+ if (!watcher->directories().contains(item->absoluteFilePath())) -+ watcher->addPath(item->absoluteFilePath()); - item->watched = 1; - item = item->parent(); - } -@@ -308,7 +249,7 @@ bool myModel::setRootPath(const QString& - - myModelItem *item = rootItem->matchPath(path.split(SEPARATOR)); - -- if(item->watched == 0) addWatcher(item); -+ if(item->watched == 0) addToWatcher(item); - - if(item->walked == 0) - { -@@ -382,10 +323,7 @@ void myModel::refresh() - { - myModelItem *item = rootItem->matchPath(QStringList("/")); - -- //free all inotify watches -- foreach(int w, watchers.keys()) -- inotify_rm_watch(inotifyFD,w); -- watchers.clear(); -+ watcher->removePaths(watcher->directories()); - - beginResetModel(); - item->clearAll(); -@@ -840,9 +778,7 @@ bool myModel::remove(const QModelIndex & - QFileInfo info(children.at(i)); - if(info.isDir()) - { -- int wd = watchers.key(info.filePath()); -- inotify_rm_watch(inotifyFD,wd); -- watchers.remove(wd); -+ watcher->removePath(info.filePath()); - error |= QDir().rmdir(info.filePath()); - } - else error |= QFile::remove(info.filePath());
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807040930.w649UuUY080441>