- Timestamp:
- Jun 18, 2010 3:37:28 PM (14 years ago)
- Location:
- pjproject/branches/projects/cli/pjlib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/cli/pjlib/include/pj/string.h
r2394 r3210 537 537 538 538 /** 539 * Convert string to signed integer. The conversion will stop as 540 * soon as non-digit character is found or all the characters have 541 * been processed. 542 * 543 * @param str the string. 544 * 545 * @return the integer. 546 */ 547 PJ_DECL(long) pj_strtol(const pj_str_t *str); 548 549 /** 539 550 * Convert string to unsigned integer. The conversion will stop as 540 551 * soon as non-digit character is found or all the characters have -
pjproject/branches/projects/cli/pjlib/src/pj/string.c
r3207 r3210 70 70 PJ_DEF(pj_str_t*) pj_strltrim( pj_str_t *str ) 71 71 { 72 char *end = str->ptr + str->slen;73 72 register char *p = str->ptr; 74 while (p < end && pj_isspace(*p))73 while (pj_isspace(*p)) 75 74 ++p; 76 75 str->slen -= (p - str->ptr); … … 110 109 } 111 110 111 PJ_DEF(long) pj_strtol(const pj_str_t *str) 112 { 113 PJ_CHECK_STACK(); 114 115 if (str->slen > 0 && (str->ptr[0] == '+' || str->ptr[0] == '-')) { 116 pj_str_t s; 117 118 s.ptr = str->ptr + 1; 119 s.slen = str->slen - 1; 120 return (str->ptr[0] == '-'? -(long)pj_strtoul(&s) : pj_strtoul(&s)); 121 } else 122 return pj_strtoul(str); 123 } 112 124 113 125 PJ_DEF(unsigned long) pj_strtoul(const pj_str_t *str)
Note: See TracChangeset
for help on using the changeset viewer.