Hi!
22-Мар-2004 16:56 [EMAIL PROTECTED] (Bart Oldeman) wrote to
[EMAIL PROTECTED]:
BO> +++ fatfs.c 22 Mar 2004 16:56:33 -0000 1.57
BO> + xfr_cnt = count < (ULONG) secsize - boff ?
BO> + (UWORD) count : secsize - boff;
I not check this, but, probably, better if there will no cast to ULONG?
Or, even so:
xfr_cnt = secsize - boff;
if (xfr_cnt > count)
xfr_cnt = (UWORD)count;
BO> /* get a buffer to store the block in */
BO> + if ((boff == 0) && (xfr_cnt == secsize))
This condition may be simplified (because previous computation for
xfr_cnt, it may be equal to secsize only when boff==0):
if (xfr_cnt == secsize)
BO> /* set a block to zero */
BO> + fmemset((BYTE FAR *) & bp->b_buffer[boff], 0, xfr_cnt);
Casting here is unneed - see definition for buffer.h/buffer::b_buffer
and other calls to fmem*(...b_buffer...):
fmemset (bp->b_buffer + boff, 0, xfr_cnt);
BO> + sectors_to_xfer = fnp->f_dpb->dpb_clsmask + 1 - sector;
BO> sectors_to_xfer = min(sectors_to_xfer, sectors_wanted);
Why not as next?
sectors_to_xfer = fnp->f_dpb->dpb_clsmask + 1 - sector;
if (sectors_to_xfer > sectors_wanted)
sectors_to_xfer = sectors_wanted;
BO> + xfr_cnt = min(to_xfer, secsize - boff);
Especially, min() with expression isn't good idea. Why not as next?
xfr_cnt = secsize - boff;
if (xfr_cnt > to_xfer)
xfr_cnt = to_xfer;
BO> + fmemcpy(&bp->b_buffer[boff], buffer, xfr_cnt);
As above:
fmemcpy (bp->b_buffer + boff, buffer, xfr_cnt);
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel