From 320e510857446b700016a9ba97025ce311d3996f Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Fri, 21 Feb 2020 20:12:54 +0000 Subject: [PATCH] Revert "Address clang-tidy warnings (#47)" This reverts commit 602d4b154a41010d90ebd43972255299eb3ad108. --- ament_index_cpp/src/get_package_prefix.cpp | 4 ++-- ament_index_cpp/src/get_resource.cpp | 2 +- ament_index_cpp/src/get_resources.cpp | 6 +++--- ament_index_cpp/src/get_search_paths.cpp | 2 +- ament_index_cpp/src/has_resource.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ament_index_cpp/src/get_package_prefix.cpp b/ament_index_cpp/src/get_package_prefix.cpp index eac47c6..d6468c1 100644 --- a/ament_index_cpp/src/get_package_prefix.cpp +++ b/ament_index_cpp/src/get_package_prefix.cpp @@ -32,7 +32,7 @@ format_package_not_found_error_message(const std::string & package_name) for (const auto & path : search_paths) { message += path + ", "; } - if (!search_paths.empty()) { + if (search_paths.size() > 0) { message = message.substr(0, message.size() - 2); } return message + "]"; @@ -43,7 +43,7 @@ PackageNotFoundError::PackageNotFoundError(const std::string & _package_name) package_name(_package_name) {} -PackageNotFoundError::~PackageNotFoundError() = default; +PackageNotFoundError::~PackageNotFoundError() {} std::string get_package_prefix(const std::string & package_name) diff --git a/ament_index_cpp/src/get_resource.cpp b/ament_index_cpp/src/get_resource.cpp index 2539319..5f2d2be 100644 --- a/ament_index_cpp/src/get_resource.cpp +++ b/ament_index_cpp/src/get_resource.cpp @@ -40,7 +40,7 @@ get_resource( throw std::runtime_error("ament_index_cpp::get_resource() resource name must not be empty"); } auto paths = get_search_paths(); - for (const auto & path : paths) { + for (auto path : paths) { auto resource_path = rcpputils::fs::path{path} / "share" / "ament_index" / "resource_index" / resource_type / resource_name; std::ifstream s(resource_path.string()); diff --git a/ament_index_cpp/src/get_resources.cpp b/ament_index_cpp/src/get_resources.cpp index c5d885e..493dfa5 100644 --- a/ament_index_cpp/src/get_resources.cpp +++ b/ament_index_cpp/src/get_resources.cpp @@ -16,7 +16,7 @@ #ifndef _WIN32 #include -#include +#include #else #include #endif @@ -39,7 +39,7 @@ get_resources(const std::string & resource_type) } std::map resources; auto paths = get_search_paths(); - for (const auto & base_path : paths) { + for (auto base_path : paths) { auto path = rcpputils::fs::path{base_path} / "share" / "ament_index" / "resource_index" / resource_type; @@ -49,7 +49,7 @@ get_resources(const std::string & resource_type) continue; } dirent * entry; - while ((entry = readdir(dir)) != nullptr) { + while ((entry = readdir(dir)) != NULL) { // ignore directories auto subdir = opendir((path / entry->d_name).string().c_str()); if (subdir) { diff --git a/ament_index_cpp/src/get_search_paths.cpp b/ament_index_cpp/src/get_search_paths.cpp index 03ee40c..7a411ac 100644 --- a/ament_index_cpp/src/get_search_paths.cpp +++ b/ament_index_cpp/src/get_search_paths.cpp @@ -60,7 +60,7 @@ get_search_paths() continue; } // skip non existing directories - struct stat s {}; + struct stat s; if (stat(tok.c_str(), &s)) { continue; } diff --git a/ament_index_cpp/src/has_resource.cpp b/ament_index_cpp/src/has_resource.cpp index 1ed905e..6770980 100644 --- a/ament_index_cpp/src/has_resource.cpp +++ b/ament_index_cpp/src/has_resource.cpp @@ -38,7 +38,7 @@ has_resource( throw std::runtime_error("ament_index_cpp::has_resource() resource name must not be empty"); } auto paths = get_search_paths(); - for (const auto & path : paths) { + for (auto path : paths) { auto resource_path = rcpputils::fs::path{path} / "share" / "ament_index" / "resource_index" / resource_type / resource_name; std::ifstream s(resource_path.string());