Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d2a0c78 authored by Jooyung Han's avatar Jooyung Han
Browse files

Use std::optional instead of std::unique_ptr

Since Android R, Parcel provides read/write methods for "@nullable"
values using std::optional.

Bug: 149784838
Test: m
Change-Id: Ide63196c6350df30bf43dca15c9334e2f4b36ed7
parent b96da753
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -205,11 +205,11 @@ public:
private:
    status_t readFloatVector(
            const Parcel* parcel, Vector<float> *vectorPtr, size_t defaultLength) {
        std::unique_ptr<std::vector<float>> v;
        std::optional<std::vector<float>> v;
        status_t result = parcel->readFloatVector(&v);
        if (result != OK) return result;
        vectorPtr->clear();
        if (v.get() != nullptr) {
        if (v) {
            for (const auto& iter : *v) {
                vectorPtr->push_back(iter);
            }