Fix compile with bad strrchr signature
authorChristian Kamm <mail@ckamm.de>
Tue, 19 Sep 2017 10:44:59 +0000 (12:44 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Thu, 5 Oct 2017 20:01:34 +0000 (22:01 +0200)
src/common/utility.cpp

index 53aaf2b9dab0b003500513e5ba4613d37ee4290b..460435f1d639649f666eb1a78141b65598486a44 100644 (file)
@@ -46,6 +46,7 @@
 
 #include <math.h>
 #include <stdarg.h>
+#include <cstring>
 
 #if defined(Q_OS_WIN)
 #include "utility_win.cpp"
@@ -547,28 +548,28 @@ QUrl Utility::concatUrlPath(const QUrl &url, const QString &concatPath,
 
 bool Utility::isConflictFile(const char *name)
 {
-    auto bname = strrchr(name, '/');
+    const char *bname = std::strrchr(name, '/');
     if (bname) {
         bname += 1;
     } else {
         bname = name;
     }
 
-    if (strstr(bname, "_conflict-"))
+    if (std::strstr(bname, "_conflict-"))
         return true;
 
     if (shouldUploadConflictFiles()) {
         // For uploads, we want to consider files with any kind of username tag
         // as conflict files. (pattern *_conflict_*-)
-        auto startOfMarker = strstr(bname, "_conflict_");
-        if (startOfMarker && strchr(startOfMarker, '-'))
+        const char *startOfMarker = std::strstr(bname, "_conflict_");
+        if (startOfMarker && std::strchr(startOfMarker, '-'))
             return true;
     } else {
         // Old behavior: optionally, files with the specific string in the env variable
         // appended are also considered conflict files.
         static auto conflictFileUsername = qgetenv("CSYNC_CONFLICT_FILE_USERNAME");
         static auto usernameConflictId = QByteArray("_conflict_" + conflictFileUsername + "-");
-        if (!conflictFileUsername.isEmpty() && strstr(bname, usernameConflictId.constData())) {
+        if (!conflictFileUsername.isEmpty() && std::strstr(bname, usernameConflictId.constData())) {
             return true;
         }
     }