mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@116557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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':
|
||||
|
Reference in New Issue
Block a user