diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-06-15 04:15:16 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-06-15 04:15:16 +0000 |
commit | 894561f482386b613c1abaab1cbbfd006c42e645 (patch) | |
tree | 3db9182c3c568a3a069f2b7098c8fcfe922b68c7 /pjsip-apps/src | |
parent | 4fce84818229778ad835bdb3fae18b170bcf6515 (diff) |
Handle negative number in my_atoi() in pjsua_app.c (thanks Scott M Ober)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1369 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps/src')
-rw-r--r-- | pjsip-apps/src/pjsua/pjsua_app.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c index 1b9584b8..98b6f2c4 100644 --- a/pjsip-apps/src/pjsua/pjsua_app.c +++ b/pjsip-apps/src/pjsua/pjsua_app.c @@ -309,7 +309,17 @@ static int read_config_file(pj_pool_t *pool, const char *filename, static int my_atoi(const char *cs) { pj_str_t s; - return pj_strtoul(pj_cstr(&s, cs)); + + pj_cstr(&s, cs); + if (cs[0] == '-') { + s.ptr++, s.slen--; + return 0 - (int)pj_strtoul(&s); + } else if (cs[0] == '+') { + s.ptr++, s.slen--; + return pj_strtoul(&s); + } else { + return pj_strtoul(&s); + } } |