From 097ca275f4717a2c47a5d49f302ed2b72c8a1370 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Fri, 14 Nov 2014 08:01:01 -0800 Subject: Replace IInterface::asBinder() with a static so we can do NULL checks again, and update calls to IInterface::asBinder() to use the new static version. Change-Id: Ia7b10eb38ca55b72278bfd33d3bf647f338b4e6a --- libs/binder/IInterface.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'libs/binder/IInterface.cpp') diff --git a/libs/binder/IInterface.cpp b/libs/binder/IInterface.cpp index 99a9ffeea2..8c60dc4f7e 100644 --- a/libs/binder/IInterface.cpp +++ b/libs/binder/IInterface.cpp @@ -27,14 +27,18 @@ IInterface::IInterface() IInterface::~IInterface() { } -sp IInterface::asBinder() +// static +sp IInterface::asBinder(const IInterface* iface) { - return onAsBinder(); + if (iface == NULL) return NULL; + return const_cast(iface)->onAsBinder(); } -sp IInterface::asBinder() const +// static +sp IInterface::asBinder(const sp& iface) { - return const_cast(this)->onAsBinder(); + if (iface == NULL) return NULL; + return iface->onAsBinder(); } // --------------------------------------------------------------------------- -- cgit v1.2.3-59-g8ed1b