Hi Arkady,

> +          if (FAT32_Free_Space.free_clusters >= 0x80000000l / clustersize)
>      Should be `ul', else there is signed division. Or, use "> LONG_MAX /
> clustersize" (where LONG_MAX defined in limits.h as 0x7FFFFFFFl).

Good point.

> +                for (shift = 21; --shift;)
> +                        {
> +                        if ((clustersize & 1) == 0) clustersize >>= 1;
> +                        else FAT32_Free_Space.free_clusters >>= 1;
> +                        }
> 
>      After this loop clustersize==1...

Yes but this is intended: Shift clustersize AND FAT32_Free_Space.free_clusters
BOTH right instead of dividing by (1024*1024), but avoid losing significant
bits in clustersize and more-than-needed significant bits in free_clusters...
Nice idea by Tom :-).

> +                convert(FAT32_Free_Space.free_clusters * clustersize,
...
> ...so this multiplication equal to ".free_clusters * 1". Forgeted to
> eliminate multiplication?

Depends. The whole story started when we found out that NTFS4DOS uses
invented cluster sizes (like "64 sectors of 32kilobytes each") when
it reports the amount of free/used space through the FAT32 interface
int 21.7303... Such invented cluster sizes can be bigger than 1 MB,
and I would not be surprised if some tools even use values which are
no powers of 2, so it is probably better to keep the multiplication in.
And, again, clustersize can be 2 MB, that >>= 20 is still more than 1.

Eric



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to