Skip to content

Commit

Permalink
Revert "Address clang-tidy warnings (#47)"
Browse files Browse the repository at this point in the history
This reverts commit 602d4b1.
  • Loading branch information
clalancette committed Feb 21, 2020
1 parent 602d4b1 commit 320e510
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ament_index_cpp/src/get_package_prefix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "]";
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ament_index_cpp/src/get_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
6 changes: 3 additions & 3 deletions ament_index_cpp/src/get_resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#ifndef _WIN32
#include <dirent.h>
#include <cerrno>
#include <errno.h>
#else
#include <windows.h>
#endif
Expand All @@ -39,7 +39,7 @@ get_resources(const std::string & resource_type)
}
std::map<std::string, std::string> 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;

Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion ament_index_cpp/src/get_search_paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion ament_index_cpp/src/has_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 320e510

Please sign in to comment.