audiod: do not use pointers to members of struct timeval for sscanf()
authorAndre <maan@p133.(none)>
Sun, 16 Apr 2006 18:37:52 +0000 (20:37 +0200)
committerAndre <maan@p133.(none)>
Sun, 16 Apr 2006 18:37:52 +0000 (20:37 +0200)
Use temporary long unsigned variables instead. Fixes warnings of the
form

audiod.c:844: warning: format '%lu' expects type 'long unsigned int *', but argument 4 has type 'suseconds_t *'

on MacOs

audiod.c

index ae20d70..462ecc8 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -806,7 +806,7 @@ static void check_stat_line(char *line)
 {
        int itemnum;
        size_t ilen = 0;
-       struct timeval tv;
+       long unsigned sec, usec;
        char *tmp;
 
        PARA_INFO_LOG("line: %s\n", line);
@@ -838,14 +838,16 @@ static void check_stat_line(char *line)
                length_seconds = atoi(line + ilen + 1);
                break;
        case SI_STREAM_START:
-               if (sscanf(line + ilen + 1, "%lu.%lu",
-                               &tv.tv_sec, &tv.tv_usec) == 2)
-                       server_stream_start = tv;
+               if (sscanf(line + ilen + 1, "%lu.%lu", &sec, &usec) == 2) {
+                       server_stream_start.tv_sec = sec;
+                       server_stream_start.tv_usec = usec;
+               }
                break;
        case SI_CURRENT_TIME:
-               if (sscanf(line + ilen + 1, "%lu.%lu", &tv.tv_sec,
-                               &tv.tv_usec) == 2)
+               if (sscanf(line + ilen + 1, "%lu.%lu", &sec, &usec) == 2) {
+                       struct timeval tv = {sec, usec};
                        compute_time_diff(&tv);
+               }
                break;
        }
 }