idmap2: fix clang-tidy warnings [modernize-*]
Bug: 120024673
Test: mmm frameworks/base/cmds/idmap2; check output
Change-Id: I8768169fb7b541eb6b1aa3311c46a710eb71aac9
diff --git a/cmds/idmap2/tests/BinaryStreamVisitorTests.cpp b/cmds/idmap2/tests/BinaryStreamVisitorTests.cpp
index 3b9dbe9..2698ac0 100644
--- a/cmds/idmap2/tests/BinaryStreamVisitorTests.cpp
+++ b/cmds/idmap2/tests/BinaryStreamVisitorTests.cpp
@@ -31,8 +31,7 @@
using ::testing::NotNull;
-namespace android {
-namespace idmap2 {
+namespace android::idmap2 {
TEST(BinaryStreamVisitorTests, CreateBinaryStreamViaBinaryStreamVisitor) {
std::string raw(reinterpret_cast<const char*>(idmap_raw_data), idmap_raw_data_len);
@@ -124,5 +123,4 @@
ASSERT_FALSE(success);
}
-} // namespace idmap2
-} // namespace android
+} // namespace android::idmap2
diff --git a/cmds/idmap2/tests/CommandLineOptionsTests.cpp b/cmds/idmap2/tests/CommandLineOptionsTests.cpp
index 243d23a..c27d27a 100644
--- a/cmds/idmap2/tests/CommandLineOptionsTests.cpp
+++ b/cmds/idmap2/tests/CommandLineOptionsTests.cpp
@@ -38,8 +38,7 @@
#include "TestHelpers.h"
-namespace android {
-namespace idmap2 {
+namespace android::idmap2 {
TEST(CommandLineOptionsTests, Flag) {
bool foo = true;
@@ -193,5 +192,4 @@
std::string::npos);
}
-} // namespace idmap2
-} // namespace android
+} // namespace android::idmap2
diff --git a/cmds/idmap2/tests/FileUtilsTests.cpp b/cmds/idmap2/tests/FileUtilsTests.cpp
index 6584ee3..4bf832a 100644
--- a/cmds/idmap2/tests/FileUtilsTests.cpp
+++ b/cmds/idmap2/tests/FileUtilsTests.cpp
@@ -29,9 +29,7 @@
using ::testing::NotNull;
-namespace android {
-namespace idmap2 {
-namespace utils {
+namespace android::idmap2::utils {
TEST(FileUtilsTests, FindFilesFindEverythingNonRecursive) {
const auto& root = GetTestDataPath();
@@ -71,6 +69,4 @@
close(pipefd[0]);
}
-} // namespace utils
-} // namespace idmap2
-} // namespace android
+} // namespace android::idmap2::utils
diff --git a/cmds/idmap2/tests/Idmap2BinaryTests.cpp b/cmds/idmap2/tests/Idmap2BinaryTests.cpp
index 255f3c1..22f48e9 100644
--- a/cmds/idmap2/tests/Idmap2BinaryTests.cpp
+++ b/cmds/idmap2/tests/Idmap2BinaryTests.cpp
@@ -46,8 +46,7 @@
using ::android::util::ExecuteBinary;
using ::testing::NotNull;
-namespace android {
-namespace idmap2 {
+namespace android::idmap2 {
class Idmap2BinaryTests : public Idmap2Tests {};
@@ -313,5 +312,4 @@
ASSERT_NE(result->status, EXIT_SUCCESS);
}
-} // namespace idmap2
-} // namespace android
+} // namespace android::idmap2
diff --git a/cmds/idmap2/tests/IdmapTests.cpp b/cmds/idmap2/tests/IdmapTests.cpp
index dc80e0e..963f22e 100644
--- a/cmds/idmap2/tests/IdmapTests.cpp
+++ b/cmds/idmap2/tests/IdmapTests.cpp
@@ -37,8 +37,7 @@
using ::testing::IsNull;
using ::testing::NotNull;
-namespace android {
-namespace idmap2 {
+namespace android::idmap2 {
TEST(IdmapTests, TestCanonicalIdmapPathFor) {
ASSERT_EQ(Idmap::CanonicalIdmapPathFor("/foo", "/vendor/overlay/bar.apk"),
@@ -346,23 +345,23 @@
explicit TestVisitor(std::ostream& stream) : stream_(stream) {
}
- void visit(const Idmap& idmap ATTRIBUTE_UNUSED) {
+ void visit(const Idmap& idmap ATTRIBUTE_UNUSED) override {
stream_ << "TestVisitor::visit(Idmap)" << std::endl;
}
- void visit(const IdmapHeader& idmap ATTRIBUTE_UNUSED) {
+ void visit(const IdmapHeader& idmap ATTRIBUTE_UNUSED) override {
stream_ << "TestVisitor::visit(IdmapHeader)" << std::endl;
}
- void visit(const IdmapData& idmap ATTRIBUTE_UNUSED) {
+ void visit(const IdmapData& idmap ATTRIBUTE_UNUSED) override {
stream_ << "TestVisitor::visit(IdmapData)" << std::endl;
}
- void visit(const IdmapData::Header& idmap ATTRIBUTE_UNUSED) {
+ void visit(const IdmapData::Header& idmap ATTRIBUTE_UNUSED) override {
stream_ << "TestVisitor::visit(IdmapData::Header)" << std::endl;
}
- void visit(const IdmapData::TypeEntry& idmap ATTRIBUTE_UNUSED) {
+ void visit(const IdmapData::TypeEntry& idmap ATTRIBUTE_UNUSED) override {
stream_ << "TestVisitor::visit(IdmapData::TypeEntry)" << std::endl;
}
@@ -391,5 +390,4 @@
"TestVisitor::visit(IdmapData::TypeEntry)\n");
}
-} // namespace idmap2
-} // namespace android
+} // namespace android::idmap2
diff --git a/cmds/idmap2/tests/Main.cpp b/cmds/idmap2/tests/Main.cpp
index 0f683ff..2b13fed 100644
--- a/cmds/idmap2/tests/Main.cpp
+++ b/cmds/idmap2/tests/Main.cpp
@@ -22,15 +22,13 @@
#include "TestHelpers.h"
-namespace android {
-namespace idmap2 {
+namespace android::idmap2 {
std::string GetTestDataPath() {
return base::GetExecutableDirectory() + "/tests/data";
}
-} // namespace idmap2
-} // namespace android
+} // namespace android::idmap2
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
diff --git a/cmds/idmap2/tests/PrettyPrintVisitorTests.cpp b/cmds/idmap2/tests/PrettyPrintVisitorTests.cpp
index 0c4f493..7736bc0 100644
--- a/cmds/idmap2/tests/PrettyPrintVisitorTests.cpp
+++ b/cmds/idmap2/tests/PrettyPrintVisitorTests.cpp
@@ -33,8 +33,7 @@
using android::ApkAssets;
-namespace android {
-namespace idmap2 {
+namespace android::idmap2 {
TEST(PrettyPrintVisitorTests, CreatePrettyPrintVisitor) {
const std::string target_apk_path(GetTestDataPath() + "/target/target.apk");
@@ -78,5 +77,4 @@
ASSERT_NE(stream.str().find("0x7f020000 -> 0x7f020000\n"), std::string::npos);
}
-} // namespace idmap2
-} // namespace android
+} // namespace android::idmap2
diff --git a/cmds/idmap2/tests/RawPrintVisitorTests.cpp b/cmds/idmap2/tests/RawPrintVisitorTests.cpp
index 6285f21..0318cd2 100644
--- a/cmds/idmap2/tests/RawPrintVisitorTests.cpp
+++ b/cmds/idmap2/tests/RawPrintVisitorTests.cpp
@@ -29,8 +29,7 @@
using ::testing::NotNull;
-namespace android {
-namespace idmap2 {
+namespace android::idmap2 {
TEST(RawPrintVisitorTests, CreateRawPrintVisitor) {
const std::string target_apk_path(GetTestDataPath() + "/target/target.apk");
@@ -79,5 +78,4 @@
ASSERT_NE(stream.str().find("0000021c: 00000000 0x7f020000 -> 0x7f020000\n"), std::string::npos);
}
-} // namespace idmap2
-} // namespace android
+} // namespace android::idmap2
diff --git a/cmds/idmap2/tests/ResourceUtilsTests.cpp b/cmds/idmap2/tests/ResourceUtilsTests.cpp
index c8578d3..ad78685 100644
--- a/cmds/idmap2/tests/ResourceUtilsTests.cpp
+++ b/cmds/idmap2/tests/ResourceUtilsTests.cpp
@@ -28,8 +28,7 @@
using ::testing::NotNull;
-namespace android {
-namespace idmap2 {
+namespace android::idmap2 {
class ResourceUtilsTests : public Idmap2Tests {
protected:
@@ -62,5 +61,4 @@
ASSERT_FALSE(name);
}
-} // namespace idmap2
-} // namespace android
+} // namespace android::idmap2
diff --git a/cmds/idmap2/tests/TestHelpers.h b/cmds/idmap2/tests/TestHelpers.h
index 356db7a..45525a5 100644
--- a/cmds/idmap2/tests/TestHelpers.h
+++ b/cmds/idmap2/tests/TestHelpers.h
@@ -19,8 +19,7 @@
#include <string>
-namespace android {
-namespace idmap2 {
+namespace android::idmap2 {
const unsigned char idmap_raw_data[] = {
// IDMAP HEADER
@@ -162,7 +161,6 @@
std::string idmap_path_;
};
-} // namespace idmap2
-} // namespace android
+} // namespace android::idmap2
#endif // IDMAP2_TESTS_TESTHELPERS_H_
diff --git a/cmds/idmap2/tests/XmlTests.cpp b/cmds/idmap2/tests/XmlTests.cpp
index 40758b42..fe79d8f 100644
--- a/cmds/idmap2/tests/XmlTests.cpp
+++ b/cmds/idmap2/tests/XmlTests.cpp
@@ -27,8 +27,7 @@
using ::testing::IsNull;
using ::testing::NotNull;
-namespace android {
-namespace idmap2 {
+namespace android::idmap2 {
TEST(XmlTests, Create) {
auto zip = ZipFile::Open(GetTestDataPath() + "/target/target.apk");
@@ -68,5 +67,4 @@
ASSERT_THAT(fail, IsNull());
}
-} // namespace idmap2
-} // namespace android
+} // namespace android::idmap2
diff --git a/cmds/idmap2/tests/ZipFileTests.cpp b/cmds/idmap2/tests/ZipFileTests.cpp
index 6e4a501..79be43c 100644
--- a/cmds/idmap2/tests/ZipFileTests.cpp
+++ b/cmds/idmap2/tests/ZipFileTests.cpp
@@ -28,8 +28,7 @@
using ::testing::IsNull;
using ::testing::NotNull;
-namespace android {
-namespace idmap2 {
+namespace android::idmap2 {
TEST(ZipFileTests, BasicOpen) {
auto zip = ZipFile::Open(GetTestDataPath() + "/target/target.apk");
@@ -66,5 +65,4 @@
ASSERT_THAT(fail, IsNull());
}
-} // namespace idmap2
-} // namespace android
+} // namespace android::idmap2