Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Oct 2010 12:30:50 +0100 (BST)
From:      Iain Hibbert <plunky@rya-online.net>
To:        freebsd-bluetooth@freebsd.org
Subject:   obexapp spinner arithmetic error
Message-ID:  <1287487850.821410.993.nullmailer@galant.ukfsn.org>

index | next in thread | raw e-mail

[-- Attachment #1 --]
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
[-- Attachment #2 --]
--- 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 */
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1287487850.821410.993.nullmailer>