[En-Nut-Discussion] Bug in NutSegReadCommit

Pete Allinson pete at peteallinson.plus.com
Wed Nov 24 21:38:19 CET 2004


Hello Harald,

Have I spotted a bug in NutSegReadCommit() and NutSegReadLast().  (I've got 
release 3.9.2 of Nut/OS.)

These routines set the segbuf_empty flag when the read pointer and the 
write pointer are equal.  I think the test should include a comparison of 
the read and write segments as well:

if ((segbuf_rp == segbuf_wp) && (segbuf_rs == segbuf_ws)) {
     segbuf_empty = 1;
}

With the test as it is I find that NutSegBufReadRequest(bcp) sets bcp to 
zero when there is in fact a multiple of 16384 (NUTBANK _SIZE) bytes in the 
buffer.
This leads to hiccups in the feed to the VS1001K.

If the bug is real, let me know and I'll log it at SourceForge.

Regards,
Pete Allinson




More information about the En-Nut-Discussion mailing list