kern

diff src/klibc/string.c @ 9:af6f4adc43d6

fixed a bug in strrchr and some warnings
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 16 Feb 2011 08:01:19 +0200
parents 633e35c64772
children ebca81749ef5
line diff
     1.1 --- a/src/klibc/string.c	Wed Feb 16 07:50:25 2011 +0200
     1.2 +++ b/src/klibc/string.c	Wed Feb 16 08:01:19 2011 +0200
     1.3 @@ -66,7 +66,7 @@
     1.4  {
     1.5  	while(*s) {
     1.6  		if(*s == c) {
     1.7 -			return s;
     1.8 +			return (char*)s;
     1.9  		}
    1.10  		s++;
    1.11  	}
    1.12 @@ -75,15 +75,15 @@
    1.13  
    1.14  char *strrchr(const char *s, int c)
    1.15  {
    1.16 -	char *ptr = s;
    1.17 +	const char *ptr = s;
    1.18  
    1.19  	/* find the end */
    1.20  	while(*ptr) ptr++;
    1.21  
    1.22  	/* go back checking for c */
    1.23 -	while(*--ptr >= s) {
    1.24 +	while(--ptr >= s) {
    1.25  		if(*ptr == c) {
    1.26 -			return ptr;
    1.27 +			return (char*)ptr;
    1.28  		}
    1.29  	}
    1.30  	return 0;