C++17: fix name collision.
external/libcxx/include/algorithm:1584:10: error: called object type 'char [4]' is not a function or function pointer
{ return __s(__f, __l).first; }
^~~
system/libhidl/transport/ServiceManagement.cpp:387:45: note: in instantiation of function template specialization 'std::__1::search<std::__1::basic_string<char>, char [4]>' requested here
std::vector<std::string> libs = search(path, prefix, ".so");
^
Bug: http://b/111067277
Test: builds
Change-Id: I0635b12413b94afa203984c95075dc3ff4f11afd
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
index 40a7ff5..e7bec41 100644
--- a/transport/ServiceManagement.cpp
+++ b/transport/ServiceManagement.cpp
@@ -238,9 +238,8 @@
return gDefaultServiceManager;
}
-std::vector<std::string> search(const std::string &path,
- const std::string &prefix,
- const std::string &suffix) {
+static std::vector<std::string> findFiles(const std::string& path, const std::string& prefix,
+ const std::string& suffix) {
std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(path.c_str()), closedir);
if (!dir) return {};
@@ -388,7 +387,7 @@
#endif
for (const std::string& path : paths) {
- std::vector<std::string> libs = search(path, prefix, ".so");
+ std::vector<std::string> libs = findFiles(path, prefix, ".so");
for (const std::string &lib : libs) {
const std::string fullPath = path + lib;
@@ -509,7 +508,7 @@
for (const auto &pair : sAllPaths) {
Arch arch = pair.first;
for (const auto &path : pair.second) {
- std::vector<std::string> libs = search(path, "", ".so");
+ std::vector<std::string> libs = findFiles(path, "", ".so");
for (const std::string &lib : libs) {
std::string matchedName;
std::string implName;