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

Commit 4c7ad8f5 authored by Jooyung Han's avatar Jooyung Han Committed by Gerrit Code Review
Browse files

Merge "Use std::optional instead of std::unique_ptr"

parents 34965b12 22788299
Loading
Loading
Loading
Loading
+4 −13
Original line number Diff line number Diff line
@@ -41,28 +41,19 @@ status_t ScanFilter::writeToParcel(Parcel* parcel) const {

  // TODO(jpawlowski) make type casting nicer
  // uuid won't really keep ownership, it's just for type casting
  std::unique_ptr<UUID> uuid;
  UUID tmp;
  std::optional<UUID> uuid;

  if (service_uuid_) {
    tmp = *service_uuid_;
    uuid.reset(&tmp);
  } else {
    uuid.reset(nullptr);
    uuid = *service_uuid_;
  }
  status = parcel->writeNullableParcelable(uuid);
  uuid.release();
  if (status != OK) return status;

  uuid.reset();
  if (service_uuid_mask_) {
    tmp = *service_uuid_mask_;
    uuid.reset(&tmp);
  } else {
    uuid.reset(nullptr);
    uuid = *service_uuid_mask_;
  }
  status = parcel->writeNullableParcelable(uuid);
  uuid.release();

  return status;
}