Browse Source

Fixed endp bug in strtoul()

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
bbfb2e02fd
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      src/core/misc.c

+ 2
- 1
src/core/misc.c View File

@@ -164,7 +164,7 @@ unsigned long strtoul ( const char *p, char **endp, int base ) {
164 164
 	}
165 165
 
166 166
 	while ( 1 ) {
167
-		charval = *(p++) - '0';
167
+		charval = ( *p - '0' );
168 168
 		if ( charval > ( 'A' - '0' - 10 ) )
169 169
 			charval -= ( 'A' - '0' - 10 );
170 170
 		if ( charval > ( 'a' - 'A' ) )
@@ -172,6 +172,7 @@ unsigned long strtoul ( const char *p, char **endp, int base ) {
172 172
 		if ( charval >= ( unsigned int ) base )
173 173
 			break;
174 174
 		ret = ( ( ret * base ) + charval );
175
+		p++;
175 176
 	}
176 177
 
177 178
 	if ( endp )

Loading…
Cancel
Save