From: Daryle Walker (dwalker07_at_[hidden])
Date: 2003-06-17 01:53:09
On Monday, June 16, 2003, at 9:09 AM, Vladimir Prus wrote:
> Daryle Walker wrote:
>> In CVS, I added an example file to the CRC library. I changed the
>> documentation to point to the example file.
> I see this code in the example:
> ifs.read( buffer, buffer_size );
> len = ifs.gcount();
> result.process_bytes( buffer, len );
> } while ( ifs && (buffer_size == len) );
> and I think that check for "buffer_size == len" is not needed. If
> 'read' fails to read 'buffer_size' bytes, it must set both eofbit and
> failbit, so "ifs" will evaluate to false. Is there any particular
> reason you have the check here --- maybe some library is buggy?
No, I was trying to be double-sure that the loop ended. I've removed
the extra "buffer_size == len" test (and optimized the resulting loop).
> Also, as long as the program accepts several files as arguments, it's
> probably better to output CRC for each file, not for all of them.
If you want separate CRCs, then run the program multiple times. If we
switch to the way you want it, then the only way to get a combined CRC
would to join everything to a giant file first. I probably won't
change it; the program is meant only as an example, not for industrial
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk