cvs: php-src /ext/dbase dbf_rec.c /ext/simplexml simplexml.c /ext/sockets sockets.c /ext/sqlite sess_sqlite.c /ext/standard md5.c md5.h sha1.c

From: Date: Mon, 28 May 2007 23:14:58 +0000
Subject: cvs: php-src /ext/dbase dbf_rec.c /ext/simplexml simplexml.c /ext/sockets sockets.c /ext/sqlite sess_sqlite.c /ext/standard md5.c md5.h sha1.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-44529@lists.php.net to get a copy of this message
iliaa Mon May 28 23:14:58 2007 UTC Modified files: /php-src/ext/standard sha1.c md5.h md5.c /php-src/ext/sqlite sess_sqlite.c /php-src/ext/sockets sockets.c /php-src/ext/simplexml simplexml.c /php-src/ext/dbase dbf_rec.c Log: MFB http://cvs.php.net/viewvc.cgi/php-src/ext/standard/sha1.c?r1=1.20&r2=1.21&diff_format=u Index: php-src/ext/standard/sha1.c diff -u php-src/ext/standard/sha1.c:1.20 php-src/ext/standard/sha1.c:1.21 --- php-src/ext/standard/sha1.c:1.20 Mon Jan 1 09:29:32 2007 +++ php-src/ext/standard/sha1.c Mon May 28 23:14:57 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sha1.c,v 1.20 2007/01/01 09:29:32 sebastian Exp $ */ +/* $Id: sha1.c,v 1.21 2007/05/28 23:14:57 iliaa Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -24,17 +24,11 @@ /* This code is heavily based on the PHP md5 implementation */ #include "sha1.h" +#include "md5.h" PHPAPI void make_sha1_digest(char *sha1str, unsigned char *digest) { - int i; - - for (i = 0; i < 20; i++) { - sprintf(sha1str, "%02x", digest[i]); - sha1str += 2; - } - - *sha1str = '\0'; + make_digest_ex(sha1str, digest, 20); } /* {{{ proto string sha1(string str [, bool raw_output]) U @@ -68,7 +62,7 @@ if (raw_output) { RETVAL_STRINGL((char*)digest, 20, 1); } else { - make_sha1_digest(sha1str, digest); + make_digest_ex(sha1str, digest, 20); RETVAL_ASCII_STRING(sha1str, ZSTR_DUPLICATE); } @@ -130,7 +124,7 @@ if (raw_output) { RETURN_STRINGL((char*)digest, 20, 1); } else { - make_sha1_digest(sha1str, digest); + make_digest_ex(sha1str, digest, 20); RETVAL_ASCII_STRING(sha1str, ZSTR_DUPLICATE); } } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/md5.h?r1=1.19&r2=1.20&diff_format=u Index: php-src/ext/standard/md5.h diff -u php-src/ext/standard/md5.h:1.19 php-src/ext/standard/md5.h:1.20 --- php-src/ext/standard/md5.h:1.19 Mon Jan 1 09:29:32 2007 +++ php-src/ext/standard/md5.h Mon May 28 23:14:57 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: md5.h,v 1.19 2007/01/01 09:29:32 sebastian Exp $ */ +/* $Id: md5.h,v 1.20 2007/05/28 23:14:57 iliaa Exp $ */ #ifndef MD5_H #define MD5_H @@ -55,6 +55,7 @@ } PHP_MD5_CTX; PHPAPI void make_digest(char *md5str, unsigned char *digest); +PHPAPI void make_digest_ex(char *md5str, unsigned char *digest, int len); PHPAPI void PHP_MD5Init(PHP_MD5_CTX *); PHPAPI void PHP_MD5Update(PHP_MD5_CTX *, const unsigned char *, unsigned int); PHPAPI void PHP_MD5Final(unsigned char[16], PHP_MD5_CTX *); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/md5.c?r1=1.49&r2=1.50&diff_format=u Index: php-src/ext/standard/md5.c diff -u php-src/ext/standard/md5.c:1.49 php-src/ext/standard/md5.c:1.50 --- php-src/ext/standard/md5.c:1.49 Mon Jan 1 09:29:32 2007 +++ php-src/ext/standard/md5.c Mon May 28 23:14:57 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: md5.c,v 1.49 2007/01/01 09:29:32 sebastian Exp $ */ +/* $Id: md5.c,v 1.50 2007/05/28 23:14:57 iliaa Exp $ */ /* * md5.c - Copyright 1997 Lachlan Roche @@ -29,14 +29,19 @@ PHPAPI void make_digest(char *md5str, unsigned char *digest) { + make_digest_ex(md5str, digest, 16); +} + +PHPAPI void make_digest_ex(char *md5str, unsigned char *digest, int len) +{ + static const char hexits[17] = "0123456789abcdef"; int i; - for (i = 0; i < 16; i++) { - sprintf(md5str, "%02x", digest[i]); - md5str += 2; + for (i = 0; i < len; i++) { + md5str[i * 2] = hexits[digest[i] >> 4]; + md5str[(i * 2) + 1] = hexits[digest[i] & 0x0F]; } - - *md5str = '\0'; + md5str[len * 2] = '\0'; } /* {{{ proto string md5(string str, [ bool raw_output]) U @@ -70,7 +75,7 @@ if (raw_output) { RETVAL_STRINGL((char*)digest, 16, 1); } else { - make_digest(md5str, digest); + make_digest_ex(md5str, digest. 16); RETVAL_ASCII_STRING(md5str, ZSTR_DUPLICATE); } @@ -130,7 +135,7 @@ if (raw_output) { RETURN_STRINGL((char*)digest, 16, 1); } else { - make_digest(md5str, digest); + make_digest_ex(md5str, digest, 16); RETVAL_ASCII_STRING(md5str, ZSTR_DUPLICATE); } } http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite/sess_sqlite.c?r1=1.21&r2=1.22&diff_format=u Index: php-src/ext/sqlite/sess_sqlite.c diff -u php-src/ext/sqlite/sess_sqlite.c:1.21 php-src/ext/sqlite/sess_sqlite.c:1.22 --- php-src/ext/sqlite/sess_sqlite.c:1.21 Mon Jan 1 09:29:30 2007 +++ php-src/ext/sqlite/sess_sqlite.c Mon May 28 23:14:57 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sess_sqlite.c,v 1.21 2007/01/01 09:29:30 sebastian Exp $ */ +/* $Id: sess_sqlite.c,v 1.22 2007/05/28 23:14:57 iliaa Exp $ */ #include "php.h" @@ -109,9 +109,13 @@ case SQLITE_ROW: if (rowdata[0] != NULL) { *vallen = strlen(rowdata[0]); - *val = emalloc(*vallen); - *vallen = sqlite_decode_binary(rowdata[0], *val); - (*val)[*vallen] = '\0'; + if (*vallen) { + *val = emalloc(*vallen); + *vallen = sqlite_decode_binary(rowdata[0], *val); + (*val)[*vallen] = '\0'; + } else { + *val = STR_EMPTY_ALLOC(); + } } break; default: http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.189&r2=1.190&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.189 php-src/ext/sockets/sockets.c:1.190 --- php-src/ext/sockets/sockets.c:1.189 Sun Feb 25 22:58:57 2007 +++ php-src/ext/sockets/sockets.c Mon May 28 23:14:57 2007 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sockets.c,v 1.189 2007/02/25 22:58:57 tony2001 Exp $ */ +/* $Id: sockets.c,v 1.190 2007/05/28 23:14:57 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -156,7 +156,7 @@ sockets_functions, PHP_MINIT(sockets), NULL, - PHP_RINIT(sockets), + NULL, PHP_RSHUTDOWN(sockets), PHP_MINFO(sockets), NO_VERSION_YET, @@ -521,13 +521,6 @@ } /* }}} */ -/* {{{ PHP_RINIT_FUNCTION */ -PHP_RINIT_FUNCTION(sockets) -{ - return SUCCESS; -} -/* }}} */ - /* {{{ PHP_RSHUTDOWN_FUNCTION */ PHP_RSHUTDOWN_FUNCTION(sockets) { http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.231&r2=1.232&diff_format=u Index: php-src/ext/simplexml/simplexml.c diff -u php-src/ext/simplexml/simplexml.c:1.231 php-src/ext/simplexml/simplexml.c:1.232 --- php-src/ext/simplexml/simplexml.c:1.231 Mon Mar 26 20:16:15 2007 +++ php-src/ext/simplexml/simplexml.c Mon May 28 23:14:57 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: simplexml.c,v 1.231 2007/03/26 20:16:15 rrichards Exp $ */ +/* $Id: simplexml.c,v 1.232 2007/05/28 23:14:57 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1605,8 +1605,8 @@ return; } - if (qname_len == 0 || value_len == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute name and value are required"); + if (qname_len == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute name is required"); return; } @@ -2425,7 +2425,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "Simplexml support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.231 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.232 $"); php_info_print_table_row(2, "Schema support", #ifdef LIBXML_SCHEMAS_ENABLED "enabled"); http://cvs.php.net/viewvc.cgi/php-src/ext/dbase/dbf_rec.c?r1=1.11&r2=1.12&diff_format=u Index: php-src/ext/dbase/dbf_rec.c diff -u php-src/ext/dbase/dbf_rec.c:1.11 php-src/ext/dbase/dbf_rec.c:1.12 --- php-src/ext/dbase/dbf_rec.c:1.11 Sun Oct 8 13:34:21 2006 +++ php-src/ext/dbase/dbf_rec.c Mon May 28 23:14:57 2007 @@ -152,8 +152,7 @@ if ( !cp ) cp = (char *)malloc(flen + 1); if ( cp ) { - strncpy(cp, &rp[fldp->db_foffset], flen); - cp[flen] = 0; + strlcpy(cp, &rp[fldp->db_foffset], flen + 1); } return cp; }

« previous php.cvs (#44529) next »