]> git.tue.mpg.de Git - paraslash.git/commitdiff
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 4a4e46e71c1556eef9716a0463cb9e808518a4ab..0f4cd20e889811a6cbf466ba2e35990915b02e76 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);
-       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]);
index 975b3dfee38a86352bf0c224b135424d6151826d..ae20d70137a6bb097109d731dd6fce63afbd7c19 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);
-       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;
 }
index 48c34031a75f5e1d93401f419858bb3746e481ad..43c02ff91a259639fd9a1e580eae56a2cac29b8d 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,
-               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 3f8eb009bbd3f0cf2b713a9abba72902f08a9cca..ab05d2e7d62989e61305700cbccf997d2b3641ff 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,
-               "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;