drm_hwcomposer: Change return type of DrmProperty::value() to tuple
To keep consistent with other functions
Change-Id: I11ba07eabcee08f3db09b3a5422bc480482a62c1
Signed-off-by: Sean Paul <seanpaul@chromium.org>
diff --git a/drmplane.cpp b/drmplane.cpp
index 35f91b4..6f1bf9b 100644
--- a/drmplane.cpp
+++ b/drmplane.cpp
@@ -42,7 +42,7 @@
}
uint64_t type;
- ret = p.value(&type);
+ std::tie(ret, type) = p.value();
if (ret) {
ALOGE("Failed to get plane type property value");
return ret;
diff --git a/drmproperty.cpp b/drmproperty.cpp
index 9faa37e..9a28374 100644
--- a/drmproperty.cpp
+++ b/drmproperty.cpp
@@ -70,33 +70,28 @@
return name_;
}
-int DrmProperty::value(uint64_t *value) const {
- if (type_ == DRM_PROPERTY_TYPE_BLOB) {
- *value = value_;
- return 0;
- }
+std::tuple<int, uint64_t> DrmProperty::value() const {
+ if (type_ == DRM_PROPERTY_TYPE_BLOB)
+ return std::make_tuple(0, value_);
if (values_.size() == 0)
- return -ENOENT;
+ return std::make_tuple(-ENOENT, 0);
switch (type_) {
case DRM_PROPERTY_TYPE_INT:
- *value = value_;
- return 0;
+ return std::make_tuple(0, value_);
case DRM_PROPERTY_TYPE_ENUM:
if (value_ >= enums_.size())
- return -ENOENT;
+ return std::make_tuple(-ENOENT, 0);
- *value = enums_[value_].value_;
- return 0;
+ return std::make_tuple(0, enums_[value_].value_);
case DRM_PROPERTY_TYPE_OBJECT:
- *value = value_;
- return 0;
+ return std::make_tuple(0, value_);
default:
- return -EINVAL;
+ return std::make_tuple(-EINVAL, 0);
}
}
diff --git a/drmproperty.h b/drmproperty.h
index f1328fe..36cd63d 100644
--- a/drmproperty.h
+++ b/drmproperty.h
@@ -45,7 +45,7 @@
uint32_t id() const;
std::string name() const;
- int value(uint64_t *value) const;
+ std::tuple<int, uint64_t> value() const;
bool immutable() const;
private: