Use CHECK instead of CHECK_EQ to compare against nullptr
Using CHECK_EQ(..., nullptr) or CHECK_NE(..., nullptr) causes errors
when building with the platform version of libc++:
packages/providers/MediaProvider/jni/com_android_providers_media_FuseDaemon.cpp:95:9: error: use of overloaded operator '<<' is ambiguous (with operand types 'basic_ostream<char, std::__1::char_traits<char> >' and 'nullptr_t')
packages/providers/MediaProvider/jni/MediaProviderWrapper.cpp:424:5: error: use of overloaded operator '<<' is ambiguous (with operand types 'basic_ostream<char, std::__1::char_traits<char> >' and 'nullptr_t')
packages/providers/MediaProvider/jni/MediaProviderWrapper.cpp:426:5: error: use of overloaded operator '<<' is ambiguous (with operand types 'basic_ostream<char, std::__1::char_traits<char> >' and 'nullptr_t')
Use CHECK(... == nullptr) or CHECK(... != nullptr) instead.
Bug: 149591340
Test: m libfuse_jni
Change-Id: I00dd9a2b8d088d1dd4a2dd91cc6c2e0d603693c9
diff --git a/jni/com_android_providers_media_FuseDaemon.cpp b/jni/com_android_providers_media_FuseDaemon.cpp
index fe4848f..66aea9b 100644
--- a/jni/com_android_providers_media_FuseDaemon.cpp
+++ b/jni/com_android_providers_media_FuseDaemon.cpp
@@ -92,7 +92,7 @@
return;
}
- CHECK_EQ(pthread_getspecific(fuse::MediaProviderWrapper::gJniEnvKey), nullptr);
+ CHECK(pthread_getspecific(fuse::MediaProviderWrapper::gJniEnvKey) == nullptr);
daemon->InvalidateFuseDentryCache(utf_chars_path.c_str());
}
// TODO(b/145741152): Throw exception