Logo Search packages:      
Sourcecode: wvstreams version File versions

WvString sizetoa ( unsigned long long  blocks,
unsigned int  blocksize = 1 

Given a number of blocks and a blocksize (default==1 byte), return a WvString containing a human-readable representation of blocks*blocksize.

Definition at line 571 of file strutils.cc.

References sizetoa().

Referenced by sizetoa().

    unsigned long long bytes = blocks * blocksize;

    // Test if we are dealing in just bytes.  Plus, we should ensure
    // that we didn't overflow.  (Although that is highly unlikely,
    // with a 64-bit integer.)
    if ((bytes < 1000) && !(blocks * blocksize / 1000))
        return WvString("%s bytes", blocks * blocksize);

    return _sizetoa(bytes, 1);

Generated by  Doxygen 1.6.0   Back to index