diff --git a/Makefile b/Makefile index b9819b43623665c79d12b0f313a1e168e33d40c9..27529e0ddbaac9ba0a3f6615df381138b20b75e2 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 eeb20b461e92f3218127ac4c7f5c8fd2478ed954..d9b85bfaa3dd57b82db7dcf676f3961c87257075 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 6613a49f75c186628a45cf2a3f12e9b03fe5bae1..8ebcfc54be415fe6eee09d81045bebb8c3ba391a 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 d1229e7d9651dd7e8b972db000ce4495f0bf1c6f..bf11e57905a452f75e2499083a020554d32494ad 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 3f283a1d63be8003e39b5bbdfbfd0ade07913890..8c0cf99296034e3df394823c9040c2547c64a0b6 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 51eb61e47dfd8910db2d742db69a8b6791bf610a..806118a59440e6bed04c9a06ae65c3279ccd60b7 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 5bf4d5b181d8886dacb0c1cdc91bdbdd5f3b3da3..fa8e2155ba11916d916f0bcc0cf1fd8789fc8aa1 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 1c4421c00b60bd3c3bc253da6e10293537546ea6..b702991267177e857fc8919191c8cbe4502a4a53 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 339096a4a9114d43b2eef9807a2b86e36ef26fd9..65b6a575a4dce5438b2b114c4097b44916fe7417 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 cbbe589db3ee608900c0c04155bfbdc0b4b9b63c..ff881c78700e4478878092b16e245cc3e5c436b3 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) {