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

Commit 932fb4f2 authored by Tianyu Jiang's avatar Tianyu Jiang
Browse files

Change return values of type status_t from NO_ERROR to OK

in bufferhub related directories

Bug: 118696702
Fixes: 118696702
Test: all tests pass.
AHardwareBufferTest BufferHubBuffer_test BufferHubMetadata_test
buffer_hub_binder_service-test buffer_hub_queue_producer-test
libgui_test libsensor_test vrflinger_test buffer_hub-test
buffer_hub_queue-test dvr_buffer_queue-test dvr_api-test
dvr_display-test

Change-Id: Iee198ddbec035856185fcab34b0d631bd3726b77
parent df306c8a
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -26,14 +26,14 @@ bool BpBufferClient::isValid() {
  Parcel data, reply;
  status_t ret =
      data.writeInterfaceToken(IBufferClient::getInterfaceDescriptor());
  if (ret != NO_ERROR) {
  if (ret != OK) {
    ALOGE("BpBufferClient::isValid: failed to write into parcel; errno=%d",
          ret);
    return false;
  }

  ret = remote()->transact(IS_VALID, data, &reply);
  if (ret == NO_ERROR) {
  if (ret == OK) {
    return reply.readBool();
  } else {
    ALOGE("BpBufferClient::isValid: failed to transact; errno=%d", ret);
@@ -45,16 +45,16 @@ status_t BpBufferClient::duplicate(uint64_t* outToken) {
  Parcel data, reply;
  status_t ret =
      data.writeInterfaceToken(IBufferClient::getInterfaceDescriptor());
  if (ret != NO_ERROR) {
  if (ret != OK) {
    ALOGE("BpBufferClient::duplicate: failed to write into parcel; errno=%d",
          ret);
    return ret;
  }

  ret = remote()->transact(DUPLICATE, data, &reply);
  if (ret == NO_ERROR) {
  if (ret == OK) {
    *outToken = reply.readUint64();
    return NO_ERROR;
    return OK;
  } else {
    ALOGE("BpBufferClient::duplicate: failed to transact; errno=%d", ret);
    return ret;
@@ -72,7 +72,7 @@ status_t BnBufferClient::onTransact(uint32_t code, const Parcel& data,
      CHECK_INTERFACE(IBufferClient, data, reply);
      uint64_t token = 0;
      status_t ret = duplicate(&token);
      if (ret != NO_ERROR) {
      if (ret != OK) {
        return ret;
      }
      return reply->writeUint64(token);
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ class IonBuffer {
  IonBuffer& operator=(IonBuffer&& other) noexcept;

  // Returns check this IonBuffer holds a valid Gralloc buffer.
  bool IsValid() const { return buffer_ && buffer_->initCheck() == NO_ERROR; }
  bool IsValid() const { return buffer_ && buffer_->initCheck() == OK; }

  // Frees the underlying native handle and leaves the instance initialized to
  // empty.
+3 −3
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ int IonBuffer::Lock(uint32_t usage, int x, int y, int width, int height,

  status_t err =
      buffer_->lock(usage, Rect(x, y, x + width, y + height), address);
  if (err != NO_ERROR)
  if (err != OK)
    return -EINVAL;
  else
    return 0;
@@ -220,7 +220,7 @@ int IonBuffer::LockYUV(uint32_t usage, int x, int y, int width, int height,

  status_t err =
      buffer_->lockYCbCr(usage, Rect(x, y, x + width, y + height), yuv);
  if (err != NO_ERROR)
  if (err != OK)
    return -EINVAL;
  else
    return 0;
@@ -231,7 +231,7 @@ int IonBuffer::Unlock() {
  ALOGD_IF(TRACE, "IonBuffer::Unlock: handle=%p", handle());

  status_t err = buffer_->unlock();
  if (err != NO_ERROR)
  if (err != OK)
    return -EINVAL;
  else
    return 0;
+5 −5
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ class BufferTransportService : public BBinder {
        reply->writeStrongBinder(
            IGraphicBufferProducer::asBinder(new_queue->producer));
        buffer_queues_.push_back(new_queue);
        return NO_ERROR;
        return OK;
      }
      default:
        return UNKNOWN_TRANSACTION;
@@ -89,7 +89,7 @@ class BufferTransportService : public BBinder {
                                                   /*waitForFence=*/false);
      }

      if (ret != NO_ERROR) {
      if (ret != OK) {
        LOG(ERROR) << "Failed to acquire next buffer.";
        return;
      }
@@ -99,7 +99,7 @@ class BufferTransportService : public BBinder {
        ret = buffer_item_consumer_->releaseBuffer(buffer);
      }

      if (ret != NO_ERROR) {
      if (ret != OK) {
        LOG(ERROR) << "Failed to release buffer.";
        return;
      }
@@ -171,14 +171,14 @@ class BinderBufferTransport : public BufferTransport {
    Parcel data;
    Parcel reply;
    int error = service_->transact(CREATE_BUFFER_QUEUE, data, &reply);
    if (error != NO_ERROR) {
    if (error != OK) {
      LOG(ERROR) << "Failed to get buffer queue over binder.";
      return nullptr;
    }

    sp<IBinder> binder;
    error = reply.readNullableStrongBinder(&binder);
    if (error != NO_ERROR) {
    if (error != OK) {
      LOG(ERROR) << "Failed to get IGraphicBufferProducer over binder.";
      return nullptr;
    }
+3 −3
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ status_t BufferHubQueueParcelable<Magic>::writeToParcel(Parcel* parcel) const {
  }

  status_t res = parcel->writeUint32(Magic);
  if (res != NO_ERROR) {
  if (res != OK) {
    ALOGE("BufferHubQueueParcelable::writeToParcel: Cannot write magic.");
    return res;
  }
@@ -53,10 +53,10 @@ status_t BufferHubQueueParcelable<Magic>::readFromParcel(const Parcel* parcel) {
  }

  uint32_t out_magic = 0;
  status_t res = NO_ERROR;
  status_t res = OK;

  res = parcel->readUint32(&out_magic);
  if (res != NO_ERROR)
  if (res != OK)
    return res;

  if (out_magic != Magic) {
Loading