From a879f8973660556182e8297a6318a4c875f7c272 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 12 Nov 2026 23:50:55 -0600 Subject: [PATCH] Change sleep duration to unsigned --- src/InputStream.c | 6 +++--- src/Platform.c | 6 +++--- src/PlatformThreads.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/InputStream.c b/src/InputStream.c index 95e54de..9205598 100644 --- a/src/InputStream.c +++ b/src/InputStream.c @@ -401,7 +401,7 @@ static void inputSendThreadProc(void* context) { // Delay for batching if required if (now < lastMousePacketTime + MOUSE_BATCHING_INTERVAL_MS) { flushInputOnControlStream(); - PltSleepMs((int)(lastMousePacketTime + MOUSE_BATCHING_INTERVAL_MS - now)); + PltSleepMs((uint32_t)(lastMousePacketTime + MOUSE_BATCHING_INTERVAL_MS - now)); now = PltGetMillis(); } @@ -471,7 +471,7 @@ static void inputSendThreadProc(void* context) { // Delay for batching if required if (now < lastMousePacketTime + MOUSE_BATCHING_INTERVAL_MS) { flushInputOnControlStream(); - PltSleepMs((int)(lastMousePacketTime + MOUSE_BATCHING_INTERVAL_MS - now)); + PltSleepMs((uint32_t)(lastMousePacketTime + MOUSE_BATCHING_INTERVAL_MS - now)); now = PltGetMillis(); } @@ -492,7 +492,7 @@ static void inputSendThreadProc(void* context) { // Delay for batching if required if (now < lastPenPacketTime + PEN_BATCHING_INTERVAL_MS) { flushInputOnControlStream(); - PltSleepMs((int)(lastPenPacketTime + PEN_BATCHING_INTERVAL_MS - now)); + PltSleepMs((uint32_t)(lastPenPacketTime + PEN_BATCHING_INTERVAL_MS - now)); now = PltGetMillis(); } diff --git a/src/Platform.c b/src/Platform.c index b57311a..0ed8d79 100644 --- a/src/Platform.c +++ b/src/Platform.c @@ -104,7 +104,7 @@ void* ThreadProc(void* context) { #endif } -void PltSleepMs(int ms) { +void PltSleepMs(uint32_t ms) { #if defined(LC_WINDOWS) SleepEx(ms, FALSE); #elif defined(__3DS__) @@ -120,9 +120,9 @@ void PltSleepMs(int ms) { #endif } -void PltSleepMsInterruptible(PLT_THREAD* thread, int ms) { +void PltSleepMsInterruptible(PLT_THREAD* thread, uint32_t ms) { while (ms > 0 && !PltIsThreadInterrupted(thread)) { - int msToSleep = ms < INTERRUPT_PERIOD_MS ? ms : INTERRUPT_PERIOD_MS; + uint32_t msToSleep = ms < INTERRUPT_PERIOD_MS ? ms : INTERRUPT_PERIOD_MS; PltSleepMs(msToSleep); ms -= msToSleep; } diff --git a/src/PlatformThreads.h b/src/PlatformThreads.h index 786c266..42dee21 100644 --- a/src/PlatformThreads.h +++ b/src/PlatformThreads.h @@ -73,5 +73,5 @@ void PltSignalConditionVariable(PLT_COND* cond); void PltBroadcastConditionVariable(PLT_COND* cond); void PltWaitForConditionVariable(PLT_COND* cond, PLT_MUTEX* mutex); -void PltSleepMs(int ms); -void PltSleepMsInterruptible(PLT_THREAD* thread, int ms); +void PltSleepMs(uint32_t ms); +void PltSleepMsInterruptible(PLT_THREAD* thread, uint32_t ms);