diff options
author | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-15 10:56:29 +0000 |
---|---|---|
committer | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-15 10:56:29 +0000 |
commit | b19d55996cb433d6c33aaff4d0789fb3de77b0b6 (patch) | |
tree | fd6541cd8a4854ac1626ebbcb1eb20202e358260 /funcs | |
parent | 83a1c36bfe82c28e119e0a8c11079154cb1da5ea (diff) |
Use casts or intermediate variables to remove a number
of platform/compiler-dependent warnings when handing
struct timeval fields, both reading and printing them.
It is a lost battle to handle the different ways struct timeval
is handled on the various platforms and compilers, so try
to be pragmatic and go through int/long which are universally
supported.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@116557 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r-- | funcs/func_timeout.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/funcs/func_timeout.c b/funcs/func_timeout.c index 2f282b336..77d7c297e 100644 --- a/funcs/func_timeout.c +++ b/funcs/func_timeout.c @@ -84,6 +84,7 @@ static int timeout_write(struct ast_channel *chan, const char *cmd, char *data, const char *value) { double x; + long sec; char timestr[64]; struct ast_tm myt; struct timeval tv; @@ -99,10 +100,12 @@ static int timeout_write(struct ast_channel *chan, const char *cmd, char *data, if (!value) return -1; - if ((sscanf(value, "%ld%lf", (long *)&tv.tv_sec, &x) == 0) || tv.tv_sec < 0) + if ((sscanf(value, "%ld%lf", &sec, &x) == 0) || sec < 0) tv.tv_sec = 0; - else + else { + tv.tv_sec = sec; tv.tv_usec = x * 1000000; + } switch (*data) { case 'a': |