summaryrefslogtreecommitdiff
path: root/pbx
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2006-02-23 17:13:57 +0000
committerKevin P. Fleming <kpfleming@digium.com>2006-02-23 17:13:57 +0000
commit302c9430013d40e82a3e9925e96921ba40650db1 (patch)
treea6044b368ffd4c159c9584c7fcf17347cb8cee67 /pbx
parentc3447c7cce376c33d3ef7bf07ab5e4776f221534 (diff)
add 'consumed' argument to ast_get_time_t, so callers can know how many characters were used in the parser
update pbx_dundi to use ast_get_time_t eliminate some compiler warnings git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10871 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx')
-rw-r--r--pbx/pbx_dundi.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index 9d842c69b..0a79b5cd9 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -1132,16 +1132,15 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke
int expiration;
char fs[256];
time_t timeout;
- unsigned int x;
+
/* Build request string */
if (!ast_db_get("dundi/cache", key, data, sizeof(data))) {
ptr = data;
- if (sscanf(ptr, "%d|%n", (int *)&x, &length) == 1) {
- timeout = x;
+ if (!ast_get_time_t(ptr, &timeout, 0, &length)) {
expiration = timeout - now;
if (expiration > 0) {
ast_log(LOG_DEBUG, "Found cache expiring in %d seconds!\n", (int)(timeout - now));
- ptr += length;
+ ptr += length + 1;
while((sscanf(ptr, "%d/%d/%d/%n", &(flags.flags), &weight, &tech, &length) == 3)) {
ptr += length;
term = strchr(ptr, '|');
@@ -2030,11 +2029,9 @@ static void load_password(void)
char *last=NULL;
char tmp[256];
time_t expired;
- unsigned int x;
ast_db_get(secretpath, "secretexpiry", tmp, sizeof(tmp));
- if (sscanf(tmp, "%d", (int *)&x) == 1) {
- expired = x;
+ if (!ast_get_time_t(tmp, &expired, 0, NULL)) {
ast_db_get(secretpath, "secret", tmp, sizeof(tmp));
current = strchr(tmp, ';');
if (!current)