update_engine: Fix all the "using" declaration usage. This patch removes unused "using" declarations, that is, declarations included in a .cc file at a global scope such that "using foo::bar" that later don't use the identifier "bar" at all. This also unifies the usage of these identifiers in the .cc files in favor of using the short name defined by the using declaration. For example, in several cases the .h refer to a type like "std::string" because using declarations are forbidden in header files while the .cc includes "using std::string;" with the purpose of just writting "string" in the .cc file. Very rarely, the full identifier is used when a local name ocludes it, for example, StringVectorToGStrv() and StringVectorToString() in utils.cc named its argument just "vector" need to refer to std::vector with the full name. This patch renames those arguments instead. Finally, it also sorts a few lists of using declarations that weren't in order. BUG=None TEST=FEATURES=test emerge-link update_engine Change-Id: I30f6b9510ecb7e03640f1951c48d5bb106309840 Reviewed-on: https://chromium-review.googlesource.com/226423 Reviewed-by: Alex Vakulenko <[email protected]> Commit-Queue: Alex Deymo <[email protected]> Tested-by: Alex Deymo <[email protected]>
diff --git a/test_utils.cc b/test_utils.cc index 70eb35c..3619e5a 100644 --- a/test_utils.cc +++ b/test_utils.cc
@@ -32,15 +32,15 @@ const char* const kMountPathTemplate = "UpdateEngineTests_mnt-XXXXXX"; -bool WriteFileVector(const std::string& path, const std::vector<char>& data) { +bool WriteFileVector(const string& path, const vector<char>& data) { return utils::WriteFile(path.c_str(), &data[0], data.size()); } -bool WriteFileString(const std::string& path, const std::string& data) { +bool WriteFileString(const string& path, const string& data) { return utils::WriteFile(path.c_str(), data.data(), data.size()); } -std::string Readlink(const std::string& path) { +string Readlink(const string& path) { vector<char> buf(PATH_MAX + 1); ssize_t r = readlink(path.c_str(), &buf[0], buf.size()); if (r < 0) @@ -52,7 +52,7 @@ return ret; } -std::vector<char> GzipCompressData(const std::vector<char>& data) { +vector<char> GzipCompressData(const vector<char>& data) { const char fname[] = "/tmp/GzipCompressDataTemp"; if (!WriteFileVector(fname, data)) { EXPECT_EQ(0, system((string("rm ") + fname).c_str()));