Index: include/libroar/vs.h
===================================================================
--- include/libroar/vs.h	(revision 5078)
+++ include/libroar/vs.h	(revision 5109)
@@ -39,4 +39,6 @@
 #include "libroar.h"
 
+#define _LIBROAR_VS_STDATTRS _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1)
+
 struct roar_vs;
 
@@ -45,5 +47,5 @@
 
 /* return readable string describing the problem */
-const char * roar_vs_strerr(int error);
+const char * roar_vs_strerr(int error) _LIBROAR_ATTR_PURE _LIBROAR_ATTR_USE_RESULT;
 
 /* create a new VS object from normal RoarAudio connection object
@@ -51,16 +53,16 @@
  * The connection is not closed by roar_vs_close().
  */
-roar_vs_t * roar_vs_new_from_con(struct roar_connection * con, int * error);
+roar_vs_t * roar_vs_new_from_con(struct roar_connection * con, int * error) _LIBROAR_VS_STDATTRS;
 
 /* create a new VS object with a new connection */
-roar_vs_t * roar_vs_new(const char * server, const char * name, int * error);
+roar_vs_t * roar_vs_new(const char * server, const char * name, int * error) _LIBROAR_ATTR_USE_RESULT;
 
 /* start a the stream in the VS object */
-int roar_vs_stream(roar_vs_t * vss, const struct roar_audio_info * info, int dir, int * error);
+int roar_vs_stream(roar_vs_t * vss, const struct roar_audio_info * info, int dir, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1, 2);
 
 /* connect to server and start stream in once
  * this is basically roar_vs_new() and roar_vs_stream() in one function.
  */
-roar_vs_t * roar_vs_new_simple(const char * server, const char * name, int rate, int channels, int codec, int bits, int dir, int * error);
+roar_vs_t * roar_vs_new_simple(const char * server, const char * name, int rate, int channels, int codec, int bits, int dir, int * error) _LIBROAR_ATTR_USE_RESULT;
 
 /* create a VS object for playback.
@@ -73,13 +75,13 @@
  */
 
-int roar_vs_file(roar_vs_t * vss, struct roar_vio_calls * vio, int closefile, int * error);
+int roar_vs_file(roar_vs_t * vss, struct roar_vio_calls * vio, int closefile, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1, 2);
 
 /* Open a file and attach it.
  */
-int roar_vs_file_simple(roar_vs_t * vss, char * filename, int * error);
+int roar_vs_file_simple(roar_vs_t * vss, char * filename, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1, 2);
 
 /* Connects to a server to just play a file.
  */
-roar_vs_t * roar_vs_new_from_file(const char * server, const char * name, char * filename, int * error);
+roar_vs_t * roar_vs_new_from_file(const char * server, const char * name, char * filename, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(3);
 
 /* Switch to buffered mode.
@@ -92,5 +94,5 @@
  * Buffer size should be a value of 2^n. Typical values are 2048 and 4096.
  */
-int roar_vs_buffer(roar_vs_t * vss, size_t buffer, int * error);
+int roar_vs_buffer(roar_vs_t * vss, size_t buffer, int * error) _LIBROAR_VS_STDATTRS;
 
 
@@ -109,5 +111,5 @@
  * If server connection was provided by caller it is untouched.
  */
-int roar_vs_close(roar_vs_t * vss, int killit, int * error);
+int roar_vs_close(roar_vs_t * vss, int killit, int * error) _LIBROAR_ATTR_NONNULL(1);
 
 /* write data to a stream
@@ -119,5 +121,5 @@
  * you should wait some (short!) time (for example one main loop iteration) and try again.
  */
-ssize_t roar_vs_write(roar_vs_t * vss, const void * buf, size_t len, int * error);
+ssize_t roar_vs_write(roar_vs_t * vss, const void * buf, size_t len, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1, 2);
 
 /* read data from a stream
@@ -129,5 +131,5 @@
  * you should wait some (short!) time (for example one main loop iteration) and try again.
  */
-ssize_t roar_vs_read (roar_vs_t * vss,       void * buf, size_t len, int * error);
+ssize_t roar_vs_read (roar_vs_t * vss,       void * buf, size_t len, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1, 2);
 
 /* wait value for waiting */
@@ -141,10 +143,10 @@
  * Returns 0 on no error and -1 on error.
  */
-int     roar_vs_sync (roar_vs_t * vss, int wait, int * error);
+int     roar_vs_sync (roar_vs_t * vss, int wait, int * error) _LIBROAR_ATTR_NONNULL(1);
 
 /* set blocking mode of stream
  * returns old blocking state
  */
-int     roar_vs_blocking (roar_vs_t * vss, int val, int * error);
+int     roar_vs_blocking (roar_vs_t * vss, int val, int * error) _LIBROAR_VS_STDATTRS;
 
 /* do not supply backend offset */
@@ -162,5 +164,5 @@
  * plus a offset provided by the selected backend
  */
-ssize_t roar_vs_position(roar_vs_t * vss, int backend, int * error);
+ssize_t roar_vs_position(roar_vs_t * vss, int backend, int * error) _LIBROAR_VS_STDATTRS;
 
 /* get latency between playback and local write counter
@@ -174,6 +176,6 @@
  * ahead of us). This is normal in case we read a stream.
  */
-roar_mus_t roar_vs_latency(roar_vs_t * vss, int backend, int * error);
-roar_mus_t roar_vs_latency2(roar_vs_t * vss, int backend, int wait, int * error);
+roar_mus_t roar_vs_latency(roar_vs_t * vss, int backend, int * error) _LIBROAR_VS_STDATTRS _LIBROAR_ATTR_DEPRECATED;
+roar_mus_t roar_vs_latency2(roar_vs_t * vss, int backend, int wait, int * error) _LIBROAR_VS_STDATTRS;
 
 /* set pause flag
@@ -182,5 +184,5 @@
  * returns old pause setting (useful with ROAR_VS_TOGGLE)
  */
-int     roar_vs_pause(roar_vs_t * vss, int val, int * error);
+int     roar_vs_pause(roar_vs_t * vss, int val, int * error) _LIBROAR_ATTR_NONNULL(1);
 
 /* set the mute flag of the stream
@@ -191,5 +193,5 @@
  * returns old mute setting (useful with ROAR_VS_TOGGLE)
  */
-int     roar_vs_mute (roar_vs_t * vss, int val, int * error);
+int     roar_vs_mute (roar_vs_t * vss, int val, int * error) _LIBROAR_ATTR_NONNULL(1);
 
 /* set volume of stream (all channels to the same value)
@@ -197,10 +199,10 @@
  * Returns 0 on no error and -1 on error.
  */
-int     roar_vs_volume_mono   (roar_vs_t * vss, float c, int * error);
+int     roar_vs_volume_mono   (roar_vs_t * vss, float c, int * error) _LIBROAR_ATTR_NONNULL(1);
 /* set volume of stream (like volume + balance, stereo mode)
  * volume l and r are floats from 0 ('muted', see above) to 1 (full volume).
  * Returns 0 on no error and -1 on error.
  */
-int     roar_vs_volume_stereo (roar_vs_t * vss, float l, float r, int * error);
+int     roar_vs_volume_stereo (roar_vs_t * vss, float l, float r, int * error) _LIBROAR_ATTR_NONNULL(1);
 
 /* get volume from stream (like volume + balance, stereo mode)
@@ -210,5 +212,5 @@
  * you can just use: c = (*l + *r)/2
  */
-int     roar_vs_volume_get    (roar_vs_t * vss, float * l, float * r, int * error);
+int     roar_vs_volume_get    (roar_vs_t * vss, float * l, float * r, int * error) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL(1, 2, 3);
 
 /* set an array of meta data for the stream
@@ -222,5 +224,5 @@
  * ret = roar_vs_meta(vss, &kv, 1, &err);
  */
-int     roar_vs_meta          (roar_vs_t * vss, struct roar_keyval * kv, size_t len, int * error);
+int     roar_vs_meta          (roar_vs_t * vss, struct roar_keyval * kv, size_t len, int * error) _LIBROAR_ATTR_NONNULL(1, 2);
 
 /* sets the stream role
@@ -228,5 +230,5 @@
  * Returns 0 on no error and -1 on error.
  */
-int     roar_vs_role          (roar_vs_t * vss, int role, int * error);
+int     roar_vs_role          (roar_vs_t * vss, int role, int * error) _LIBROAR_ATTR_NONNULL(1);
 
 /* Run a single iteration.
@@ -235,5 +237,5 @@
  * Returns -1 on error, 0 on EOF and positive true value on no error.
  */
-int     roar_vs_iterate       (roar_vs_t * vss, int wait, int * error);
+int     roar_vs_iterate       (roar_vs_t * vss, int wait, int * error) _LIBROAR_ATTR_NONNULL(1);
 
 /* Iterate until EOF or error.
@@ -241,8 +243,8 @@
  * Returns 0 on no error and -1 on error.
  */
-int     roar_vs_run           (roar_vs_t * vss, int * error);
-
-ssize_t roar_vs_get_avail_read(roar_vs_t * vss, int * error);
-ssize_t roar_vs_get_avail_write(roar_vs_t * vss, int * error);
+int     roar_vs_run           (roar_vs_t * vss, int * error) _LIBROAR_ATTR_NONNULL(1);
+
+ssize_t roar_vs_get_avail_read(roar_vs_t * vss, int * error) _LIBROAR_VS_STDATTRS;
+ssize_t roar_vs_get_avail_write(roar_vs_t * vss, int * error) _LIBROAR_VS_STDATTRS;
 
 /* If in buffered mode drop all data from internal buffer.
@@ -252,5 +254,5 @@
  * but should be avoided as it may break the bitstream.
  */
-int     roar_vs_reset_buffer(roar_vs_t * vss, int writering, int readring, int * error);
+int     roar_vs_reset_buffer(roar_vs_t * vss, int writering, int readring, int * error) _LIBROAR_VS_STDATTRS _LIBROAR_ATTR_DEPRECATED;
 
 /* Misc controls.
@@ -317,5 +319,5 @@
 #define ROAR_VS_ASYNCLEVEL_AUTO   2
 
-int     roar_vs_ctl           (roar_vs_t * vss, roar_vs_ctlcmd cmd, void * argp, int * error);
+int     roar_vs_ctl           (roar_vs_t * vss, roar_vs_ctlcmd cmd, void * argp, int * error) _LIBROAR_VS_STDATTRS;
 
 
@@ -324,5 +326,5 @@
  * Returns used connection object or NULL on error.
  */
-struct roar_connection * roar_vs_connection_obj(roar_vs_t * vss, int * error);
+struct roar_connection * roar_vs_connection_obj(roar_vs_t * vss, int * error) _LIBROAR_VS_STDATTRS;
 
 /* Get used stream object
@@ -330,5 +332,5 @@
  * Returns used stream object or NULL on error.
  */
-struct roar_stream     * roar_vs_stream_obj    (roar_vs_t * vss, int * error);
+struct roar_stream     * roar_vs_stream_obj    (roar_vs_t * vss, int * error) _LIBROAR_VS_STDATTRS;
 
 /* Get used VIO object
@@ -338,5 +340,5 @@
  * Returns used VIO object or NULL on error.
  */
-struct roar_vio_calls  * roar_vs_vio_obj       (roar_vs_t * vss, int * error);
+struct roar_vio_calls  * roar_vs_vio_obj       (roar_vs_t * vss, int * error) _LIBROAR_VS_STDATTRS;
 
 /* send NOOP command to server
