cvs: /php4 TODO /php4/ext/ldap ldap.c /php4/ext/standard php_string.h string.c /php4/ext/xml xml.c

From: Date: Thu, 09 Dec 1999 23:46:01 +0000
Subject: cvs: /php4 TODO /php4/ext/ldap ldap.c /php4/ext/standard php_string.h string.c /php4/ext/xml xml.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-7745@lists.php.net to get a copy of this message
andrei Thu Dec 9 18:46:01 1999 EDT Modified files: /php4 TODO /php4/ext/ldap ldap.c /php4/ext/standard php_string.h string.c /php4/ext/xml xml.c Log: (PHP strtoupper, strtolower, substr_replace) Made binary-safe. @Made strtoupper(), strtolower(), substr_replace() binary-safe. (Andrei) Index: php4/TODO diff -u php4/TODO:1.13 php4/TODO:1.14 --- php4/TODO:1.13 Thu Dec 9 09:44:54 1999 +++ php4/TODO Thu Dec 9 18:45:28 1999 @@ -29,15 +29,12 @@ strcspn() implode() strtok() - strtoupper() - strtolower() basename() dirname() stristr() strstr() strrpos() strrchr() - substr_replace() quotemeta() ucwords() strip_tags() Index: php4/ext/ldap/ldap.c diff -u php4/ext/ldap/ldap.c:1.16 php4/ext/ldap/ldap.c:1.17 --- php4/ext/ldap/ldap.c:1.16 Sat Dec 4 14:15:53 1999 +++ php4/ext/ldap/ldap.c Thu Dec 9 18:45:29 1999 @@ -20,7 +20,7 @@ */ -/* $Id: ldap.c,v 1.16 1999/12/04 19:15:53 sas Exp $ */ +/* $Id: ldap.c,v 1.17 1999/12/09 23:45:29 andrei Exp $ */ #define IS_EXT_MODULE #include "php.h" @@ -277,7 +277,7 @@ php_printf("<table>" "<tr><td>Total links:</td><td>%d/%s</td></tr>\n" - "<tr><td>RCS Version:</td><td>$Id: ldap.c,v 1.16 1999/12/04 19:15:53 sas Exp $</td></tr>\n" + "<tr><td>RCS Version:</td><td>$Id: ldap.c,v 1.17 1999/12/09 23:45:29 andrei Exp $</td></tr>\n" #if HAVE_NSLDAP "<tr><td>SDK Version:</td><td>%f</td></tr>" "<tr><td>Highest LDAP Protocol Supported:</td><td>%f</td></tr>" @@ -774,6 +774,7 @@ int attr_count, entry_count; BerElement *ber; char *attribute; + size_t attr_len; char **ldap_value; char *dn; @@ -826,7 +827,8 @@ } ldap_value_free(ldap_value); - zend_hash_update(tmp1->value.ht, php_strtolower(attribute), strlen(attribute)+1, (void *) &tmp2, sizeof(pval *), NULL); + attr_len = strlen(attribute); + zend_hash_update(tmp1->value.ht, php_strtolower(attribute, attr_len), attr_len+1, (void *) &tmp2, sizeof(pval *), NULL); add_index_string(tmp1, attr_count, attribute, 1); attr_count++; Index: php4/ext/standard/php_string.h diff -u php4/ext/standard/php_string.h:1.1 php4/ext/standard/php_string.h:1.2 --- php4/ext/standard/php_string.h:1.1 Sat Dec 4 14:16:04 1999 +++ php4/ext/standard/php_string.h Thu Dec 9 18:45:30 1999 @@ -29,7 +29,7 @@ */ -/* $Id: php_string.h,v 1.1 1999/12/04 19:16:04 sas Exp $ */ +/* $Id: php_string.h,v 1.2 1999/12/09 23:45:30 andrei Exp $ */ /* Synced with php3 revision 1.43 1999-06-16 [ssb] */ @@ -84,8 +84,8 @@ PHP_FUNCTION(str_repeat); PHP_FUNCTION(substr_replace); -extern PHPAPI char *php_strtoupper(char *s); -extern PHPAPI char *php_strtolower(char *s); +extern PHPAPI char *php_strtoupper(char *s, size_t len); +extern PHPAPI char *php_strtolower(char *s, size_t len); extern PHPAPI char *php_strtr(char *string, int len, char *str_from, char *str_to, int trlen); extern PHPAPI char *php_addslashes(char *string, int length, int *new_length, int freeit); extern PHPAPI char *php_addcslashes(char *string, int length, int *new_length, int freeit, char *what, int wlength); Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.67 php4/ext/standard/string.c:1.68 --- php4/ext/standard/string.c:1.67 Tue Dec 7 03:14:00 1999 +++ php4/ext/standard/string.c Thu Dec 9 18:45:30 1999 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.67 1999/12/07 08:14:00 thies Exp $ */ +/* $Id: string.c,v 1.68 1999/12/09 23:45:30 andrei Exp $ */ /* Synced with php3 revision 1.193 1999-06-16 [ssb] */ @@ -389,13 +389,14 @@ } /* }}} */ -PHPAPI char *php_strtoupper(char *s) +PHPAPI char *php_strtoupper(char *s, size_t len) { char *c; int ch; + int i; c = s; - while (*c) { + for (i=0; i<len; i++) { ch = toupper((unsigned char)*c); *c++ = ch; } @@ -415,18 +416,18 @@ *return_value = **arg; zval_copy_ctor(return_value); - php_strtoupper(return_value->value.str.val); + php_strtoupper(return_value->value.str.val, return_value->value.str.len); } /* }}} */ -PHPAPI char *php_strtolower(char *s) +PHPAPI char *php_strtolower(char *s, size_t len) { register int ch; char *c; c = s; - while (*c) { + for (i=0; i<len; i++) { ch = tolower((unsigned char)*c); *c++ = ch; } @@ -447,7 +448,7 @@ *return_value = **str; zval_copy_ctor(return_value); - ret = php_strtolower(return_value->value.str.val); + ret = php_strtolower(return_value->value.str.val, return_value->value.str.len); } /* }}} */ @@ -933,11 +934,12 @@ result_len = (*string)->value.str.len - l + (*repl)->value.str.len; result = (char *)ecalloc(result_len + 1, sizeof(char *)); - strncat(result, (*string)->value.str.val, f); - strcat(result, (*repl)->value.str.val); - strcat(result, (*string)->value.str.val + f + l); + memcpy(result, (*string)->value.str.val, f); + memcpy(&result[f], (*repl)->value.str.val, (*repl)->value.str.len); + memcpy(&result[f + (*repl)->value.str.len], (*string)->value.str.val + f + l, + (*string)->value.str.len - f - l); - RETVAL_STRING(result, 0); + RETVAL_STRINGL(result, result_len, 0); } /* }}} */ Index: php4/ext/xml/xml.c diff -u php4/ext/xml/xml.c:1.33 php4/ext/xml/xml.c:1.34 --- php4/ext/xml/xml.c:1.33 Sun Dec 5 11:59:15 1999 +++ php4/ext/xml/xml.c Thu Dec 9 18:45:30 1999 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xml.c,v 1.33 1999/12/05 16:59:15 eschmid Exp $ */ +/* $Id: xml.c,v 1.34 1999/12/09 23:45:30 andrei Exp $ */ #define IS_EXT_MODULE #include "php.h" @@ -628,7 +628,7 @@ parser->level++; if (parser->case_folding) { - name = php_strtoupper(estrdup(name)); + name = php_strtoupper(estrdup(name), strlen(name)); } if (parser->startElementHandler) {

« previous php.version4 (#7745) next »