diff options
author | 2021-08-16 13:00:28 -0700 | |
---|---|---|
committer | 2021-08-17 15:01:14 -0700 | |
commit | faa5e27652dd889c95e2405bbeec8483ff7497c3 (patch) | |
tree | 9960a631527a5db12ce4903bc02d40906e06195d | |
parent | e7449820a486c08dc487c96c7d961533566500bf (diff) |
Rename ProcResult stdout and stderr fields
stdout and stderr are macros in musl, which causes build failures
when they are used as field names. Rename the fields to stdout_str
and stderr_str.
Test: builds
Change-Id: I04770d2d6e82ca8393308ab12a304838a80f0ae5
-rw-r--r-- | cmds/idmap2/tests/Idmap2BinaryTests.cpp | 44 | ||||
-rw-r--r-- | core/jni/com_android_internal_content_om_OverlayConfig.cpp | 6 | ||||
-rw-r--r-- | libs/androidfw/PosixUtils.cpp | 4 | ||||
-rw-r--r-- | libs/androidfw/include/androidfw/PosixUtils.h | 4 | ||||
-rw-r--r-- | libs/androidfw/tests/PosixUtils_test.cpp | 4 |
5 files changed, 31 insertions, 31 deletions
diff --git a/cmds/idmap2/tests/Idmap2BinaryTests.cpp b/cmds/idmap2/tests/Idmap2BinaryTests.cpp index a55b41b83c93..1c8259746189 100644 --- a/cmds/idmap2/tests/Idmap2BinaryTests.cpp +++ b/cmds/idmap2/tests/Idmap2BinaryTests.cpp @@ -96,7 +96,7 @@ TEST_F(Idmap2BinaryTests, Create) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; struct stat st; ASSERT_EQ(stat(GetIdmapPath().c_str(), &st), 0); @@ -123,7 +123,7 @@ TEST_F(Idmap2BinaryTests, Dump) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; // clang-format off result = ExecuteBinary({"idmap2", @@ -131,24 +131,24 @@ TEST_F(Idmap2BinaryTests, Dump) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; - ASSERT_NE(result->stdout.find(StringPrintf("0x%08x -> 0x%08x", R::target::integer::int1, + ASSERT_NE(result->stdout_str.find(StringPrintf("0x%08x -> 0x%08x", R::target::integer::int1, R::overlay::integer::int1)), std::string::npos) - << result->stdout; - ASSERT_NE(result->stdout.find(StringPrintf("0x%08x -> 0x%08x", R::target::string::str1, + << result->stdout_str; + ASSERT_NE(result->stdout_str.find(StringPrintf("0x%08x -> 0x%08x", R::target::string::str1, R::overlay::string::str1)), std::string::npos) - << result->stdout; - ASSERT_NE(result->stdout.find(StringPrintf("0x%08x -> 0x%08x", R::target::string::str3, + << result->stdout_str; + ASSERT_NE(result->stdout_str.find(StringPrintf("0x%08x -> 0x%08x", R::target::string::str3, R::overlay::string::str3)), std::string::npos) - << result->stdout; - ASSERT_NE(result->stdout.find(StringPrintf("0x%08x -> 0x%08x", R::target::string::str4, + << result->stdout_str; + ASSERT_NE(result->stdout_str.find(StringPrintf("0x%08x -> 0x%08x", R::target::string::str4, R::overlay::string::str4)), std::string::npos) - << result->stdout; + << result->stdout_str; // clang-format off result = ExecuteBinary({"idmap2", @@ -157,8 +157,8 @@ TEST_F(Idmap2BinaryTests, Dump) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; - ASSERT_NE(result->stdout.find("00000000: 504d4449 magic"), std::string::npos); + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; + ASSERT_NE(result->stdout_str.find("00000000: 504d4449 magic"), std::string::npos); // clang-format off result = ExecuteBinary({"idmap2", @@ -184,7 +184,7 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; // clang-format off result = ExecuteBinary({"idmap2", @@ -194,9 +194,9 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--resid", StringPrintf("0x%08x", R::target::string::str1)}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; - ASSERT_NE(result->stdout.find("overlay-1"), std::string::npos); - ASSERT_EQ(result->stdout.find("overlay-1-sv"), std::string::npos); + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; + ASSERT_NE(result->stdout_str.find("overlay-1"), std::string::npos); + ASSERT_EQ(result->stdout_str.find("overlay-1-sv"), std::string::npos); // clang-format off result = ExecuteBinary({"idmap2", @@ -206,9 +206,9 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--resid", "test.target:string/str1"}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; - ASSERT_NE(result->stdout.find("overlay-1"), std::string::npos); - ASSERT_EQ(result->stdout.find("overlay-1-sv"), std::string::npos); + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; + ASSERT_NE(result->stdout_str.find("overlay-1"), std::string::npos); + ASSERT_EQ(result->stdout_str.find("overlay-1-sv"), std::string::npos); // clang-format off result = ExecuteBinary({"idmap2", @@ -218,8 +218,8 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--resid", "test.target:string/str1"}); // clang-format on ASSERT_THAT(result, NotNull()); - ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; - ASSERT_NE(result->stdout.find("overlay-1-sv"), std::string::npos); + ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; + ASSERT_NE(result->stdout_str.find("overlay-1-sv"), std::string::npos); unlink(GetIdmapPath().c_str()); } diff --git a/core/jni/com_android_internal_content_om_OverlayConfig.cpp b/core/jni/com_android_internal_content_om_OverlayConfig.cpp index 6aa7c10509bc..b37269cc3c26 100644 --- a/core/jni/com_android_internal_content_om_OverlayConfig.cpp +++ b/core/jni/com_android_internal_content_om_OverlayConfig.cpp @@ -73,13 +73,13 @@ static jobjectArray createIdmap(JNIEnv* env, jclass /*clazz*/, jstring targetPat } if (result->status != 0) { - LOG(ERROR) << "idmap2: " << result->stderr; - return nullptr; + LOG(ERROR) << "idmap2: " << result->stderr_str; + return nullptr; } // Return the paths of the idmaps created or updated during the idmap invocation. std::vector<std::string> idmap_paths; - std::istringstream input(result->stdout); + std::istringstream input(result->stdout_str); std::string path; while (std::getline(input, path)) { idmap_paths.push_back(path); diff --git a/libs/androidfw/PosixUtils.cpp b/libs/androidfw/PosixUtils.cpp index 4ec525a01da5..026912883a73 100644 --- a/libs/androidfw/PosixUtils.cpp +++ b/libs/androidfw/PosixUtils.cpp @@ -114,10 +114,10 @@ std::unique_ptr<ProcResult> ExecuteBinary(const std::vector<std::string>& argv) std::unique_ptr<ProcResult> result(new ProcResult()); result->status = status; const auto out = ReadFile(stdout[0]); - result->stdout = out ? *out : ""; + result->stdout_str = out ? *out : ""; close(stdout[0]); const auto err = ReadFile(stderr[0]); - result->stderr = err ? *err : ""; + result->stderr_str = err ? *err : ""; close(stderr[0]); return result; } diff --git a/libs/androidfw/include/androidfw/PosixUtils.h b/libs/androidfw/include/androidfw/PosixUtils.h index 8fc3ee2733c7..bb2084740a44 100644 --- a/libs/androidfw/include/androidfw/PosixUtils.h +++ b/libs/androidfw/include/androidfw/PosixUtils.h @@ -23,8 +23,8 @@ namespace util { struct ProcResult { int status; - std::string stdout; - std::string stderr; + std::string stdout_str; + std::string stderr_str; }; // Fork, exec and wait for an external process. Return nullptr if the process could not be launched, diff --git a/libs/androidfw/tests/PosixUtils_test.cpp b/libs/androidfw/tests/PosixUtils_test.cpp index cf97f87a4163..c7b3eba1451f 100644 --- a/libs/androidfw/tests/PosixUtils_test.cpp +++ b/libs/androidfw/tests/PosixUtils_test.cpp @@ -30,14 +30,14 @@ TEST(PosixUtilsTest, AbsolutePathToBinary) { const auto result = ExecuteBinary({"/bin/date", "--help"}); ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, 0); - ASSERT_EQ(result->stdout.find("usage: date "), 0); + ASSERT_EQ(result->stdout_str.find("usage: date "), 0); } TEST(PosixUtilsTest, RelativePathToBinary) { const auto result = ExecuteBinary({"date", "--help"}); ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, 0); - ASSERT_EQ(result->stdout.find("usage: date "), 0); + ASSERT_EQ(result->stdout_str.find("usage: date "), 0); } TEST(PosixUtilsTest, BadParameters) { |