Index: ChangeLog
===================================================================
--- ChangeLog	(revision 5649)
+++ ChangeLog	(revision 5651)
@@ -16,4 +16,5 @@
 	  size growth (Closes: #284)
 	* Added RAT test 'buffer_set_len'.
+	* Added compiler checks for printf() like format strings.
 
 v. 1.0beta5 - Mon Aug 20 2012 23:52 CEST
Index: include/libroar/debug.h
===================================================================
--- include/libroar/debug.h	(revision 5381)
+++ include/libroar/debug.h	(revision 5651)
@@ -74,7 +74,7 @@
 struct roar_vio_calls * roar_debug_get_stderr(void);
 
-void roar_debug_msg_simple(const char *format, ...);
+void roar_debug_msg_simple(const char *format, ...) _LIBROAR_ATTR_PRINTF(1, 2);
 
-void roar_debug_msg(int type, unsigned long int line, const char * file, const char * prefix, const char * format, ...);
+void roar_debug_msg(int type, unsigned long int line, const char * file, const char * prefix, const char * format, ...) _LIBROAR_ATTR_PRINTF(5, 6);
 
 #endif
Index: include/libroar/vio_string.h
===================================================================
--- include/libroar/vio_string.h	(revision 5381)
+++ include/libroar/vio_string.h	(revision 5651)
@@ -46,5 +46,5 @@
 char *  roar_vio_fgets   (struct roar_vio_calls * vio, char * s, size_t size) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL_ALL;
 
-int     roar_vio_printf  (struct roar_vio_calls * vio, const char *format, ...) _LIBROAR_ATTR_NONNULL(1, 2);
+int     roar_vio_printf  (struct roar_vio_calls * vio, const char *format, ...) _LIBROAR_ATTR_NONNULL(1, 2) _LIBROAR_ATTR_PRINTF(2, 3);
 
 #endif
Index: include/roaraudio/compilerhacks.h
===================================================================
--- include/roaraudio/compilerhacks.h	(revision 5381)
+++ include/roaraudio/compilerhacks.h	(revision 5651)
@@ -38,4 +38,5 @@
 #define _LIBROAR_ATTR_PURE              __attribute__ ((pure))
 #define _LIBROAR_ATTR_USE_RESULT        __attribute__ ((warn_unused_result))
+#define _LIBROAR_ATTR_PRINTF(str,args)  __attribute__ ((format (printf, str, args)))
 
 // gcc does not only add a warning on NULL argument for the following
@@ -67,4 +68,7 @@
 #define _LIBROAR_ATTR_USE_RESULT
 #endif
+#ifndef _LIBROAR_ATTR_PRINTF
+#define _LIBROAR_ATTR_PRINTF(str,args)
+#endif
 
 #ifndef _LIBROAR_IGNORE_RET
Index: libroar/auth.c
===================================================================
--- libroar/auth.c	(revision 5381)
+++ libroar/auth.c	(revision 5651)
@@ -169,5 +169,5 @@
  if ( (ret = roar_req2(con, &mes, &data, &error_frame)) == -1 ) {
   authmes->type = -1;
-  ROAR_DBG("roar_auth_ask_server(con=%p, authmes=%p) = -1 // next: -1", con, authmes, authmes->type);
+  ROAR_DBG("roar_auth_ask_server(con=%p, authmes=%p) = -1 // next: -1", con, authmes);
   return -1;
  }
Index: libroar/buffer.c
===================================================================
--- libroar/buffer.c	(revision 5647)
+++ libroar/buffer.c	(revision 5651)
@@ -191,5 +191,5 @@
 
   if ( cur->refc == 0 ) {
-   ROAR_WARN("roar_buffer_unref(buf=%p): Ref counter for buffer at %p is wrong. assuming one.", cur);
+   ROAR_WARN("roar_buffer_unref(buf=%p): Ref counter for buffer at %p is wrong. assuming one.", cur, cur);
    cur->refc = 1;
    roar_panic(ROAR_FATAL_ERROR_MEMORY_CORRUPTION, NULL);
Index: libroar/passwordapi.c
===================================================================
--- libroar/passwordapi.c	(revision 5381)
+++ libroar/passwordapi.c	(revision 5651)
@@ -44,5 +44,5 @@
 
  if ( prompt == NULL ) {
-  ROAR_WARN("roar_passwd_simple_ask_pw(pw=%p, prompt=NULL, cachetoken='%s'): No prompt given. This may be a bug in application.");
+  ROAR_WARN("roar_passwd_simple_ask_pw(pw=%p, prompt=NULL, cachetoken='%s'): No prompt given. This may be a bug in application.", pw, cachetoken);
   prompt = "Please enter Password";
  }
Index: libroar/roardl.c
===================================================================
--- libroar/roardl.c	(revision 5584)
+++ libroar/roardl.c	(revision 5651)
@@ -521,5 +521,5 @@
  (void)type;
 
- ROAR_DBG("roar_dl_getsym(lhandle=%p, sym='%s', type=%i): errno=%s(%i), dlerror()='%s'", lhandle, sym, type, ret, strerror(errno), errno, dlerror());
+ ROAR_DBG("roar_dl_getsym(lhandle=%p, sym='%s', type=%i): ret=%p, errno=%s(%i), dlerror()='%s'", lhandle, sym, type, ret, strerror(errno), errno, dlerror());
  ROAR_DBG("roar_dl_getsym(lhandle=%p, sym='%s', type=%i) = %p", lhandle, sym, type, ret);
 
Index: libroar/vio_dstr.c
===================================================================
--- libroar/vio_dstr.c	(revision 5408)
+++ libroar/vio_dstr.c	(revision 5651)
@@ -391,5 +391,5 @@
    break;
   default:
-    ROAR_DBG("roar_vio_open_default(calls=%p, def=%p, opts='%s') = -1 // error=NOTSUP", calls, def, opts, (int)def->type);
+    ROAR_DBG("roar_vio_open_default(calls=%p, def=%p, opts='%s') = -1 // error=NOTSUP", calls, def, opts);
     roar_err_set(ROAR_ERROR_NOTSUP);
     return -1;
Index: libroar/vio_zlib.c
===================================================================
--- libroar/vio_zlib.c	(revision 5388)
+++ libroar/vio_zlib.c	(revision 5651)
@@ -187,5 +187,5 @@
    return -1;
 
-  ROAR_DBG("roar_vio_zlib_read(vio=%p, buf=%p, count=%llu) = ?", vio, buf, (long long unsigned)count, self->inbuf);
+  ROAR_DBG("roar_vio_zlib_read(vio=%p, buf=%p, count=%llu) = ?", vio, buf, (long long unsigned)count);
 
   self->decompressor.next_out  = buf;
Index: libroar/vs.c
===================================================================
--- libroar/vs.c	(revision 5414)
+++ libroar/vs.c	(revision 5651)
@@ -194,5 +194,5 @@
       }
      } else {
-      ROAR_WARN("_handle_async_req(vss=%p, error=%p): Got unexpected reply for command GET_STREAM_PARA, subcommand", vss, error, subcmd);
+      ROAR_WARN("_handle_async_req(vss=%p, error=%p): Got unexpected reply for command GET_STREAM_PARA, subcommand %i", vss, error, subcmd);
      }
     break;
Index: libroardsp/convert.c
===================================================================
--- libroardsp/convert.c	(revision 5381)
+++ libroardsp/convert.c	(revision 5651)
@@ -1063,5 +1063,5 @@
  memcpy(&cinfo, from, sizeof(cinfo));
 
- ROAR_DBG("roar_conv2(out=%p, in=%p, inlen=%lu, from=%p{...}, to=%p{...}, bufsize=%lu", out, in, inlen, from, to, bufsize);
+ ROAR_DBG("roar_conv2(out=%p, in=%p, inlen=%lu, from=%p{...}, to=%p{...}, bufsize=%lu", out, in, (unsigned long int)inlen, from, to, (unsigned long int)bufsize);
 
 /*
Index: libroardsp/filter_dcblock.c
===================================================================
--- libroardsp/filter_dcblock.c	(revision 5381)
+++ libroardsp/filter_dcblock.c	(revision 5651)
@@ -97,5 +97,5 @@
  }
 
- ROAR_DBG("roardsp_dcblock_calc16(*): s=%i (current block of %i samples)", s, samples);
+ ROAR_DBG("roardsp_dcblock_calc16(*): s=%li (current block of %lu samples)", (long int)s, (unsigned long int)samples);
 
  s = (float)(s / samples);
@@ -116,5 +116,5 @@
 // s += (ROAR_INSTINT)filter->inst;
 
- ROAR_DBG("roardsp_dcblock_calc16(*): new DC value: %i", s);
+ ROAR_DBG("roardsp_dcblock_calc16(*): new DC value: %li", (long int)s);
 
  for (i = 0; i < samples; i++)
Index: libroardsp/filter_goertzel.c
===================================================================
--- libroardsp/filter_goertzel.c	(revision 5551)
+++ libroardsp/filter_goertzel.c	(revision 5651)
@@ -76,5 +76,5 @@
   g       /= 32767; \
   s        = samp[i]; \
-  ROAR_DBG("roardsp_goertzel_calc*(*): channel=%i, g=%f, s=%f, old[0]=%f, old[1]=%f", channel, g, s, self->old[channel][0], self->old[channel][1]); \
+  ROAR_DBG("roardsp_goertzel_calc*(*): channel=%i, g=%f, s=%f, old[0]=%li, old[1]=%li", channel, g, s, (long int)self->old[channel][0], (long int)self->old[channel][1]); \
   s       += g; \
   s       -= self->old[channel][1]; \
Index: roarclients/roarvorbis.c
===================================================================
--- roarclients/roarvorbis.c	(revision 5534)
+++ roarclients/roarvorbis.c	(revision 5651)
@@ -64,5 +64,5 @@
  r = roar_vio_read(datasource, ptr, size*nmemb);
 
- ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p): r=%i", ptr, size, nmemb, datasource, r);
+ ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p): r=%i", ptr, (unsigned long int)size, (unsigned long int)nmemb, datasource, r);
 
  if ( r == -1 )
@@ -74,5 +74,5 @@
  r /= size;
 
- ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p) = %i", ptr, size, nmemb, datasource, r);
+ ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p) = %i", ptr, (unsigned long int)size, (unsigned long int)nmemb, datasource, r);
  return r;
 }
@@ -115,5 +115,5 @@
 
  if ( vclt != NULL ) {
-  roar_vio_printf(vclt, "AUDIOINFO=rate:%iHz, channels:%i\n", vi->rate, vi->channels);
+  roar_vio_printf(vclt, "AUDIOINFO=rate:%liHz, channels:%li\n", (long int)vi->rate, (long int)vi->channels);
  }
 
Index: roard/codecfilter_flac.c
===================================================================
--- roard/codecfilter_flac.c	(revision 5624)
+++ roard/codecfilter_flac.c	(revision 5651)
@@ -153,5 +153,5 @@
    if ( stream_meta_add(ROAR_STREAM(self->ss)->id, type, "", value) == -1 ) {
     ROAR_WARN("cf_flac_cb_metadata(..., client_data=%p{ROAR_STREAM(.ss)->id=%i}): Can not add meta data: %s",
-              ROAR_STREAM(self->ss)->id, roar_error2str(roar_error));
+              self->ss, ROAR_STREAM(self->ss)->id, roar_error2str(roar_error));
    }
 
Index: roard/codecfilter_vorbis.c
===================================================================
--- roard/codecfilter_vorbis.c	(revision 5625)
+++ roard/codecfilter_vorbis.c	(revision 5651)
@@ -48,8 +48,8 @@
  r = stream_vio_s_read(ROAR_STREAM_SERVER(datasource), ptr, size*nmemb);
 
- ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p): r=%i", ptr, size, nmemb, datasource, r);
+ ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p): r=%i", ptr, (unsigned long int)size, (unsigned long int)nmemb, datasource, r);
 
  if ( r == -1 ) {
-  ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p) = 0 // roar_error=%i(%s)", ptr, size, nmemb, datasource, roar_error, roar_error2str(roar_error));
+  ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p) = 0 // roar_error=%i(%s)", ptr, (unsigned long int)size, (unsigned long int)nmemb, datasource, roar_error, roar_error2str(roar_error));
   return 0;
  }
@@ -61,5 +61,5 @@
  r /= size;
  
- ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p) = %i", ptr, size, nmemb, datasource, r);
+ ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p) = %i", ptr, (unsigned long int)size, (unsigned long int)nmemb, datasource, r);
  return r;
 }
@@ -289,5 +289,5 @@
  }
 
- ROAR_DBG("ov_read(*) = %i", done);
+ ROAR_DBG("ov_read(*) = %li", (long int)done);
 
  if ( done == 0 ) {
Index: roard/lib.c
===================================================================
--- roard/lib.c	(revision 5619)
+++ roard/lib.c	(revision 5651)
@@ -32,5 +32,5 @@
  size_t i;
 
- ROAR_WARN("lib_run_bg(cmd='%s', ...): This function should never be called. Contact devels.");
+ ROAR_WARN("lib_run_bg(cmd='%s', ...): This function should never be called. Contact devels.", cmd);
 
  child = roar_fork(NULL);
Index: roard/midi.c
===================================================================
--- roard/midi.c	(revision 5417)
+++ roard/midi.c	(revision 5651)
@@ -823,5 +823,5 @@
 
   if ( streams_get_flag(g_midi_clock.stream, ROAR_FLAG_SYNC) ) {
-   ROAR_DBG("midi_clock_tick(void): TICK! (nt=%lu)", g_midi_clock.nt);
+   ROAR_DBG("midi_clock_tick(void): TICK! (nt=%lu)", (unsigned long int)g_midi_clock.nt);
    if ( midi_new_bufmes(&buf, &mes) == -1 ) {
     ROAR_ERR("midi_clock_tick(void): Can not create Clock-Tick-Message");
@@ -839,5 +839,5 @@
    ss->state = ROAR_STREAMSTATE_OLD;
   } else {
-   ROAR_DBG("midi_clock_tick(void): silent tick. (nt=%lu)", g_midi_clock.nt);
+   ROAR_DBG("midi_clock_tick(void): silent tick. (nt=%lu)", (unsigned long int)g_midi_clock.nt);
   }
  }
Index: roard/roard.c
===================================================================
--- roard/roard.c	(revision 5624)
+++ roard/roard.c	(revision 5651)
@@ -977,5 +977,5 @@
    protoname = roar_proto2str(g_listen[i].proto);
    if ( protoname == NULL ) {
-    ROAR_ERR("check_listen(void): protocol %i is unknown (protocol ID not assigned?).");
+    ROAR_ERR("check_listen(void): protocol %i is unknown (protocol ID not assigned?).", g_listen[i].proto);
    } else {
     ROAR_DBG("check_listen(void): Unknown protocol %s(%i) is used.", protoname, g_listen[i].proto);
@@ -1226,5 +1226,5 @@
   if ( roar_x11_delete_prop(x11con, "ROAR_SERVER") == -1 ) {
    ret = -1;
-   ROAR_ERR("Error while unregistereing from X11", ROAR_DBG_INFO_INFO);
+   ROAR_ERR("Error while unregistereing from X11");
   } else {
    ROAR_INFO("Successfully unregistered from X11", ROAR_DBG_INFO_INFO);
@@ -1233,5 +1233,5 @@
   if ( roar_x11_set_prop(x11con, "ROAR_SERVER", sockname) == -1 ) {
    ret = -1;
-   ROAR_ERR("Error while registereing to X11", ROAR_DBG_INFO_INFO);
+   ROAR_ERR("Error while registereing to X11");
   } else {
    ROAR_INFO("Successfully registered to X11", ROAR_DBG_INFO_INFO);
