summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2022-04-07 15:47:15 -0700
committerColin Cross <ccross@android.com>2022-04-07 15:47:15 -0700
commit3568383464ae0a1e73e04ba998ab2f937ec5d159 (patch)
tree9969f37dfbb413eb983c79d0a6b3e736226a6b52
parent550066b45f0c522f2f68aa98c22c20270f6ad7ac (diff)
downloadwificond-3568383464ae0a1e73e04ba998ab2f937ec5d159.tar.gz
Fix using NULL as an integer
PostTask is passing NULL as a Message, which is being treated as 0 and implicitly constructing a Message. It is valid to define NULL as std::nullptr, which cannot be treated as 0 and fails to build. This doesn't currently happen as this code is only compiled against bionic, which uses Clang's definition of NULL as 0. It does happen in another copy of this code that is compiled for the host, which when compiling against musl uses std::nullptr for NULL. Bug: 218888599 Test: m wificond Change-Id: I1f6e132ee68fa4f7c1480b250c0d6bd8a47e6baf
-rw-r--r--looper_backed_event_loop.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/looper_backed_event_loop.cpp b/looper_backed_event_loop.cpp
index b4f5c44..f759948 100644
--- a/looper_backed_event_loop.cpp
+++ b/looper_backed_event_loop.cpp
@@ -79,14 +79,14 @@ LooperBackedEventLoop::~LooperBackedEventLoop() {
void LooperBackedEventLoop::PostTask(const std::function<void()>& callback) {
sp<android::MessageHandler> event_loop_callback =
new EventLoopCallback(callback);
- looper_->sendMessage(event_loop_callback, NULL);
+ looper_->sendMessage(event_loop_callback, Message());
}
void LooperBackedEventLoop::PostDelayedTask(
const std::function<void()>& callback,
int64_t delay_ms) {
sp<android::MessageHandler> looper_callback = new EventLoopCallback(callback);
- looper_->sendMessageDelayed(ms2ns(delay_ms), looper_callback, NULL);
+ looper_->sendMessageDelayed(ms2ns(delay_ms), looper_callback, Message());
}
bool LooperBackedEventLoop::WatchFileDescriptor(