From 8a8cd0f5bb40dcfad68608193e8c57decd90b25e Mon Sep 17 00:00:00 2001 From: Andre Date: Fri, 23 Jun 2006 15:04:37 +0200 Subject: [PATCH 1/1] fix gcc warnings on shadowed declarations --- aac_afh.c | 1 - audiod.c | 18 +++++++++--------- audiod_command.c | 8 ++++---- dbadm.c | 8 ++++---- dccp_send.c | 6 +++--- fd.c | 4 ++-- fd.h | 2 +- grab_client.c | 24 ++++++++++++------------ gui.c | 8 ++++---- http_send.c | 6 +++--- mp3_afh.c | 2 +- net.c | 17 ++++++++++------- net.h | 2 +- ogg_afh.c | 12 ++++++------ ortp_recv.c | 10 +++++----- para.h | 2 +- sdl_gui.c | 48 +++++++++++++++++++++++------------------------- time.c | 11 ++++++----- write.c | 46 ++++++++++++++++++++++------------------------ 19 files changed, 117 insertions(+), 118 deletions(-) diff --git a/aac_afh.c b/aac_afh.c index e6f99b4f..d60588b4 100644 --- a/aac_afh.c +++ b/aac_afh.c @@ -114,7 +114,6 @@ static int read_chunk_table(size_t skip) PARA_DEBUG_LOG("offset #%d: %zu\n", i, chunk_table[i]); } return 1; - } long unsigned aac_set_chunk_tv(mp4AudioSpecificConfig *mp4ASC) diff --git a/audiod.c b/audiod.c index b1313d15..3b611196 100644 --- a/audiod.c +++ b/audiod.c @@ -541,18 +541,18 @@ static void check_stat_line(char *line) break; case SI_STREAM_START: if (sscanf(line + ilen + 1, "%lu.%lu", &sec, &usec) == 2) { - struct timeval tmp, delay; + struct timeval a_start, delay; delay.tv_sec = conf.stream_delay_arg / 1000; delay.tv_usec = (conf.stream_delay_arg % 1000) * 1000; stat_task->server_stream_start.tv_sec = sec; stat_task->server_stream_start.tv_usec = usec; if (stat_task->sa_time_diff_sign < 0) tv_add(&stat_task->server_stream_start, - &stat_task->sa_time_diff, &tmp); + &stat_task->sa_time_diff, &a_start); else tv_diff(&stat_task->server_stream_start, - &stat_task->sa_time_diff, &tmp); - tv_add(&tmp, &delay, &initial_delay_barrier); + &stat_task->sa_time_diff, &a_start); + tv_add(&a_start, &delay, &initial_delay_barrier); } break; case SI_CURRENT_TIME: @@ -755,17 +755,17 @@ static int init_receivers(void) } for (i = conf.receiver_given - 1; i >= 0; i--) { char *arg = conf.receiver_arg[i]; - char *recv = strchr(arg, ':'); + char *recv_arg = strchr(arg, ':'); PARA_INFO_LOG("arg: %s\n", arg); ret = -E_MISSING_COLON; - if (!recv) + if (!recv_arg) goto out; - *recv = '\0'; - recv++; + *recv_arg = '\0'; + recv_arg++; ret = get_audio_format_num(arg); if (ret < 0) goto out; - afi[ret].receiver_conf = check_receiver_arg(recv, &receiver_num); + afi[ret].receiver_conf = check_receiver_arg(recv_arg, &receiver_num); if (!afi[ret].receiver_conf) { ret = -E_RECV_SYNTAX; goto out; diff --git a/audiod_command.c b/audiod_command.c index 4d7afd2f..fe26b663 100644 --- a/audiod_command.c +++ b/audiod_command.c @@ -261,7 +261,7 @@ static struct timeval *wstime(void) __malloc static char *decoder_flags(void) { int i; - char decoder_flags[MAX_STREAM_SLOTS + 1]; + char flags[MAX_STREAM_SLOTS + 1]; FOR_EACH_SLOT(i) { struct slot_info *s = &slot[i]; @@ -270,11 +270,11 @@ __malloc static char *decoder_flags(void) flag += 1; if (s->wng) flag += 2; - decoder_flags[i] = flag; + flags[i] = flag; } - decoder_flags[MAX_STREAM_SLOTS] = '\0'; + flags[MAX_STREAM_SLOTS] = '\0'; return make_message("%s:%s\n", status_item_list[SI_DECODER_FLAGS], - decoder_flags); + flags); } static int dump_commands(int fd) diff --git a/dbadm.c b/dbadm.c index 6b5a3e98..40ecf0b8 100644 --- a/dbadm.c +++ b/dbadm.c @@ -56,19 +56,19 @@ static int client_cmd(const char *cmd) static char **get_all_atts(int *num_atts) { int fd = client_cmd("laa"); - FILE *pipe; + FILE *f; char **ret = NULL, *buf; if (fd < 0) return NULL; - pipe = fdopen(fd, "r"); - if (!pipe) { + f = fdopen(fd, "r"); + if (!f) { close(fd); return NULL; } *num_atts = 0; buf = para_malloc(MAXLINE * sizeof(char)); - while (fgets(buf, MAXLINE - 1, pipe) && *buf) { + while (fgets(buf, MAXLINE - 1, f) && *buf) { size_t n = strlen(buf); buf[n - 1] = '\0'; if (choice_len < n - 1) diff --git a/dccp_send.c b/dccp_send.c index 08930ad1..aba21a6d 100644 --- a/dccp_send.c +++ b/dccp_send.c @@ -122,11 +122,11 @@ static void dccp_shutdown_client(struct dccp_client *dc) static int dccp_write(int fd, const char *buf, size_t len) { - size_t send, written = 0; + size_t size, written = 0; int ret; again: - send = PARA_MIN(1024, len - written); - ret = write(fd, buf + written, send); + size = PARA_MIN(1024, len - written); + ret = write(fd, buf + written, size); if (ret < 0) goto err_out; written += ret; diff --git a/fd.c b/fd.c index b9130093..36b3769d 100644 --- a/fd.c +++ b/fd.c @@ -56,11 +56,11 @@ int file_exists(const char *fn) * \sa select(2) select_tut(2) */ int para_select(int n, fd_set *readfds, fd_set *writefds, - struct timeval *timeout) + struct timeval *timeout_tv) { int ret, err; do { - ret = select(n, readfds, writefds, NULL, timeout); + ret = select(n, readfds, writefds, NULL, timeout_tv); err = errno; } while (ret < 0 && err == EINTR); if (ret < 0) diff --git a/fd.h b/fd.h index e17f11f6..46178bd4 100644 --- a/fd.h +++ b/fd.h @@ -20,7 +20,7 @@ int file_exists(const char *); int para_select(int n, fd_set *readfds, fd_set *writefds, - struct timeval *timeout); + struct timeval *timeout_tv); int mark_fd_nonblock(int fd); void para_fd_set(int fd, fd_set *fds, int *max_fileno); __must_check int para_fread(void *dest, size_t nbytes, size_t nmemb, FILE *stream); diff --git a/grab_client.c b/grab_client.c index 735e5b4b..efe9cf61 100644 --- a/grab_client.c +++ b/grab_client.c @@ -89,31 +89,31 @@ rewrite: static int check_gc_args(struct grab_client *gc) { int i; - struct grab_client_args_info *conf = gc->conf; + struct grab_client_args_info *c = gc->conf; char **mv = grab_client_cmdline_parser_mode_values; - PARA_INFO_LOG("filter_num: %d\n", gc->conf->filter_num_arg); + PARA_INFO_LOG("filter_num: %d\n", c->filter_num_arg); for (i = 0; mv[i]; i++) - if (!strcmp(conf->mode_arg, mv[i])) + if (!strcmp(c->mode_arg, mv[i])) break; if (!mv[i]) return -E_GC_SYNTAX; gc->mode = i; gc->audio_format_num = -1; - if (conf->audio_format_given) { - gc->audio_format_num = get_audio_format_num(conf->audio_format_arg); + if (c->audio_format_given) { + gc->audio_format_num = get_audio_format_num(c->audio_format_arg); if (gc->audio_format_num < 0) return gc->audio_format_num; } - if (conf->slot_arg > MAX_STREAM_SLOTS) + if (c->slot_arg > MAX_STREAM_SLOTS) return -E_BAD_GC_SLOT; - if (conf->filter_num_arg <= 0) + if (c->filter_num_arg <= 0) return -E_BAD_GC_FILTER_NUM; - if (conf->audio_format_given) { - if (num_filters(gc->audio_format_num) < conf->filter_num_arg) + if (c->audio_format_given) { + if (num_filters(gc->audio_format_num) < c->filter_num_arg) return -E_BAD_GC_FILTER_NUM; } else - if (conf->filter_num_arg > max_num_filters()) + if (c->filter_num_arg > max_num_filters()) return -E_BAD_GC_FILTER_NUM; return 1; @@ -183,7 +183,7 @@ void activate_grab_client(struct grab_client *gc, struct filter_node *fn) * \sa filter_chain_info::filters, inactive_grab_client_list, * activate_grab_client */ -void activate_inactive_grab_clients(int slot, int audio_format_num, +void activate_inactive_grab_clients(int slot_num, int audio_format_num, struct list_head *filter_list) { struct grab_client *gc, *tmp; @@ -192,7 +192,7 @@ void activate_inactive_grab_clients(int slot, int audio_format_num, list_for_each_entry_safe(gc, tmp, &inactive_grab_client_list, node) { // PARA_INFO_LOG("checking inactive grab client %p\n", gc); - if (gc->conf->slot_arg >= 0 && gc->conf->slot_arg != slot) + if (gc->conf->slot_arg >= 0 && gc->conf->slot_arg != slot_num) continue; if (gc->audio_format_num >= 0 && gc->audio_format_num != audio_format_num) diff --git a/gui.c b/gui.c index cea54ab8..ffd1ea84 100644 --- a/gui.c +++ b/gui.c @@ -1083,22 +1083,22 @@ static void com_scroll_up(void) { struct rb_entry *rbe = NULL; unsigned lines; - int i, first_rbe, scroll; + int i, first_rbe, num_scroll; /* the entry that is going to vanish */ rbe = ringbuffer_get(bot_win_rb, scroll_position); if (!rbe) goto err_out; - scroll = NUM_LINES(rbe->len); + num_scroll = NUM_LINES(rbe->len); first_rbe = first_visible_rbe(&lines); if (first_rbe < 0 || (first_rbe == ringbuffer_filled(bot_win_rb) - 1)) goto err_out; scroll_position++; - wscrl(bot.win, -scroll); + wscrl(bot.win, -num_scroll); i = draw_top_rbe(&lines); if (i < 0) goto err_out; - while (i > 0 && lines < scroll) { + while (i > 0 && lines < num_scroll) { int rbe_lines; rbe = ringbuffer_get(bot_win_rb, --i); if (!rbe) diff --git a/http_send.c b/http_send.c index f0c9851f..111c49ba 100644 --- a/http_send.c +++ b/http_send.c @@ -208,11 +208,11 @@ static void http_send( long unsigned current_chunk, continue; if (hc->status == HTTP_READY_TO_STREAM) { int hlen; - char *buf = afs_get_header(&hlen); - if (buf && hlen > 0 && current_chunk) { + char *hbuf = afs_get_header(&hlen); + if (hbuf && hlen > 0 && current_chunk) { /* need to send header */ PARA_INFO_LOG("queueing header: %d\n", hlen); - if (queue_packet(hc, buf, hlen) < 0) + if (queue_packet(hc, hbuf, hlen) < 0) continue; } else PARA_INFO_LOG("%s", "no need to queue header\n"); diff --git a/mp3_afh.c b/mp3_afh.c index cd089946..d38e4359 100644 --- a/mp3_afh.c +++ b/mp3_afh.c @@ -403,7 +403,7 @@ static int mp3_read_info(void) tv_divide(fcount, &total_time, &af->chunk_tv); rewind(mp3.file); PARA_DEBUG_LOG("chunk_time: %lums\n", tv2ms(&af->chunk_tv)); - tv_scale(30, &af->chunk_tv, &af->eof_tv); + tv_scale(3, &af->chunk_tv, &af->eof_tv); PARA_DEBUG_LOG("eof timeout: %lu\n", tv2ms(&af->eof_tv)); return 1; } diff --git a/net.c b/net.c index c70c658c..b05f74da 100644 --- a/net.c +++ b/net.c @@ -39,11 +39,11 @@ static struct crypt_data *crypt_data_array; * activate encryption for one file descriptor * * \param fd the file descriptor - * \param recv the function used for decrypting received data - * \param send the function used for encrypting before sending + * \param recv_f the function used for decrypting received data + * \param send_f the function used for encrypting before sending * \param private_data user data supplied by the caller */ -void enable_crypt(int fd, crypt_function *recv, crypt_function *send, +void enable_crypt(int fd, crypt_function *recv_f, crypt_function *send_f, void *private_data) { if (fd + 1 > cda_size) { @@ -53,8 +53,8 @@ void enable_crypt(int fd, crypt_function *recv, crypt_function *send, (fd + 1 - cda_size) * sizeof(struct crypt_data)); cda_size = fd + 1; } - crypt_data_array[fd].recv = recv; - crypt_data_array[fd].send = send; + crypt_data_array[fd].recv = recv_f; + crypt_data_array[fd].send = send_f; crypt_data_array[fd].private_data = private_data; PARA_INFO_LOG("rc4 encryption activated for fd %d\n", fd); } @@ -578,8 +578,11 @@ int recv_pattern(int fd, const char *pattern, size_t bufsize) goto out; ret = 1; out: - if (ret < 0) - PARA_NOTICE_LOG("did not receive pattern '%s'\n", pattern); + if (ret < 0) { + PARA_NOTICE_LOG("n = %d, did not receive pattern '%s'\n", n, pattern); + if (n > 0) + PARA_NOTICE_LOG("recvd: %s\n", buf); + } free(buf); return ret; } diff --git a/net.h b/net.h index 58732c0c..4a89778b 100644 --- a/net.h +++ b/net.h @@ -48,7 +48,7 @@ int recv_cred_buffer(int, char *, size_t); ssize_t send_cred_buffer(int, char*); int recv_pattern(int fd, const char *pattern, size_t bufsize); int init_tcp_socket(int port); -void enable_crypt(int fd, crypt_function *recv, crypt_function *send, +void enable_crypt(int fd, crypt_function *recv_f, crypt_function *send_f, void *private_data); void disable_crypt(int fd); diff --git a/ogg_afh.c b/ogg_afh.c index 874947e8..cce1eb54 100644 --- a/ogg_afh.c +++ b/ogg_afh.c @@ -37,7 +37,7 @@ static FILE *infile; static int header_len, oggbuf_len, vi_channels; static char *header, *oggbuf; static ssize_t *chunk_table, max_chunk_len; -struct audio_format_handler *af; +static struct audio_format_handler *af; static long vi_sampling_rate, vi_bitrate, vi_bitrate_nominal, num_chunks; @@ -129,7 +129,7 @@ static void tunetable(void) continue; } if (j < 0) - tv_scale(i + 2, &af->chunk_tv, &af->eof_tv); + tv_scale(i, &af->chunk_tv, &af->eof_tv); for (j = lp; j < i; j++) chunk_table[j] = chunk_table[i]; lp = i; @@ -207,14 +207,14 @@ static void ogg_close_audio_file(void) oggbuf_len = 0; } -static int ogg_save_header(FILE *file, int header_len) +static int ogg_save_header(FILE *file, int len) { int ret; - header = para_malloc(header_len); + header = para_malloc(len); rewind(file); - ret = read(fileno(file), header, header_len); - if (ret != header_len) + ret = read(fileno(file), header, len); + if (ret != len) return -E_OGG_READ; return 1; } diff --git a/ortp_recv.c b/ortp_recv.c index 00dac0e3..1f2f78b7 100644 --- a/ortp_recv.c +++ b/ortp_recv.c @@ -273,20 +273,20 @@ static void *ortp_recv_parse_config(int argc, char **argv) static int ortp_recv_open(struct receiver_node *rn) { struct private_ortp_recv_data *pord; - struct ortp_recv_args_info *conf = rn->conf; + struct ortp_recv_args_info *c = rn->conf; rn->buf = para_calloc(CHUNK_SIZE); rn->private_data = para_calloc(sizeof(struct private_ortp_recv_data)); pord = rn->private_data; pord->session = rtp_session_new(RTP_SESSION_RECVONLY); - PARA_NOTICE_LOG("receiving from %s:%d\n", conf->host_arg, conf->port_arg); - rtp_session_set_local_addr(pord->session, conf->host_arg, conf->port_arg); + PARA_NOTICE_LOG("receiving from %s:%d\n", c->host_arg, c->port_arg); + rtp_session_set_local_addr(pord->session, c->host_arg, c->port_arg); rtp_session_set_payload_type(pord->session, PAYLOAD_AUDIO_CONTINUOUS); - if (conf->jitter_compensation_arg) { + if (c->jitter_compensation_arg) { rtp_session_enable_adaptive_jitter_compensation(pord->session, TRUE); rtp_session_set_jitter_compensation(pord->session, - conf->jitter_compensation_arg); + c->jitter_compensation_arg); } return 1; } diff --git a/para.h b/para.h index e1b0d73f..26e04c6c 100644 --- a/para.h +++ b/para.h @@ -131,7 +131,7 @@ long unsigned tv2ms(const struct timeval*); void d2tv(double, struct timeval*); void tv_add(const struct timeval*, const struct timeval *, struct timeval *); void tv_scale(const unsigned long, const struct timeval *, struct timeval *); -void tv_divide(const unsigned long div, const struct timeval *tv, +void tv_divide(const unsigned long divisor, const struct timeval *tv, struct timeval *result); int tv_convex_combination(const long a, const struct timeval *tv1, const long b, const struct timeval *tv2, diff --git a/sdl_gui.c b/sdl_gui.c index c30465e5..b67b3d1e 100644 --- a/sdl_gui.c +++ b/sdl_gui.c @@ -505,7 +505,7 @@ static SDLKey hit_key(const char *msg) */ static int command_handler(void) { - FILE *pipe; + FILE *f; unsigned count = 0; char text[MAXLINE]=""; char buf[MAXLINE]=""; @@ -521,15 +521,15 @@ static int command_handler(void) if (text[0] == '!') { if (text[1] == '\0') return 1; - pipe = popen(text + 1, "r"); + f = popen(text + 1, "r"); } else { sprintf(buf, BINDIR "/para_client %s 2>&1", text); - pipe = popen(buf, "r"); + f = popen(buf, "r"); } - if (!pipe) + if (!f) return 0; fill_output_rect(); - while(fgets(text, MAXLINE - 1, pipe)) { + while(fgets(text, MAXLINE - 1, f)) { int len; tab2space(text); @@ -554,7 +554,7 @@ static int command_handler(void) update_all(); hit_key("Hit any key to return"); out: fill_output_rect(); - pclose(pipe); + pclose(f); return 1; } @@ -585,14 +585,14 @@ SDL_Surface *load_jpg(void) SDL_RWops *rwop; int fds[3] = {0, 1, 0}; pid_t pid; - FILE *pipe; + FILE *f; if (para_exec_cmdline_pid(&pid, args_info.pic_cmd_arg, fds) < 0) return NULL; - pipe = fdopen(fds[1], "r"); - if (!pipe) + f = fdopen(fds[1], "r"); + if (!f) return NULL; - if (!(rwop = SDL_RWFromFP(pipe, 0))) + if (!(rwop = SDL_RWFromFP(f, 0))) return NULL; return IMG_LoadJPG_RW(rwop); } @@ -689,7 +689,7 @@ void update_status(char *buf) * Read stat line from pipe if pipe is ready, call update_status to * display information. */ -static int draw_status(int pipe) +static int draw_status(int fd) { fd_set rfds; int ret; @@ -698,11 +698,11 @@ static int draw_status(int pipe) tv.tv_sec = 0; tv.tv_usec = 3000000; FD_ZERO(&rfds); - FD_SET(pipe, &rfds); - ret = para_select(pipe + 1, &rfds, NULL, &tv); + FD_SET(fd, &rfds); + ret = para_select(fd + 1, &rfds, NULL, &tv); if (ret <= 0) return 0; - if (read_audiod_pipe(pipe, update_status) > 0) + if (read_audiod_pipe(fd, update_status) > 0) return 1; free(stat_items[SI_STATUS_BAR].content); stat_items[SI_STATUS_BAR].content = @@ -739,7 +739,7 @@ static int configfile_exists(void) */ int main(int argc, char *argv[]) { - int i, ret, pipe; + int i, ret, fd; SDLKey sym; sdl_gui_cmdline_parser(argc, argv, &args_info); @@ -759,7 +759,7 @@ int main(int argc, char *argv[]) height = args_info.height_arg; // printf("w=%i,h=%i,ret=%i, cf=%s\n", width, height, ret, args_info.config_file_arg); init_stat_items(); - pipe = para_open_audiod_pipe(args_info.stat_cmd_arg); + fd = para_open_audiod_pipe(args_info.stat_cmd_arg); init_SDL(); for (i = 0; fonts[i].name[0]; i++) { char buf[MAXLINE]; @@ -775,10 +775,10 @@ int main(int argc, char *argv[]) update_input(); } for (;;) { - ret = draw_status(pipe); + ret = draw_status(fd); if (ret < 0) { - close(pipe); - pipe = -1; + close(fd); + fd = -1; } if (SDL_QuitRequested()) clean_exit(0); @@ -802,11 +802,9 @@ int main(int argc, char *argv[]) || sym == SDLK_COMPOSE ) continue; - if (pipe < 0) { -// printf("closing pipe\n"); - kill(0, SIGINT); - close(pipe); -// printf("pipe closed\n"); + if (fd < 0) { + kill(0, SIGINT); + close(fd); } fill_input_rect(); update_input(); @@ -816,7 +814,7 @@ int main(int argc, char *argv[]) print_help(); update_pic(); SDL_UpdateRect(screen, 0, 0, 0, 0); - pipe = para_open_audiod_pipe(args_info.stat_cmd_arg); + fd = para_open_audiod_pipe(args_info.stat_cmd_arg); break; } } diff --git a/time.c b/time.c index 34e3de95..d6e07080 100644 --- a/time.c +++ b/time.c @@ -106,16 +106,17 @@ void tv_scale(const unsigned long mult, const struct timeval *tv, /** * compute fraction of given struct timeval * - * \param div the integer value to divide by + * \param divider the integer value to divide by * \param tv the timevalue to divide * \param result holds (1 / mult) * tv upon return */ -void tv_divide(const unsigned long div, const struct timeval *tv, +void tv_divide(const unsigned long divisor, const struct timeval *tv, struct timeval *result) { - long unsigned q = tv->tv_usec / div; - result->tv_sec = tv->tv_sec / div; - result->tv_usec = (tv->tv_sec - result->tv_sec * div) * 1000 * 1000 / div; + long unsigned q = tv->tv_usec / divisor; + result->tv_sec = tv->tv_sec / divisor; + result->tv_usec = (tv->tv_sec - result->tv_sec * divisor) + * 1000 * 1000 / divisor; if (result->tv_usec + q >= 1000 * 1000) { result->tv_sec++; result->tv_usec = 1000 * 1000 - result->tv_usec - q; diff --git a/write.c b/write.c index 498dd78d..7f29665d 100644 --- a/write.c +++ b/write.c @@ -59,37 +59,37 @@ static struct writer_node_group *wng; */ static void check_wav_pre_select(__a_unused struct sched *s, struct task *t) { - struct check_wav_task *cwt = t->private_data; + struct check_wav_task *wt = t->private_data; unsigned char *a; - if (*cwt->loaded < WAV_HEADER_LEN) { - t->ret = *cwt->eof? -E_PREMATURE_END : 1; + if (*wt->loaded < WAV_HEADER_LEN) { + t->ret = *wt->eof? -E_PREMATURE_END : 1; return; } - cwt->channels = 2; - cwt->samplerate = 44100; - a = (unsigned char*)cwt->buf; + wt->channels = 2; + wt->samplerate = 44100; + a = (unsigned char*)wt->buf; t->ret = -E_NO_WAV_HEADER; if (a[0] != 'R' || a[1] != 'I' || a[2] != 'F' || a[3] != 'F') return; - cwt->channels = (unsigned) a[22]; - cwt->samplerate = a[24] + (a[25] << 8) + (a[26] << 16) + (a[27] << 24); - *cwt->loaded -= WAV_HEADER_LEN; - memmove(cwt->buf, cwt->buf + WAV_HEADER_LEN, *cwt->loaded); + wt->channels = (unsigned) a[22]; + wt->samplerate = a[24] + (a[25] << 8) + (a[26] << 16) + (a[27] << 24); + *wt->loaded -= WAV_HEADER_LEN; + memmove(wt->buf, wt->buf + WAV_HEADER_LEN, *wt->loaded); t->ret = -E_WAV_HEADER_SUCCESS; - PARA_INFO_LOG("channels: %d, sample rate: %d\n", cwt->channels, cwt->samplerate); + PARA_INFO_LOG("channels: %d, sample rate: %d\n", wt->channels, wt->samplerate); } static void initial_delay_pre_select(struct sched *s, struct task *t) { - struct initial_delay_task *idt = t->private_data; + struct initial_delay_task *dt = t->private_data; struct timeval diff; t->ret = -E_NO_DELAY; - if (!idt->start_time.tv_sec && !idt->start_time.tv_usec) + if (!dt->start_time.tv_sec && !dt->start_time.tv_usec) return; t->ret = -E_DELAY_TIMEOUT; - if (tv_diff(now, &idt->start_time, &diff) > 0) + if (tv_diff(now, &dt->start_time, &diff) > 0) return; t->ret = 1; if (tv_diff(&s->timeout , &diff, NULL) > 0) @@ -110,7 +110,7 @@ void para_log(int ll, const char* fmt,...) static struct writer_node_group *check_args(void) { int i, ret = -E_WRITE_SYNTAX; - struct writer_node_group *wng = NULL; + struct writer_node_group *g = NULL; if (conf.list_writers_given) { char *msg = NULL; @@ -126,8 +126,6 @@ static struct writer_node_group *check_args(void) free(msg); exit(EXIT_SUCCESS); } -// if (conf.prebuffer_arg < 0 || conf.prebuffer_arg > 100) -// goto out; if (conf.start_time_given) { long unsigned sec, usec; if (sscanf(conf.start_time_arg, "%lu:%lu", @@ -137,25 +135,25 @@ static struct writer_node_group *check_args(void) idt.start_time.tv_usec = usec; } if (!conf.writer_given) { - wng = setup_default_wng(); + g = setup_default_wng(); ret = 1; goto out; } - wng = wng_new(conf.writer_given); + g = wng_new(conf.writer_given); ret = -E_WRITE_SYNTAX; for (i = 0; i < conf.writer_given; i++) { int writer_num; - wng->writer_nodes[i].conf = check_writer_arg( + g->writer_nodes[i].conf = check_writer_arg( conf.writer_arg[i], &writer_num); - if (!wng->writer_nodes[i].conf) + if (!g->writer_nodes[i].conf) goto out; - wng->writer_nodes[i].writer = &writers[writer_num]; + g->writer_nodes[i].writer = &writers[writer_num]; } ret = 1; out: if (ret > 0) - return wng; - free(wng); + return g; + free(g); return NULL; } -- 2.39.2