Changeset 5249:26fb6a2e20fc in roaraudio


Ignore:
Timestamp:
11/13/11 15:01:24 (8 years ago)
Author:
phi
Branch:
default
Message:

fixed warnings

Location:
roarclients
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roardtmf.c

    r4929 r5249  
    7676} 
    7777 
    78 int calc (int16_t * samples, size_t len, int rate, char c) { 
     78int calc_break (int16_t * samples, size_t len, int rate, char c) { 
     79 (void)rate, (void)c; 
     80 memset(samples, 0, len); 
     81 return 0; 
     82} 
     83 
     84int calc_tone (int16_t * samples, size_t len, int rate, char c) { 
    7985 struct tone * ct = NULL; 
    8086 int i; 
     
    128134 size_t len; 
    129135 char   c; 
     136 int err; 
    130137 
    131138 for (i = 1; i < argc; i++) { 
     
    162169  return 4; 
    163170 
    164  if ( (vss = roar_vs_new_playback(server, name, rate, 1, ROAR_CODEC_DEFAULT, 16, NULL)) == NULL ) { 
    165   fprintf(stderr, "Error: can not start playback\n"); 
     171 if ( (vss = roar_vs_new_playback(server, name, rate, 1, ROAR_CODEC_DEFAULT, 16, &err)) == NULL ) { 
     172  fprintf(stderr, "Error: can not start playback: %s\n", roar_vs_strerr(err)); 
    166173  roar_mm_free(buf); 
    167174  return 1; 
     
    171178  tones++; 
    172179 
    173   if ( c == ' ' || c == '+' || c == '.' || c == '_' ) 
     180  if ( c == '+' || c == '.' || c == '_' ) 
    174181   continue; 
    175182 
    176   if ( calc(buf, len, rate, c) == -1 ) { 
     183  if ( c == ' ' ) { 
     184   calc_break(buf, len, rate, c); 
     185  } else { 
     186   if ( calc_tone(buf, len, rate, c) == -1 ) { 
     187    roar_mm_free(buf); 
     188    return 5; 
     189   } 
     190  } 
     191  if ( roar_vs_write(vss, buf, len, &err) != (ssize_t)len ) { 
     192   fprintf(stderr, "Error: can not write data: %s\n", roar_vs_strerr(err)); 
    177193   roar_mm_free(buf); 
    178194   return 5; 
    179195  } 
    180   roar_vs_write(vss, buf, len, NULL); 
    181196 } 
    182197 
  • roarclients/roarmonhttp.c

    r5238 r5249  
    8181 int ret; 
    8282 
    83  roar_vio_nonblock(src,  ROAR_SOCKET_NONBLOCK); 
    84  roar_vio_nonblock(dest, ROAR_SOCKET_NONBLOCK); 
     83 if ( roar_vio_nonblock(src,  ROAR_SOCKET_NONBLOCK) == -1 ) { 
     84  ROAR_WARN("stream(dest=%p, src=%p): Can not set source stream non-blocking: %s", 
     85            dest, src, roar_error2str(roar_error)); 
     86 } 
     87 if ( roar_vio_nonblock(dest, ROAR_SOCKET_NONBLOCK) == -1 ) { 
     88  ROAR_WARN("stream(dest=%p, src=%p): Can not set destination stream non-blocking: %s", 
     89            dest, src, roar_error2str(roar_error)); 
     90 } 
    8591 
    8692 ROAR_VIO_SELECT_SETVIO(&(vios[0]), src,  ROAR_VIO_SELECT_READ); 
     
    125131      ring = cur; 
    126132     } else { 
    127       roar_buffer_add(ring, cur); 
     133      if ( roar_buffer_add(ring, cur) == -1 ) { 
     134       ROAR_ERR("stream(dest=%p, src=%p): Can not append buffer to ring: %s", 
     135                dest, src, roar_error2str(roar_error)); 
     136       roar_buffer_free(ring); 
     137       roar_buffer_free(cur); 
     138       return -1; 
     139      } 
    128140     } 
    129141    } 
  • roarclients/roarsin.c

    r5186 r5249  
    122122   tcalc += step; 
    123123  } 
    124   roar_vs_write(vss, out, 2048, NULL); 
     124  if ( roar_vs_write(vss, out, 2048, &err) != (ssize_t)2048 ) { 
     125   fprintf(stderr, "Error: can not write data: %s\n", roar_vs_strerr(err)); 
     126   break; 
     127  } 
    125128 
    126129  // this code enables us to generate the same signal for a long periode of time 
  • roarclients/roarvorbis.c

    r5139 r5249  
    391391      case we (the app) cares.  In this case, we don't. */ 
    392392  } else { 
    393    roar_vs_write(vss, pcmout, ret, NULL); 
     393   if ( roar_vs_write(vss, pcmout, ret, NULL) != (ssize_t)ret ) { 
     394    fprintf(stderr, "\nError: Can not write to server.\n"); 
     395    eof = 1; 
     396    continue; 
     397   } 
    394398   bits_written += ret * 8; 
    395399   if ( bits_written > bits_per_sec ) { 
Note: See TracChangeset for help on using the changeset viewer.