From 769064240b115f36a5625de3e3a99804361d6d8e Mon Sep 17 00:00:00 2001 From: Denis Dolzhenko Date: Thu, 27 Jul 2017 14:06:28 +0300 Subject: [PATCH] Fix: warnings, code style. Change-Id: I022ff1a3fbd75a1652fe36f52e7f72e51ff10998 Signed-off-by: Denis Dolzhenko --- src/Common/AppControl/src/ContactViewer.cpp | 2 +- src/Common/Utils/src/FileUtils.cpp | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/Common/AppControl/src/ContactViewer.cpp b/src/Common/AppControl/src/ContactViewer.cpp index e8014fc..c47bc61 100644 --- a/src/Common/AppControl/src/ContactViewer.cpp +++ b/src/Common/AppControl/src/ContactViewer.cpp @@ -59,7 +59,7 @@ bool ContactViewer::launch(const ContactAddress &address) return false; clear(); - launchPrivate(address); + return launchPrivate(address); } bool ContactViewer::launch() diff --git a/src/Common/Utils/src/FileUtils.cpp b/src/Common/Utils/src/FileUtils.cpp index 2d7803a..d82f7bc 100755 --- a/src/Common/Utils/src/FileUtils.cpp +++ b/src/Common/Utils/src/FileUtils.cpp @@ -171,32 +171,24 @@ std::string getFileName(const std::string &path) bool remove(const std::string &path, bool removeCurrentDir) { bool res = true; - struct dirent ep; struct dirent *dirData = nullptr; DIR *dp = opendir(path.c_str()); - if (dp) - { - while (true) - { - dirData = nullptr; - readdir_r(dp, &ep, &dirData); + if (dp) { + while (true) { + dirData = readdir(dp); if (dirData == nullptr) break; - if (strcmp(dirData->d_name, ".") != 0 && strcmp(dirData->d_name, "..") != 0) - { + if (strcmp(dirData->d_name, ".") != 0 && strcmp(dirData->d_name, "..") != 0) { std::string child = path + "/" + dirData->d_name; res &= remove(child, true); } } - closedir(dp); if (removeCurrentDir) - { res &= rmdir(path.c_str()) == 0; - } } else { res &= unlink(path.c_str()) == 0; } -- 2.34.1