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 177 of file sample.c.

                                                      {
    pa_assert(s);
    pa_assert(l > 0);

    pa_init_i18n();

    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);
    else
        pa_snprintf(s, l, _("%u B"), (unsigned) v);

    return s;
}


Generated by  Doxygen 1.6.0   Back to index