Logo Search packages:      
Sourcecode: pulseaudio version File versions  Download package

char* pa_bytes_snprint ( char *  s,
size_t  l,
unsigned  v 

Pretty print a byte size value. (i.e. "2.5 MiB")

Definition at line 135 of file sample.c.


    if (v >= ((unsigned) 1024)*1024*1024)
        pa_snprintf(s, l, "%0.1f GiB", ((double) v)/1024/1024/1024);
    else if (v >= ((unsigned) 1024)*1024)
        pa_snprintf(s, l, "%0.1f MiB", ((double) v)/1024/1024);
    else if (v >= (unsigned) 1024)
        pa_snprintf(s, l, "%0.1f KiB", ((double) v)/1024);
        pa_snprintf(s, l, "%u B", (unsigned) v);

    return s;

Generated by  Doxygen 1.6.0   Back to index