fix more struct timeval related warnings
authorAndre <maan@p133.(none)>
Sun, 16 Apr 2006 17:56:09 +0000 (19:56 +0200)
committerAndre <maan@p133.(none)>
Sun, 16 Apr 2006 17:56:09 +0000 (19:56 +0200)
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
audiod.c
command.c
mp3.c

diff --git a/afs.c b/afs.c
index 4a4e46e..0f4cd20 100644 (file)
--- 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);
                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]);
        for (i = 0; senders[i].name; i++) {
                PARA_NOTICE_LOG("initializing %s sender\n", senders[i].name);
                senders[i].init(&senders[i]);
index 975b3df..ae20d70 100644 (file)
--- 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);
        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);
        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;
 }
 out:
        return ret;
 }
index 48c3403..43c02ff 100644 (file)
--- 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,
                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
 
        );
                status_item_list[SI_CURRENT_TIME], now.tv_sec, now.tv_usec
 
        );
diff --git a/mp3.c b/mp3.c
index 3f8eb00..ab05d2e 100644 (file)
--- 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,
        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,
                "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,
                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);
        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;
        tv_scale(30, &af->chunk_tv, &af->eof_tv);
        PARA_DEBUG_LOG("eof timeout: %lu\n", tv2ms(&af->eof_tv));
        return 1;