Changeset 2169


Ignore:
Timestamp:
Jul 23, 2008 1:26:33 PM (16 years ago)
Author:
bennylp
Message:

pj_strtoul() should stop the conversion as soon as it finds a non-digit character in the input

Location:
pjproject/trunk/pjlib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/string.h

    r2039 r2169  
    536536 
    537537/** 
    538  * Convert string to unsigned integer. 
     538 * Convert string to unsigned integer. The conversion will stop as 
     539 * soon as non-digit character is found or all the characters have 
     540 * been processed. 
    539541 * 
    540542 * @param str   the string. 
  • pjproject/trunk/pjlib/src/pj/string.c

    r2039 r2169  
    118118    value = 0; 
    119119    for (i=0; i<(unsigned)str->slen; ++i) { 
     120        if (!pj_isdigit(str->ptr[i])) 
     121            break; 
    120122        value = value * 10 + (str->ptr[i] - '0'); 
    121123    } 
Note: See TracChangeset for help on using the changeset viewer.