From fc0b1da4eda489deff77ade415b78178772ab9b3 Mon Sep 17 00:00:00 2001 From: Sean Paul Date: Wed, 6 Mar 2019 09:48:42 -0500 Subject: drm_hwcomposer: Change return type of DrmProperty::value() to tuple To keep consistent with other functions Change-Id: I11ba07eabcee08f3db09b3a5422bc480482a62c1 Signed-off-by: Sean Paul --- drmplane.cpp | 2 +- drmproperty.cpp | 23 +++++++++-------------- 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 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 value() const; bool immutable() const; private: -- cgit v1.2.3