Changeset 5651:b0e163908378 in roaraudio


Ignore:
Timestamp:
09/12/12 16:22:42 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Added compiler checks for printf() like format strings.

Files:
20 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5649 r5651  
    1616          size growth (Closes: #284) 
    1717        * Added RAT test 'buffer_set_len'. 
     18        * Added compiler checks for printf() like format strings. 
    1819 
    1920v. 1.0beta5 - Mon Aug 20 2012 23:52 CEST 
  • include/libroar/debug.h

    r5381 r5651  
    7474struct roar_vio_calls * roar_debug_get_stderr(void); 
    7575 
    76 void roar_debug_msg_simple(const char *format, ...); 
     76void roar_debug_msg_simple(const char *format, ...) _LIBROAR_ATTR_PRINTF(1, 2); 
    7777 
    78 void roar_debug_msg(int type, unsigned long int line, const char * file, const char * prefix, const char * format, ...); 
     78void roar_debug_msg(int type, unsigned long int line, const char * file, const char * prefix, const char * format, ...) _LIBROAR_ATTR_PRINTF(5, 6); 
    7979 
    8080#endif 
  • include/libroar/vio_string.h

    r5381 r5651  
    4646char *  roar_vio_fgets   (struct roar_vio_calls * vio, char * s, size_t size) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL_ALL; 
    4747 
    48 int     roar_vio_printf  (struct roar_vio_calls * vio, const char *format, ...) _LIBROAR_ATTR_NONNULL(1, 2); 
     48int     roar_vio_printf  (struct roar_vio_calls * vio, const char *format, ...) _LIBROAR_ATTR_NONNULL(1, 2) _LIBROAR_ATTR_PRINTF(2, 3); 
    4949 
    5050#endif 
  • include/roaraudio/compilerhacks.h

    r5381 r5651  
    3838#define _LIBROAR_ATTR_PURE              __attribute__ ((pure)) 
    3939#define _LIBROAR_ATTR_USE_RESULT        __attribute__ ((warn_unused_result)) 
     40#define _LIBROAR_ATTR_PRINTF(str,args)  __attribute__ ((format (printf, str, args))) 
    4041 
    4142// gcc does not only add a warning on NULL argument for the following 
     
    6768#define _LIBROAR_ATTR_USE_RESULT 
    6869#endif 
     70#ifndef _LIBROAR_ATTR_PRINTF 
     71#define _LIBROAR_ATTR_PRINTF(str,args) 
     72#endif 
    6973 
    7074#ifndef _LIBROAR_IGNORE_RET 
  • libroar/auth.c

    r5381 r5651  
    169169 if ( (ret = roar_req2(con, &mes, &data, &error_frame)) == -1 ) { 
    170170  authmes->type = -1; 
    171   ROAR_DBG("roar_auth_ask_server(con=%p, authmes=%p) = -1 // next: -1", con, authmes, authmes->type); 
     171  ROAR_DBG("roar_auth_ask_server(con=%p, authmes=%p) = -1 // next: -1", con, authmes); 
    172172  return -1; 
    173173 } 
  • libroar/buffer.c

    r5647 r5651  
    191191 
    192192  if ( cur->refc == 0 ) { 
    193    ROAR_WARN("roar_buffer_unref(buf=%p): Ref counter for buffer at %p is wrong. assuming one.", cur); 
     193   ROAR_WARN("roar_buffer_unref(buf=%p): Ref counter for buffer at %p is wrong. assuming one.", cur, cur); 
    194194   cur->refc = 1; 
    195195   roar_panic(ROAR_FATAL_ERROR_MEMORY_CORRUPTION, NULL); 
  • libroar/passwordapi.c

    r5381 r5651  
    4444 
    4545 if ( prompt == NULL ) { 
    46   ROAR_WARN("roar_passwd_simple_ask_pw(pw=%p, prompt=NULL, cachetoken='%s'): No prompt given. This may be a bug in application."); 
     46  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); 
    4747  prompt = "Please enter Password"; 
    4848 } 
  • libroar/roardl.c

    r5584 r5651  
    521521 (void)type; 
    522522 
    523  ROAR_DBG("roar_dl_getsym(lhandle=%p, sym='%s', type=%i): errno=%s(%i), dlerror()='%s'", lhandle, sym, type, ret, strerror(errno), errno, dlerror()); 
     523 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()); 
    524524 ROAR_DBG("roar_dl_getsym(lhandle=%p, sym='%s', type=%i) = %p", lhandle, sym, type, ret); 
    525525 
  • libroar/vio_dstr.c

    r5408 r5651  
    391391   break; 
    392392  default: 
    393     ROAR_DBG("roar_vio_open_default(calls=%p, def=%p, opts='%s') = -1 // error=NOTSUP", calls, def, opts, (int)def->type); 
     393    ROAR_DBG("roar_vio_open_default(calls=%p, def=%p, opts='%s') = -1 // error=NOTSUP", calls, def, opts); 
    394394    roar_err_set(ROAR_ERROR_NOTSUP); 
    395395    return -1; 
  • libroar/vio_zlib.c

    r5388 r5651  
    187187   return -1; 
    188188 
    189   ROAR_DBG("roar_vio_zlib_read(vio=%p, buf=%p, count=%llu) = ?", vio, buf, (long long unsigned)count, self->inbuf); 
     189  ROAR_DBG("roar_vio_zlib_read(vio=%p, buf=%p, count=%llu) = ?", vio, buf, (long long unsigned)count); 
    190190 
    191191  self->decompressor.next_out  = buf; 
  • libroar/vs.c

    r5414 r5651  
    194194      } 
    195195     } else { 
    196       ROAR_WARN("_handle_async_req(vss=%p, error=%p): Got unexpected reply for command GET_STREAM_PARA, subcommand", vss, error, subcmd); 
     196      ROAR_WARN("_handle_async_req(vss=%p, error=%p): Got unexpected reply for command GET_STREAM_PARA, subcommand %i", vss, error, subcmd); 
    197197     } 
    198198    break; 
  • libroardsp/convert.c

    r5381 r5651  
    10631063 memcpy(&cinfo, from, sizeof(cinfo)); 
    10641064 
    1065  ROAR_DBG("roar_conv2(out=%p, in=%p, inlen=%lu, from=%p{...}, to=%p{...}, bufsize=%lu", out, in, inlen, from, to, bufsize); 
     1065 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); 
    10661066 
    10671067/* 
  • libroardsp/filter_dcblock.c

    r5381 r5651  
    9797 } 
    9898 
    99  ROAR_DBG("roardsp_dcblock_calc16(*): s=%i (current block of %i samples)", s, samples); 
     99 ROAR_DBG("roardsp_dcblock_calc16(*): s=%li (current block of %lu samples)", (long int)s, (unsigned long int)samples); 
    100100 
    101101 s = (float)(s / samples); 
     
    116116// s += (ROAR_INSTINT)filter->inst; 
    117117 
    118  ROAR_DBG("roardsp_dcblock_calc16(*): new DC value: %i", s); 
     118 ROAR_DBG("roardsp_dcblock_calc16(*): new DC value: %li", (long int)s); 
    119119 
    120120 for (i = 0; i < samples; i++) 
  • libroardsp/filter_goertzel.c

    r5551 r5651  
    7676  g       /= 32767; \ 
    7777  s        = samp[i]; \ 
    78   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]); \ 
     78  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]); \ 
    7979  s       += g; \ 
    8080  s       -= self->old[channel][1]; \ 
  • roarclients/roarvorbis.c

    r5534 r5651  
    6464 r = roar_vio_read(datasource, ptr, size*nmemb); 
    6565 
    66  ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p): r=%i", ptr, size, nmemb, datasource, r); 
     66 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); 
    6767 
    6868 if ( r == -1 ) 
     
    7474 r /= size; 
    7575 
    76  ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p) = %i", ptr, size, nmemb, datasource, r); 
     76 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); 
    7777 return r; 
    7878} 
     
    115115 
    116116 if ( vclt != NULL ) { 
    117   roar_vio_printf(vclt, "AUDIOINFO=rate:%iHz, channels:%i\n", vi->rate, vi->channels); 
     117  roar_vio_printf(vclt, "AUDIOINFO=rate:%liHz, channels:%li\n", (long int)vi->rate, (long int)vi->channels); 
    118118 } 
    119119 
  • roard/codecfilter_flac.c

    r5624 r5651  
    153153   if ( stream_meta_add(ROAR_STREAM(self->ss)->id, type, "", value) == -1 ) { 
    154154    ROAR_WARN("cf_flac_cb_metadata(..., client_data=%p{ROAR_STREAM(.ss)->id=%i}): Can not add meta data: %s", 
    155               ROAR_STREAM(self->ss)->id, roar_error2str(roar_error)); 
     155              self->ss, ROAR_STREAM(self->ss)->id, roar_error2str(roar_error)); 
    156156   } 
    157157 
  • roard/codecfilter_vorbis.c

    r5625 r5651  
    4848 r = stream_vio_s_read(ROAR_STREAM_SERVER(datasource), ptr, size*nmemb); 
    4949 
    50  ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p): r=%i", ptr, size, nmemb, datasource, r); 
     50 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); 
    5151 
    5252 if ( r == -1 ) { 
    53   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)); 
     53  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)); 
    5454  return 0; 
    5555 } 
     
    6161 r /= size; 
    6262  
    63  ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p) = %i", ptr, size, nmemb, datasource, r); 
     63 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); 
    6464 return r; 
    6565} 
     
    289289 } 
    290290 
    291  ROAR_DBG("ov_read(*) = %i", done); 
     291 ROAR_DBG("ov_read(*) = %li", (long int)done); 
    292292 
    293293 if ( done == 0 ) { 
  • roard/lib.c

    r5619 r5651  
    3232 size_t i; 
    3333 
    34  ROAR_WARN("lib_run_bg(cmd='%s', ...): This function should never be called. Contact devels."); 
     34 ROAR_WARN("lib_run_bg(cmd='%s', ...): This function should never be called. Contact devels.", cmd); 
    3535 
    3636 child = roar_fork(NULL); 
  • roard/midi.c

    r5417 r5651  
    823823 
    824824  if ( streams_get_flag(g_midi_clock.stream, ROAR_FLAG_SYNC) ) { 
    825    ROAR_DBG("midi_clock_tick(void): TICK! (nt=%lu)", g_midi_clock.nt); 
     825   ROAR_DBG("midi_clock_tick(void): TICK! (nt=%lu)", (unsigned long int)g_midi_clock.nt); 
    826826   if ( midi_new_bufmes(&buf, &mes) == -1 ) { 
    827827    ROAR_ERR("midi_clock_tick(void): Can not create Clock-Tick-Message"); 
     
    839839   ss->state = ROAR_STREAMSTATE_OLD; 
    840840  } else { 
    841    ROAR_DBG("midi_clock_tick(void): silent tick. (nt=%lu)", g_midi_clock.nt); 
     841   ROAR_DBG("midi_clock_tick(void): silent tick. (nt=%lu)", (unsigned long int)g_midi_clock.nt); 
    842842  } 
    843843 } 
  • roard/roard.c

    r5624 r5651  
    977977   protoname = roar_proto2str(g_listen[i].proto); 
    978978   if ( protoname == NULL ) { 
    979     ROAR_ERR("check_listen(void): protocol %i is unknown (protocol ID not assigned?)."); 
     979    ROAR_ERR("check_listen(void): protocol %i is unknown (protocol ID not assigned?).", g_listen[i].proto); 
    980980   } else { 
    981981    ROAR_DBG("check_listen(void): Unknown protocol %s(%i) is used.", protoname, g_listen[i].proto); 
     
    12261226  if ( roar_x11_delete_prop(x11con, "ROAR_SERVER") == -1 ) { 
    12271227   ret = -1; 
    1228    ROAR_ERR("Error while unregistereing from X11", ROAR_DBG_INFO_INFO); 
     1228   ROAR_ERR("Error while unregistereing from X11"); 
    12291229  } else { 
    12301230   ROAR_INFO("Successfully unregistered from X11", ROAR_DBG_INFO_INFO); 
     
    12331233  if ( roar_x11_set_prop(x11con, "ROAR_SERVER", sockname) == -1 ) { 
    12341234   ret = -1; 
    1235    ROAR_ERR("Error while registereing to X11", ROAR_DBG_INFO_INFO); 
     1235   ROAR_ERR("Error while registereing to X11"); 
    12361236  } else { 
    12371237   ROAR_INFO("Successfully registered to X11", ROAR_DBG_INFO_INFO); 
Note: See TracChangeset for help on using the changeset viewer.