diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-09-01 16:24:41 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-09-01 16:24:41 -0700 |
commit | c36029fc806cf083de3aaf1344d6bd2be8db316f (patch) | |
tree | da88b1f073b8125d764b94b924492d2b05ea4c69 /src/ringbuf.h | |
parent | aa0755f53545fcf343f791f04760f6b934e022e4 (diff) | |
parent | 6982a829e22d2bc7cf7c829c4430a4ea6f5bc7fa (diff) | |
download | mpd-c36029fc806cf083de3aaf1344d6bd2be8db316f.tar.gz mpd-c36029fc806cf083de3aaf1344d6bd2be8db316f.tar.xz mpd-c36029fc806cf083de3aaf1344d6bd2be8db316f.zip |
Merge branch 'mk/cleanups'
* mk/cleanups: (60 commits)
pass constant pointers
const pointers
unsigned integers and size_t
oggflac: fix GCC warnings
include cleanup
protect locate.h from double inclusion
playlist: eliminate unused fd parameters
jack: made "sample_size" static const
moved jack configuration to the JackData struct
jack: removed unused macros
jack: don't set audioOutput->data=NULL
jack: initialize JackData in jack_initDriver()
jack: added freeJackClient()
jack: initialize jd->client after !jd check
jack: eliminate superfluous freeJackData() calls
mp3: converted the MUTEFRAME_ macros to an enum
mp3: converted the DECODE_ constants to an enum
wavpack: don't use "isp" before initialization
wavpack: moved code to wavpack_open_wvc()
simplified code in the ogg decoder plugin
...
Diffstat (limited to 'src/ringbuf.h')
-rw-r--r-- | src/ringbuf.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/ringbuf.h b/src/ringbuf.h index 43ba83a7c..6225fcadf 100644 --- a/src/ringbuf.h +++ b/src/ringbuf.h @@ -39,13 +39,19 @@ */ struct ringbuf { - void *buf; + unsigned char *buf; size_t write_ptr; size_t read_ptr; size_t size; size_t size_mask; }; +/* remain binary-compatible with struct iovec declared in <sys/uio.h>: */ +struct rbvec { + unsigned char *base; + size_t len; +}; + /** * Allocates a ringbuffer data structure of a specified size. The * caller must arrange for a call to ringbuf_free() to release @@ -69,7 +75,7 @@ void ringbuf_free(struct ringbuf * rb); /** * Fill a data structure with a description of the current readable * data held in the ringbuffer. This description is returned in a two - * element array of struct iovec. Two elements are needed + * element array of struct rbvec. Two elements are needed * because the data to be read may be split across the end of the * ringbuffer. * @@ -83,16 +89,16 @@ void ringbuf_free(struct ringbuf * rb); * its corresponding @a buf field. * * @param rb a pointer to the ringbuffer structure. - * @param vec a pointer to a 2 element array of struct iovec. + * @param vec a pointer to a 2 element array of struct rbvec. * * @return total number of bytes readable into both vec elements */ -size_t ringbuf_get_read_vector(const struct ringbuf * rb, struct iovec * vec); +size_t ringbuf_get_read_vector(const struct ringbuf * rb, struct rbvec * vec); /** * Fill a data structure with a description of the current writable * space in the ringbuffer. The description is returned in a two - * element array of struct iovec. Two elements are needed + * element array of struct rbvec. Two elements are needed * because the space available for writing may be split across the end * of the ringbuffer. * @@ -106,11 +112,11 @@ size_t ringbuf_get_read_vector(const struct ringbuf * rb, struct iovec * vec); * the corresponding @a buf field. * * @param rb a pointer to the ringbuffer structure. - * @param vec a pointer to a 2 element array of struct iovec. + * @param vec a pointer to a 2 element array of struct rbvec. * * @return total number of bytes writable in both vec elements */ -size_t ringbuf_get_write_vector(const struct ringbuf * rb, struct iovec * vec); +size_t ringbuf_get_write_vector(const struct ringbuf * rb, struct rbvec * vec); /** * Read data from the ringbuffer. |