Remove explicit cast from Return<*>.
- also moving failure check to implicit cast operator.
(after talking to malchev@)
Bug: 31348667
Test: pass
Change-Id: I5a136a3596c2fa7c502ce9d53ab754b796d66fed
diff --git a/base/include/hidl/Status.h b/base/include/hidl/Status.h
index 1246ae0..06aa09c 100644
--- a/base/include/hidl/Status.h
+++ b/base/include/hidl/Status.h
@@ -149,21 +149,17 @@
Return(T v) : mVal{v} {}
Return(Status s) : mStatus(s) {}
- T get() const {
+ bool isOk() const {
+ return mStatus.isOk();
+ }
+
+ operator T() const {
if (!mStatus.isOk()) {
logAlwaysFatal("Attempted to retrieve value from hidl service, "
"but there was a transport error.");
}
return mVal;
}
- bool isOk() const {
- return mStatus.isOk();
- }
-
- // TODO(b/31348667) deprecate, remove all usage, remove function
- // Can't mark as deprecated yet because of all the projects built with -Werror.
- // [[deprecated("Replaced by get()")]]
- operator T() const { return mVal; }
const Status& getStatus() const {
return mStatus;