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

Commit f0ae8197 authored by Jooyung Han's avatar Jooyung Han Committed by Automerger Merge Worker
Browse files

Merge "Use std::optional instead of std::unique_ptr" am: 4c7ad8f5 am: 5a4ff027 am: 5555efa5

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1501916

Change-Id: I42177a0c493784cd0d125c68f1f636433d00cdd0
parents fef741fa 5555efa5
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;
}