diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-02-23 17:13:57 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-02-23 17:13:57 +0000 |
commit | 9c4950dff36fc6083132969ac592045c5cda464e (patch) | |
tree | a6044b368ffd4c159c9584c7fcf17347cb8cee67 /pbx/pbx_dundi.c | |
parent | efb2e34d2948dbc76d3be4a3a8805f7baba44bcc (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: http://svn.digium.com/svn/asterisk/trunk@10871 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx/pbx_dundi.c')
-rw-r--r-- | pbx/pbx_dundi.c | 11 |
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) |