diff options
author | Sean Paul <seanpaul@chromium.org> | 2019-03-06 09:48:42 -0500 |
---|---|---|
committer | Sean Paul <seanpaul@chromium.org> | 2019-03-18 14:28:45 +0000 |
commit | fc0b1da4eda489deff77ade415b78178772ab9b3 (patch) | |
tree | f74b8e40c95b6aa6ae7c8f0d8e6277e12b23f57b | |
parent | 890988f3f60e8d8367e9613270af20ff46bf8e93 (diff) | |
download | drm_hwcomposer-fc0b1da4eda489deff77ade415b78178772ab9b3.tar.gz |
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>
-rw-r--r-- | drmplane.cpp | 2 | ||||
-rw-r--r-- | drmproperty.cpp | 23 | ||||
-rw-r--r-- | drmproperty.h | 2 |
3 files changed, 11 insertions, 16 deletions
diff --git a/drmplane.cpp b/drmplane.cpp index 35f91b4..6f1bf9b 100644 --- a/drmplane.cpp +++ b/drmplane.cpp @@ -42,7 +42,7 @@ int DrmPlane::Init() { } 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 @@ std::string DrmProperty::name() const { 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 @@ class DrmProperty { 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: |