From fd9d014a825386e628886046ee8a9e4dc3495fdf Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 29 Oct 2024 10:35:08 -0400 Subject: [PATCH] Fix returning -1 to an unsigned int return value in getLastRead/WriteIndex --- src/zm_monitor.cpp | 4 ++-- src/zm_monitor.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 03d0b00bdb..4f52ad34ff 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1378,11 +1378,11 @@ SystemTimePoint Monitor::GetTimestamp(int index) const { return {}; } -unsigned int Monitor::GetLastReadIndex() const { +int Monitor::GetLastReadIndex() const { return ( shared_data->last_read_index != image_buffer_count ? shared_data->last_read_index : -1 ); } -unsigned int Monitor::GetLastWriteIndex() const { +int Monitor::GetLastWriteIndex() const { return ( shared_data->last_write_index != image_buffer_count ? shared_data->last_write_index : -1 ); } diff --git a/src/zm_monitor.h b/src/zm_monitor.h index 3e671109f6..aa7c0c2a91 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -840,8 +840,8 @@ class Monitor : public std::enable_shared_from_this { unsigned int GetCaptureMaxFPS() const { return capture_max_fps; } Microseconds GetCaptureDelay() const { return capture_delay; } Microseconds GetAlarmCaptureDelay() const { return alarm_capture_delay; } - unsigned int GetLastReadIndex() const; - unsigned int GetLastWriteIndex() const; + int GetLastReadIndex() const; + int GetLastWriteIndex() const; uint64_t GetLastEventId() const; double GetFPS() const; void UpdateFPS();