From 586cea4b850e53eedf7426379f6af6a7e76dee6e Mon Sep 17 00:00:00 2001 From: Andre Date: Sun, 16 Apr 2006 19:56:09 +0200 Subject: [PATCH] fix more struct timeval related warnings Use tv2ms() which returns long unsigned where appropriate. For the remaining cases, cast the members of struct timeval to long unsigned if used via a format string. --- afs.c | 2 +- audiod.c | 9 +++------ command.c | 5 +++-- mp3.c | 6 +++--- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/afs.c b/afs.c index 4a4e46e7..0f4cd20e 100644 --- a/afs.c +++ b/afs.c @@ -150,7 +150,7 @@ void afs_init(void) afl[i].init(&afl[i]); } ms2tv(conf.announce_time_arg, &announce_tv); - PARA_INFO_LOG("announce timeval: %lu:%lu\n", announce_tv.tv_sec, announce_tv.tv_usec); + PARA_INFO_LOG("announce timeval: %lums\n", tv2ms(&announce_tv)); for (i = 0; senders[i].name; i++) { PARA_NOTICE_LOG("initializing %s sender\n", senders[i].name); senders[i].init(&senders[i]); diff --git a/audiod.c b/audiod.c index 975b3dfe..ae20d701 100644 --- a/audiod.c +++ b/audiod.c @@ -609,17 +609,14 @@ __malloc static char *glob_cmd(char *cmd) else tv_diff(&server_stream_start, &sa_time_diff, &rss); tv_add(&rss, &delay, &tmp); - replacement = make_message("%lu:%lu", tmp.tv_sec, tmp.tv_usec); + replacement = make_message("%lu:%lu", + (long unsigned)tmp.tv_sec, + (long unsigned)tmp.tv_usec); ret = s_a_r(cmd, "STREAM_START", replacement); free(replacement); if (!ret) goto out; PARA_INFO_LOG("cmd: %s, repl: %s\n", cmd, ret); - { - struct timeval now; - gettimeofday(&now, NULL); - PARA_INFO_LOG("now: %lu:%lu\n", now.tv_sec, now.tv_usec); - } out: return ret; } diff --git a/command.c b/command.c index 48c34031..43c02ff9 100644 --- a/command.c +++ b/command.c @@ -433,8 +433,9 @@ static char *get_status(struct misc_meta_data *nmmd) nmmd->audio_file_info, status_item_list[SI_UPTIME], ut, - status_item_list[SI_STREAM_START], nmmd->stream_start.tv_sec, - nmmd->stream_start.tv_usec, + status_item_list[SI_STREAM_START], + (long unsigned)nmmd->stream_start.tv_sec, + (long unsigned)nmmd->stream_start.tv_usec, status_item_list[SI_CURRENT_TIME], now.tv_sec, now.tv_usec ); diff --git a/mp3.c b/mp3.c index 3f8eb009..ab05d2e7 100644 --- a/mp3.c +++ b/mp3.c @@ -159,11 +159,11 @@ static void write_info_str(char *info_str) int v = mp3.id3_isvalid; snprintf(info_str, MMD_INFO_SIZE, - "audio_file_info1:%d x %lu, %lu kbit/s (%cbr) %i KHz %s\n" + "audio_file_info1:%d x %lums, %lu kbit/s (%cbr) %i KHz %s\n" "audio_file_info2:%s, by %s\n" "audio_file_info3:A: %s, Y: %s, C: %s\n", mp3.frames, - af->chunk_tv.tv_usec, + tv2ms(&af->chunk_tv), mp3.br_average, mp3.vbr? 'v' : 'c', mp3.freq / 1000, @@ -410,7 +410,7 @@ static int mp3_read_info(void) mp3.seconds = (tv2ms(&total_time) + 500) / 1000; tv_divide(fcount, &total_time, &af->chunk_tv); rewind(mp3.file); - PARA_DEBUG_LOG("chunk_time: %lu\n", af->chunk_tv.tv_usec); + PARA_DEBUG_LOG("chunk_time: %lums\n", tv2ms(&af->chunk_tv)); tv_scale(30, &af->chunk_tv, &af->eof_tv); PARA_DEBUG_LOG("eof timeout: %lu\n", tv2ms(&af->eof_tv)); return 1; -- 2.39.5