obexapp spinner arithmetic error

Iain Hibbert plunky at rya-online.net
Tue Oct 19 11:30:38 UTC 2010


Hi,

I notice sometimes that obexapp backsteps to the end of the previous line
after it has finished, because of an extraneous backspace..  I traced this
to an arithmetic error in obexapp_event_progress() function, as spinner[]
array has 5 characters plus a terminating NUL character, so sizeof = 6.

patch attached to fix this

regards,
iain
-------------- next part --------------
--- event.c.orig	2009-08-20 22:57:18.000000000 +0100
+++ event.c	2010-10-19 12:25:55.000000000 +0100
@@ -137,7 +137,7 @@ obexapp_event_progress(obex_t *handle, _
 		static uint32_t	spinner_idx = 0;
 
 		printf("%c\b", spinner[spinner_idx ++]);
-		if (spinner_idx >= sizeof(spinner)/sizeof(spinner[0]))
+		if (spinner_idx == (sizeof(spinner)/sizeof(spinner[0]) - 1))
 			spinner_idx = 0;
 	}
 } /* obexapp_event_progress */


More information about the freebsd-bluetooth mailing list