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

Commit f4f6ab73 authored by George Burgess IV's avatar George Burgess IV Committed by George Burgess
Browse files

Fix a warning about redefining arraysize

Simply removing the redeclaration yields new signed/unsigned conversion
warnings, since the previously-defined arraysize (from
android-base/macros.h) hands back a size_t.

Rather than #undef'ing and continuing on, it looks like we can
trivially get away without needing arraysize at all.

Bug: None
Test: mma. Warnings disappeared.
Change-Id: I56da4dfb0e29edec10d276147e7b5d99fc32c65b
parent 534288a2
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -18,14 +18,13 @@ using android::pdx::LocalChannelHandle;
using android::pdx::Status;
using android::pdx::Transaction;

#define arraysize(x) (static_cast<int32_t>(std::extent<decltype(x)>::value))

namespace android {
namespace dvr {
namespace {

typedef CPUMappedBroadcastRing<DvrPoseRing> SensorPoseRing;

constexpr static int32_t MAX_CONTROLLERS = 2;
}  // namespace

// PoseClient is a remote interface to the pose service in sensord.
@@ -81,7 +80,7 @@ class PoseClient : public pdx::ClientBase<PoseClient> {

  int GetControllerPose(int32_t controller_id, uint32_t vsync_count,
                        DvrPoseAsync* out_pose) {
    if (controller_id < 0 || controller_id >= arraysize(controllers_)) {
    if (controller_id < 0 || controller_id >= MAX_CONTROLLERS) {
      return -EINVAL;
    }
    if (!controllers_[controller_id].mapped_pose_buffer) {
@@ -166,7 +165,7 @@ class PoseClient : public pdx::ClientBase<PoseClient> {
  }

  int GetControllerRingBuffer(int32_t controller_id) {
    if (controller_id < 0 || controller_id >= arraysize(controllers_)) {
    if (controller_id < 0 || controller_id >= MAX_CONTROLLERS) {
      return -EINVAL;
    }
    ControllerClientState& client_state = controllers_[controller_id];
@@ -254,7 +253,7 @@ class PoseClient : public pdx::ClientBase<PoseClient> {
    std::unique_ptr<BufferConsumer> pose_buffer;
    const DvrPoseAsync* mapped_pose_buffer = nullptr;
  };
  ControllerClientState controllers_[2];
  ControllerClientState controllers_[MAX_CONTROLLERS];
};

}  // namespace dvr