From 64b424c1e8a31e372729958fb7ca337aeff8ee75 Mon Sep 17 00:00:00 2001 From: Matthew Morley Date: Sun, 1 Oct 2023 11:13:28 -0400 Subject: [PATCH] Fix implicit cast in C++ land --- .../native/cpp/photonlib/MultiTargetPNPResult.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/photon-lib/src/main/native/cpp/photonlib/MultiTargetPNPResult.cpp b/photon-lib/src/main/native/cpp/photonlib/MultiTargetPNPResult.cpp index c35cae16b7..03208e83ef 100644 --- a/photon-lib/src/main/native/cpp/photonlib/MultiTargetPNPResult.cpp +++ b/photon-lib/src/main/native/cpp/photonlib/MultiTargetPNPResult.cpp @@ -30,11 +30,12 @@ Packet& operator<<(Packet& packet, const MultiTargetPnpResult& target) { packet << target.result; size_t i; - for (i = 0; i < target.fiducialIdsUsed.size(); i++) { - packet << target.fiducialIdsUsed[i]; - } - for (; i < target.fiducialIdsUsed.capacity(); i++) { - packet << -128; + for (i = 0; i < target.fiducialIdsUsed.capacity(); i++) { + if (i < target.fiducialIdsUsed.size()) { + packet << static_cast(target.fiducialIdsUsed[i]); + } else { + packet << static_cast(-128); + } } return packet; @@ -100,6 +101,7 @@ Packet& operator<<(Packet& packet, PNPResults const& result) { return packet; } + Packet& operator>>(Packet& packet, PNPResults& result) { packet >> result.isValid >> result.best >> result.alt >> result.bestReprojectionErr >> result.altReprojectionErr >>