Oops !!! I've left old license header. Here is smaller clean version that apply
to CVS HEAD.
Index: crc32.c
===================================================================
RCS file: /repository/php-src/ext/standard/crc32.c,v
retrieving revision 1.16
diff -u -r1.16 crc32.c
--- crc32.c 3 Aug 2005 14:07:57 -0000 1.16
+++ crc32.c 5 Sep 2005 11:35:23 -0000
@@ -22,20 +22,19 @@
#include "basic_functions.h"
#include "crc32.h"
-/* {{{ proto string crc32(string str)
+/* {{{ proto int crc32(string str[,int prev_crc])
Calculate the crc32 polynomial of a string */
PHP_NAMED_FUNCTION(php_if_crc32)
{
- unsigned int crc = ~0;
+ unsigned int crc = 0;
char *p;
- int len, nr;
+ int len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &p, &nr) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &p, &len, &crc) == FAILURE) {
return;
}
-
- len = 0 ;
- for (len += nr; nr--; ++p) {
+ crc = ~crc;
+ for (; len--; ++p) {
CRC32(crc, *p);
}
RETVAL_LONG(~crc);
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php