aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-22 22:53:49 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-22 22:53:49 +0000
commit298fa6c9e1d883da32699692365b7fcf4326b534 (patch)
treec3e6c9f1df9f8d9321bbbd0d8108548d64f706dd
parentc1161711aac0ac5061eb317080ed05a7aa31b305 (diff)
merge rizzo's patch to make compiler warnings stop the build, and fix a bunch of warnings found
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@10805 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--Makefile4
-rw-r--r--apps/app_sms.c4
-rw-r--r--channels/Makefile2
-rw-r--r--channels/chan_sip.c2
-rw-r--r--codecs/gsm/Makefile2
-rw-r--r--funcs/func_enum.c2
-rw-r--r--include/asterisk/sha1.h3
-rw-r--r--res/res_features.c4
-rw-r--r--res/res_osp.c2
-rw-r--r--say.c149
10 files changed, 99 insertions, 75 deletions
diff --git a/Makefile b/Makefile
index b9819b436..27529e0dd 100644
--- a/Makefile
+++ b/Makefile
@@ -233,6 +233,10 @@ endif
INCLUDE+=-Iinclude -I../include
ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
ASTCFLAGS+=$(OPTIMIZE)
+ASTCFLAGS+= -Werror -Wunused
+ifeq ($(shell gcc -v 2>&1 | grep 'gcc version' | cut -f3 -d' ' | cut -f1 -d.),4)
+ASTCFLAGS+= -Wno-pointer-sign
+endif
ASTOBJ=-o asterisk
ifeq ($(findstring BSD,$(OSARCH)),BSD)
diff --git a/apps/app_sms.c b/apps/app_sms.c
index eeb20b461..d9b85bfaa 100644
--- a/apps/app_sms.c
+++ b/apps/app_sms.c
@@ -693,7 +693,7 @@ static void sms_readfile (sms_t * h, char *fn)
}
while (fgets (line, sizeof (line), s))
{ /* process line in file */
- char *p;
+ unsigned char *p;
for (p = line; *p && *p != '\n' && *p != '\r'; p++);
*p = 0; /* strip eoln */
p = line;
@@ -713,7 +713,7 @@ static void sms_readfile (sms_t * h, char *fn)
{ /* parse message (UTF-8) */
unsigned char o = 0;
while (*p && o < SMSLEN)
- h->ud[o++] = utf8decode((unsigned char **)&p);
+ h->ud[o++] = utf8decode(&p);
h->udl = o;
if (*p)
ast_log (LOG_WARNING, "UD too long in %s\n", fn);
diff --git a/channels/Makefile b/channels/Makefile
index 6613a49f7..8ebcfc54b 100644
--- a/channels/Makefile
+++ b/channels/Makefile
@@ -222,7 +222,7 @@ chan_nbs.so: chan_nbs.o
$(CC) $(SOLINK) -o $@ $< -lnbs
chan_vpb.o: chan_vpb.c
- $(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
+ $(CXX) -c $(CFLAGS:-Werror=) -o $@ chan_vpb.c
chan_vpb.so: chan_vpb.o
$(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index d1229e7d9..bf11e5790 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -12097,7 +12097,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int
int obproxyfound=0;
int found=0;
int format=0; /* Ama flags */
- time_t regseconds;
+ time_t regseconds = 0;
char *varname = NULL, *varval = NULL;
struct ast_variable *tmpvar = NULL;
struct ast_flags peerflags = {(0)};
diff --git a/codecs/gsm/Makefile b/codecs/gsm/Makefile
index 3f283a1d6..8c0cf9929 100644
--- a/codecs/gsm/Makefile
+++ b/codecs/gsm/Makefile
@@ -364,7 +364,7 @@ TOAST_INSTALL_TARGETS = \
# Default rules
.c.o:
- $(CC) $(CFLAGS) $?
+ $(CC) $(CFLAGS:-Werror=) $?
@-mv `$(BASENAME) $@` $@ > /dev/null 2>&1
# Target rules
diff --git a/funcs/func_enum.c b/funcs/func_enum.c
index 51eb61e47..806118a59 100644
--- a/funcs/func_enum.c
+++ b/funcs/func_enum.c
@@ -88,7 +88,7 @@ static int function_enum(struct ast_channel *chan, char *cmd, char *data,
args.options = "1";
/* strip any '-' signs from number */
- for (p = args.number, s = p; *s; *s++) {
+ for (s = p = args.number; *s; s++) {
if (*s != '-')
*p++ = *s;
}
diff --git a/include/asterisk/sha1.h b/include/asterisk/sha1.h
index 5bf4d5b18..fa8e2155b 100644
--- a/include/asterisk/sha1.h
+++ b/include/asterisk/sha1.h
@@ -32,7 +32,6 @@
* name meaning
* uint32_t unsigned 32 bit integer
* uint8_t unsigned 8 bit integer (i.e., unsigned char)
- * int_least16_t integer of >= 16 bits
*
*/
@@ -60,7 +59,7 @@ typedef struct SHA1Context
uint32_t Length_High; /* Message length in bits */
/* Index into message block array */
- int_least16_t Message_Block_Index;
+ uint32_t Message_Block_Index; /* 8 bits actually suffice */
uint8_t Message_Block[64]; /* 512-bit message blocks */
int Computed; /* Is the digest computed? */
diff --git a/res/res_features.c b/res/res_features.c
index 1c4421c00..b70299126 100644
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -483,7 +483,7 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
len = strlen(touch_monitor) + 50;
args = alloca(len);
touch_filename = alloca(len);
- snprintf(touch_filename, len, "auto-%ld-%s", time(NULL), touch_monitor);
+ snprintf(touch_filename, len, "auto-%ld-%s", (long)time(NULL), touch_monitor);
snprintf(args, len, "%s|%s|m", (touch_format) ? touch_format : "wav", touch_filename);
} else {
caller_chan_id = ast_strdupa(caller_chan->cid.cid_num ? caller_chan->cid.cid_num : caller_chan->name);
@@ -491,7 +491,7 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50;
args = alloca(len);
touch_filename = alloca(len);
- snprintf(touch_filename, len, "auto-%ld-%s-%s", time(NULL), caller_chan_id, callee_chan_id);
+ snprintf(touch_filename, len, "auto-%ld-%s-%s", (long)time(NULL), caller_chan_id, callee_chan_id);
snprintf(args, len, "%s|%s|m", (touch_format) ? touch_format : "wav", touch_filename);
}
diff --git a/res/res_osp.c b/res/res_osp.c
index 339096a4a..65b6a575a 100644
--- a/res/res_osp.c
+++ b/res/res_osp.c
@@ -568,7 +568,7 @@ int ast_osp_lookup(struct ast_channel *chan, char *provider, char *extension, ch
char destination[2048]="";
char token[2000];
char tmp[256]="", *l, *n;
- char *devinfo = NULL;
+ const char *devinfo = NULL;
result->handle = -1;
result->numresults = 0;
diff --git a/say.c b/say.c
index cbbe589db..ff881c787 100644
--- a/say.c
+++ b/say.c
@@ -3114,13 +3114,14 @@ int ast_say_date_with_format_en(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -3150,13 +3151,14 @@ int ast_say_date_with_format_en(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -3336,13 +3338,14 @@ int ast_say_date_with_format_da(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -3362,13 +3365,14 @@ int ast_say_date_with_format_da(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -3534,13 +3538,14 @@ int ast_say_date_with_format_de(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -3560,10 +3565,11 @@ int ast_say_date_with_format_de(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
@@ -3742,14 +3748,15 @@ int ast_say_date_with_format_he(struct ast_channel *chan, time_t time,
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
char todo = format[offset]; /* The letter to format*/
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
if (todo == 'Q') {
@@ -3902,13 +3909,14 @@ int ast_say_date_with_format_es(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -3928,13 +3936,14 @@ int ast_say_date_with_format_es(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -4126,13 +4135,14 @@ int ast_say_date_with_format_fr(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -4152,13 +4162,14 @@ int ast_say_date_with_format_fr(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -4332,15 +4343,16 @@ int ast_say_date_with_format_it(struct ast_channel *chan, time_t time, const cha
* language to say the date, with changes in what you say, depending
* upon how recent the date is. XXX */
{
- struct timeval now;
+ struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
- gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ gettimeofday(&now,NULL);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -4357,13 +4369,14 @@ int ast_say_date_with_format_it(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -4562,13 +4575,14 @@ int ast_say_date_with_format_nl(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -4585,13 +4599,14 @@ int ast_say_date_with_format_nl(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -4777,13 +4792,14 @@ int ast_say_date_with_format_pt(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -4803,13 +4819,14 @@ int ast_say_date_with_format_pt(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -5053,13 +5070,14 @@ int ast_say_date_with_format_tw(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -5079,13 +5097,14 @@ int ast_say_date_with_format_tw(struct ast_channel *chan, time_t time, const cha
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -6092,13 +6111,14 @@ static int ast_say_date_with_format_gr(struct ast_channel *chan, time_t time, co
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -6118,13 +6138,14 @@ static int ast_say_date_with_format_gr(struct ast_channel *chan, time_t time, co
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {