Changeset 5242:97239101cee9 in roaraudio


Ignore:
Timestamp:
11/13/11 00:03:27 (8 years ago)
Author:
phi
Branch:
default
Message:

some roard compiler warnings cleanup

Files:
16 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/vio.h

    r5114 r5242  
    8383 
    8484// converters: 
    85 int     roar_vio_open_file     (struct roar_vio_calls * calls, char * filename, int flags, mode_t mode) _LIBROAR_ATTR_DEPRECATED _LIBROAR_ATTR_NONNULL_ALL; 
     85int     roar_vio_open_file     (struct roar_vio_calls * calls, const char * filename, int flags, mode_t mode) _LIBROAR_ATTR_DEPRECATED _LIBROAR_ATTR_NONNULL_ALL; 
    8686int     roar_vio_open_fh       (struct roar_vio_calls * calls, int fh) _LIBROAR_ATTR_NONNULL_ALL; 
    8787int     roar_vio_open_fh_socket(struct roar_vio_calls * calls, int fh) _LIBROAR_ATTR_NONNULL_ALL; 
  • include/libroareio/driver.h

    r4708 r5242  
    4141struct roar_cdriver { 
    4242 const char * name; 
    43  int  (*open)(struct roar_vio_calls * calls, const char * name, char * dev, struct roar_audio_info * info, int dir); 
     43 int  (*open)(struct roar_vio_calls * calls, const char * name, const char * dev, struct roar_audio_info * info, int dir); 
    4444}; 
    4545 
    46 int roar_cdriver_open(struct roar_vio_calls * calls, const char * name, char * dev, struct roar_audio_info * info, int dir); 
     46int roar_cdriver_open(struct roar_vio_calls * calls, const char * name, const char * dev, struct roar_audio_info * info, int dir); 
    4747 
    4848// driver prototypes: 
    49 int roar_cdriver_oss (struct roar_vio_calls * calls, const char * name, char * dev, struct roar_audio_info * info, int dir); 
    50 int roar_cdriver_roar(struct roar_vio_calls * calls, const char * name, char * dev, struct roar_audio_info * info, int dir); 
     49int roar_cdriver_oss (struct roar_vio_calls * calls, const char * name, const char * dev, struct roar_audio_info * info, int dir); 
     50int roar_cdriver_roar(struct roar_vio_calls * calls, const char * name, const char * dev, struct roar_audio_info * info, int dir); 
    5151 
    5252#endif 
  • libroar/vio.c

    r5115 r5242  
    305305 
    306306// converters: 
    307 int     roar_vio_open_file     (struct roar_vio_calls * calls, char * filename, int flags, mode_t mode) { 
     307int     roar_vio_open_file     (struct roar_vio_calls * calls, const char * filename, int flags, mode_t mode) { 
    308308#ifdef _CAN_OPERATE 
    309309 int fh; 
  • libroareio/driver.c

    r4708 r5242  
    3232#endif 
    3333 
    34 int roar_cdriver_null(struct roar_vio_calls * calls, const char * name, char * dev, struct roar_audio_info * info, int dir) { 
     34int roar_cdriver_null(struct roar_vio_calls * calls, const char * name, const char * dev, struct roar_audio_info * info, int dir) { 
    3535 ROAR_DBG("roar_cdriver_null(calls=%p, name='%s', dev='%s', info=%p{...}, dir=%i(?)) = ?", calls, name, dev, info, dir); 
    3636 
     
    5656 
    5757 
    58 static int roar_cdriver_open_default(struct roar_vio_calls * calls, char * dev, struct roar_audio_info * info, int dir) { 
     58static int roar_cdriver_open_default(struct roar_vio_calls * calls, const char * dev, struct roar_audio_info * info, int dir) { 
    5959 const char * names[] = { 
    6060  // native APIs: 
     
    8181} 
    8282 
    83 int roar_cdriver_open(struct roar_vio_calls * calls, const char * name, char * dev, struct roar_audio_info * info, int dir) { 
     83int roar_cdriver_open(struct roar_vio_calls * calls, const char * name, const char * dev, struct roar_audio_info * info, int dir) { 
    8484 int i; 
    8585 char *delm; 
  • libroareio/driver_oss.c

    r4890 r5242  
    5959#define _err() roar_vio_close(calls); return -1 
    6060 
    61 int roar_cdriver_oss(struct roar_vio_calls * calls, const char * name, char * dev, struct roar_audio_info * info, int dir) { 
     61int roar_cdriver_oss(struct roar_vio_calls * calls, const char * name, const char * dev, struct roar_audio_info * info, int dir) { 
    6262 struct roar_vio_sysio_ioctl ctl; 
    6363 int tmp, ctmp; 
  • libroareio/driver_roar.c

    r4708 r5242  
    2727#include "driver.h" 
    2828 
    29 int roar_cdriver_roar(struct roar_vio_calls * calls, const char * name, char * dev, struct roar_audio_info * info, int dir) { 
     29int roar_cdriver_roar(struct roar_vio_calls * calls, const char * name, const char * dev, struct roar_audio_info * info, int dir) { 
    3030 return roar_vio_simple_stream(calls, info->rate, info->channels, info->bits, info->codec, dev, dir, "libroareio client"); 
    3131} 
  • plugins/roard/protocol-gopher.c

    r4744 r5242  
    686686  chardata[len-1] = 0; 
    687687 
    688   roar_buffer_set_len(buf, strlen(data)); 
     688  if ( roar_buffer_set_len(buf, strlen(data)) == -1 ) { 
     689   roar_buffer_free(buf); 
     690   return -1; 
     691  } 
    689692 
    690693  clients_add_output(client, buf); 
  • roard/Makefile

    r4980 r5242  
    33OBJ=roard.o driver.o mixer.o output.o signals.o loop.o clients.o streams.o network.o commands.o req.o sources.o sample.o meta.o codecfilter.o lib.o ssynth.o container_framework.o plugins.o memlock.o hwmixer.o auth.o caps.o rolestack.o 
    44SUBSYS=midi.o light.o raw.o rdtcs.o waveform.o beep.o 
    5 DRV=driver_esd.o driver_ao.o driver_roar.o driver_raw.o driver_oss.o driver_shout.o driver_sndio.o driver_dmx.o driver_pwmled.o driver_sysclock.o driver_wmm.o driver_dstr.o driver_alsa.o driver_rsound.o driver_portaudio.o driver_pulsesimple.o driver_jack.o driver_artsc.o 
     5DRV=driver_esd.o driver_ao.o driver_roar.o driver_oss.o driver_shout.o driver_sndio.o driver_dmx.o driver_pwmled.o driver_sysclock.o driver_wmm.o driver_dstr.o driver_alsa.o driver_rsound.o driver_portaudio.o driver_pulsesimple.o driver_jack.o driver_artsc.o 
    66CF_CODEC=codecfilter_cmd.o codecfilter_vorbis.o codecfilter_celt.o codecfilter_speex.o codecfilter_alaw.o codecfilter_mulaw.o codecfilter_sndfile.o codecfilter_fishsound.o codecfilter_flac.o 
    77CF_CONTAINER=codecfilter_wave.o codecfilter_raum.o codecfilter_au.o 
  • roard/clients.c

    r5192 r5242  
    699699 
    700700 if ( ret == len ) { 
    701   roar_buffer_next(&(cs->outbuf)); 
     701  if ( roar_buffer_next(&(cs->outbuf)) == -1 ) { 
     702   clients_delete(id); 
     703   return -1; 
     704  } 
    702705 } else { 
    703706  if ( roar_buffer_set_offset(cs->outbuf, ret) == -1 ) { 
  • roard/codecfilter_fishsound.c

    r4957 r5242  
    8484  self->buffer = buf; 
    8585 } else { 
    86   roar_buffer_add(self->buffer, buf); 
    87  } 
    88  
     86  if ( roar_buffer_add(self->buffer, buf) == -1 ) { 
     87   roar_buffer_free(buf); 
     88   return -1; 
     89  } 
     90 } 
     91 
     92 // shouldn't that be zero? 
    8993 return -1; 
    9094} 
  • roard/codecfilter_flac.c

    r5162 r5242  
    101101  self->decoder.written = buf; 
    102102 } else { 
    103   roar_buffer_add(self->decoder.written, buf); 
     103  if ( roar_buffer_add(self->decoder.written, buf) == -1 ) { 
     104   roar_buffer_free(buf); 
     105   return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; 
     106  } 
    104107 } 
    105108 
  • roard/driver_dmx.c

    r4918 r5242  
    2929 
    3030int driver_dmx_open_vio  (struct roar_vio_calls * inst, char * device, struct roar_audio_info * info, int fh, struct roar_stream_server * sstream) { 
     31 struct roar_vio_defaults def; 
     32 
     33 if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_WRONLY, 0644) == -1 ) 
     34  return -1; 
    3135 
    3236 if ( fh == -1 ) { 
     
    3741   device = "/dev/dmx"; 
    3842 
    39   if ( roar_vio_open_file(inst, device, O_WRONLY, 0644) == -1 ) 
     43  if ( roar_vio_open_dstr(inst, device, &def, 1) == -1 ) 
    4044   return -1; 
    4145 } else { 
  • roard/include/sources.h

    r5194 r5242  
    3939 unsigned int flags; 
    4040 unsigned int subsystems; 
    41  int (*old_open)(char * driver, char * device, char * container, char * options, int primary); 
    42  int (*new_open)(int stream   , char * device, int fh, char * driver); 
     41 int (*old_open)(const char * driver, const char * device, const char * container, const char * options, int primary); 
     42 int (*new_open)(int stream   , const char * device, int fh, const char * driver); 
    4343}; 
    4444 
     
    5757                     char * options, int primary); 
    5858 
    59 int sources_add_raw  (int stream   , char * device, int fh, char * driver); 
    60 int sources_add_wav  (char * driver, char * device, char * container, char * options, int primary); 
    61 int sources_add_cf   (char * driver, char * device, char * container, char * options, int primary); 
     59int sources_add_dstr (int stream   , const char * device, int fh, const char * driver); 
     60int sources_add_cf   (const char * driver, const char * device, const char * container, const char * options, int primary); 
    6261 
    63 int sources_add_roar (int stream, char * device, int fh, char * driver); 
    64 int sources_add_radionoise (int stream, char * device, int fh, char * driver); 
     62int sources_add_roar (int stream, const char * device, int fh, const char * driver); 
     63int sources_add_radionoise (int stream, const char * device, int fh, const char * driver); 
    6564 
    6665#ifndef ROAR_WITHOUT_DCOMP_CDRIVER 
    67 int sources_add_cdriver (int stream   , char * device, int fh, char * driver); 
     66int sources_add_cdriver (int stream   , const char * device, int fh, const char * driver); 
    6867#endif 
    6968#endif 
  • roard/output.c

    r5210 r5242  
    460460 _LIBROAR_IGNORE_RET(roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_SSTREAM,   s)); // ignore errors here 
    461461 
    462  if ( blocks != -1 ) 
    463   roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DBLOCKS, &blocks); 
    464  
    465  if ( blocksize != -1 ) 
    466   roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DBLKSIZE, &blocksize); 
     462 if ( blocks != -1 ) { 
     463  if ( roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DBLOCKS, &blocks) == -1 ) { 
     464   ROAR_WARN("add_output(drv='%s', dev='%s', opts='%s'): can not set number of blocks.", drv, dev, opts); 
     465  } 
     466 } 
     467 
     468 if ( blocksize != -1 ) { 
     469  if ( roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DBLKSIZE, &blocksize) == -1 ) { 
     470   ROAR_WARN("add_output(drv='%s', dev='%s', opts='%s'): can not set blocksize.", drv, dev, opts); 
     471  } 
     472 } 
    467473 
    468474 // TODO: we shoudld *really* check for errors here... 
    469475 if ( channel != -1 ) { 
    470476  tu16 = channel; 
    471   roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DMXSCHAN, &tu16); 
     477  if ( roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DMXSCHAN, &tu16) == -1 ) { 
     478   streams_delete(stream); 
     479   if ( prim ) alive = 0; 
     480   ROAR_ERR("add_output(drv='%s', dev='%s', opts='%s'): can not set DMX channel number.", drv, dev, opts); 
     481   ROAR_DBG("add_output(drv='%s', dev='%s', opts='%s') = -1", drv, dev, opts); 
     482   return -1; 
     483  } 
    472484 } 
    473485 if ( universe != -1 ) { 
    474486  tu16 = universe; 
    475   roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DMXUNIV, &tu16); 
     487  if ( roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_DMXUNIV, &tu16) == -1 ) { 
     488   streams_delete(stream); 
     489   if ( prim ) alive = 0; 
     490   ROAR_ERR("add_output(drv='%s', dev='%s', opts='%s'): can not set DMX universe.", drv, dev, opts); 
     491   ROAR_DBG("add_output(drv='%s', dev='%s', opts='%s') = -1", drv, dev, opts); 
     492   return -1; 
     493  } 
    476494 } 
    477495 
  • roard/sources.c

    r5210 r5242  
    3333 
    3434struct roar_source g_source[] = { 
    35  {"raw",  "Raw source",                  "/some/file",     SRC_FLAG_FHSEC, ROAR_SUBSYS_WAVEFORM, NULL,  sources_add_raw}, 
    36 #ifdef ROAR_HAVE_IO_POSIX 
    37  {"wav",  "Old RIFF/WAVE source",        "/some/file.wav", SRC_FLAG_NONE,  ROAR_SUBSYS_WAVEFORM, sources_add_wav,  NULL}, 
    38 #endif 
     35 {"raw",  "DSTR source",                 "/some/file",     SRC_FLAG_FHSEC, ROAR_SUBSYS_WAVEFORM, NULL,  sources_add_dstr}, 
    3936 {"cf",   "Old CF source",               "/some/file.ext", SRC_FLAG_NONE,  ROAR_SUBSYS_WAVEFORM, sources_add_cf,   NULL}, 
    4037 {"roar", "New simple RoarAudio source", "some.host",      SRC_FLAG_NONE,  ROAR_SUBSYS_WAVEFORM, NULL, sources_add_roar}, 
     
    250247} 
    251248 
    252 int sources_add_raw  (int stream   , char * device, int fh, char * driver) { 
     249int sources_add_dstr  (int stream   , const char * device, int fh, const char * driver) { 
    253250 struct roar_stream_server * ss; 
     251 struct roar_vio_defaults def; 
     252 
     253 if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_RDONLY, 0644) == -1 ) 
     254  return -1; 
    254255 
    255256 streams_get(stream, &ss); 
     
    259260   return -1; 
    260261 } else { 
    261   if ( roar_vio_open_file(&(ss->vio), device, O_RDONLY, 0644) == -1 ) 
     262  if ( roar_vio_open_dstr(&(ss->vio), device, &def, 1) == -1 ) 
    262263   return -1; 
    263264 } 
     
    266267} 
    267268 
    268 #ifdef ROAR_HAVE_IO_POSIX 
    269 int sources_add_wav (char * driver, char * device, char * container, char * options, int primary) { 
    270  int stream; 
    271  int fh; 
    272  char buf[44]; 
    273  struct roar_stream * s; 
    274  
    275  ROAR_WARN("sources_add_raw(*): The wav(e) source is obsolete, use source 'cf' (default)!"); 
    276  
    277  if ( (fh = open(device, O_RDONLY, 0644)) == -1 ) { 
    278   return -1; 
    279  } 
    280  
    281  if (read(fh, buf, 44) != 44) { 
    282   close(fh); 
    283   return -1; 
    284  } 
    285  
    286  if ( (stream = streams_new()) == -1 ) { 
    287   close(fh); 
    288   return -1; 
    289  } 
    290  
    291  streams_get_clientobj(stream, &s); 
    292  
    293  memcpy(&(s->info), g_sa, sizeof(struct roar_audio_info)); 
    294  
    295  memcpy(&(s->info.rate    ), buf+24, 4); 
    296  memcpy(&(s->info.channels), buf+22, 2); 
    297  memcpy(&(s->info.bits    ), buf+34, 2); 
    298  
    299  if ( streams_set_dir(stream, ROAR_DIR_PLAY, 1) == -1 ) { 
    300   streams_delete(stream); 
    301   close(fh); 
    302   return -1; 
    303  } 
    304  s->pos_rel_id = -1; 
    305  
    306  streams_set_fh(stream, fh); 
    307  
    308  streams_set_flag(stream, ROAR_FLAG_SOURCE); 
    309  client_stream_add(g_source_client, stream); 
    310  
    311  return 0; 
    312 } 
    313 #endif 
    314  
    315269#define _ret(x) streams_delete(stream); return (x) 
    316270 
    317 int sources_add_cf (char * driver, char * device, char * container, char * options, int primary) { 
     271int sources_add_cf (const char * driver, const char * device, const char * container, const char * options, int primary) { 
    318272 int  stream; 
    319273 int  codec; 
     
    359313 ROAR_DBG("sources_add_cf(*) = ?"); 
    360314 
    361  // TODO: finy out a better way of doing auto detetion without need for seek! 
     315 // TODO: find out a better way of doing auto detetion without need for seek! 
    362316 if ( options == NULL ) { 
    363317  if ( (len = roar_vio_read(vio, buf, 64)) < 1 ) { 
     
    402356 
    403357#ifndef ROAR_WITHOUT_DCOMP_CDRIVER 
    404 int sources_add_cdriver (int stream   , char * device, int fh, char * driver) { 
     358int sources_add_cdriver (int stream   , const char * device, int fh, const char * driver) { 
    405359 struct roar_stream_server * ss; 
    406360 
     
    460414} 
    461415 
    462 int sources_add_radionoise (int stream, char * device, int fh, char * driver) { 
     416int sources_add_radionoise (int stream, const char * device, int fh, const char * driver) { 
    463417 struct roar_stream_server * ss; 
    464418 struct roar_audio_info    * info; 
     
    484438} 
    485439 
    486 int sources_add_roar (int stream, char * device, int fh, char * driver) { 
     440int sources_add_roar (int stream, const char * device, int fh, const char * driver) { 
    487441 struct roar_stream_server * ss; 
    488442 struct roar_stream        * s; 
  • roard/streams.c

    r5192 r5242  
    22612261 ROAR_DBG("streams_check(id=%i): asking for %i bytes", id, req); 
    22622262 
    2263  if ( roar_buffer_new(&b, req) == -1 ) { 
     2263 if ( roar_buffer_new_data(&b, req, &buf) == -1 ) { 
    22642264  ROAR_ERR("streams_check(*): Can not alloc buffer space!"); 
    22652265  ROAR_DBG("streams_check(*) = -1"); 
    22662266  return -1; 
    22672267 } 
    2268  
    2269  roar_buffer_get_data(b, &buf); 
    22702268 
    22712269 ROAR_DBG("streams_check(id=%i): buffer is up and ready ;)", id); 
Note: See TracChangeset for help on using the changeset viewer.