FS#10446 - Prevent potential problems in dsp.c by allowing for 0 count function calls

Attached to Project: Rockbox
Opened by Jeffrey Goode (Blue_Dude) - Saturday, 18 July 2009, 03:59 GMT
Last edited by Jeffrey Goode (Blue_Dude) - Wednesday, 12 August 2009, 20:25 GMT
Task Type Bugs
Category Music playback
Status Closed
Assigned To No-one
Operating System SW-codec
Severity Low
Priority Normal
Reported Version Version 3.3
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


There are a number of functions in dsp.c that operate with a do-while loop. Most of these are contingent upon the count argument being greater than zero. While this should always be true, these functions are not fault tolerant and will exhibit unwanted results if called with a count of zero. So I've changed these do-while loops to equivalent while loops.

I've also changed an unrelated comment mistake describing the nature of a replaygain variable.
This task depends upon

Closed by  Jeffrey Goode (Blue_Dude)
Wednesday, 12 August 2009, 20:25 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed in r22282
Comment by Jeffrey Goode (Blue_Dude) - Saturday, 18 July 2009, 16:47 GMT
Oops. That one had some extra semi colons. This one works.
Comment by Magnus Holmgren (learman) - Saturday, 25 July 2009, 08:17 GMT
Actually, that comment is more appropriate at the right-shift in set_gain... (And ouch, I should've moved that comment :) ).
Comment by Jeffrey Goode (Blue_Dude) - Monday, 10 August 2009, 04:58 GMT
There was some concern that this patch may affect processing speed. After benchmarking with an improved test_codec, I can confirm that it does not affect performance.