fix: cast size_t to unsigned long in printf format specifiers
Prevent potential format string mismatches on platforms where size_t and unsigned long may have different sizes by explicitly casting size_t variables to unsigned long when using %lu format specifier in printf calls.
This commit is contained in:
+2
-2
@@ -55,12 +55,12 @@ int main(int argc, char **argv)
|
|||||||
while (!stop) {
|
while (!stop) {
|
||||||
size_t events = stk_poll();
|
size_t events = stk_poll();
|
||||||
if (events > 0)
|
if (events > 0)
|
||||||
printf("Poll: %lu module event(s) detected\n", events);
|
printf("Poll: %lu module event(s) detected\n", (unsigned long) events);
|
||||||
|
|
||||||
iterations++;
|
iterations++;
|
||||||
if (iterations % 5 == 0) {
|
if (iterations % 5 == 0) {
|
||||||
printf("Still running... (iteration %lu)\n",
|
printf("Still running... (iteration %lu)\n",
|
||||||
iterations);
|
(unsigned long) iterations);
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
|
|||||||
Reference in New Issue
Block a user