cvs: php4 /dl/crypt sflcryp.c /dl/snmp winsnmp.c /ext/com COM.c /ext/cpdf cpdf.c /ext/dav dav.c /ext/domxml php_domxml.c /ext/hyperwave hw.c
php_hyperwave.h /ext/icap php_icap.c /ext/imap php_imap.c /ext/msql php_msql.c /ext/mysql/libmysql config-win32.h my_pthread.h /ext/standard
info.c levenshtein.c /ext/yaz php_yaz.c /ext/zlib zlib.c /sapi/isapi php4isapi.c /win32 sendmail.c sendmail.h syslog.h winutil.c

From: Date: Fri, 16 Jun 2000 18:23:58 +0000
Subject: cvs: php4 /dl/crypt sflcryp.c /dl/snmp winsnmp.c /ext/com COM.c /ext/cpdf cpdf.c /ext/dav dav.c /ext/domxml php_domxml.c /ext/hyperwave hw.c
php_hyperwave.h /ext/icap php_icap.c /ext/imap php_imap.c /ext/msql php_msql.c /ext/mysql/libmysql config-win32.h my_pthread.h /ext/standard
info.c levenshtein.c /ext/yaz php_yaz.c /ext/zlib zlib.c /sapi/isapi php4isapi.c /win32 sendmail.c sendmail.h syslog.h winutil.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-313@lists.php.net to get a copy of this message
hholzgra Fri Jun 16 11:23:58 2000 EDT Modified files: /php4/dl/crypt sflcryp.c /php4/dl/snmp winsnmp.c /php4/ext/com COM.c /php4/ext/cpdf cpdf.c /php4/ext/dav dav.c /php4/ext/domxml php_domxml.c /php4/ext/hyperwave hw.c php_hyperwave.h /php4/ext/icap php_icap.c /php4/ext/imap php_imap.c /php4/ext/msql php_msql.c /php4/ext/mysql/libmysql config-win32.h my_pthread.h /php4/ext/standard info.c levenshtein.c /php4/ext/yaz php_yaz.c /php4/ext/zlib zlib.c /php4/sapi/isapi php4isapi.c /php4/win32 sendmail.c sendmail.h syslog.h winutil.c Log: C++ // comments are evil ... Index: php4/dl/crypt/sflcryp.c diff -u php4/dl/crypt/sflcryp.c:1.1.1.1 php4/dl/crypt/sflcryp.c:1.2 --- php4/dl/crypt/sflcryp.c:1.1.1.1 Wed Apr 7 14:03:04 1999 +++ php4/dl/crypt/sflcryp.c Fri Jun 16 11:23:55 2000 @@ -287,7 +287,7 @@ mdc_decrypt ((qbyte *) buffer + index, aligned_block, aligned_intkey); -// memcpy ((qbyte *) buffer + index, block, 32); +/* memcpy ((qbyte *) buffer + index, block, 32); */ } } else Index: php4/dl/snmp/winsnmp.c diff -u php4/dl/snmp/winsnmp.c:1.5 php4/dl/snmp/winsnmp.c:1.6 --- php4/dl/snmp/winsnmp.c:1.5 Tue Feb 8 14:21:42 2000 +++ php4/dl/snmp/winsnmp.c Fri Jun 16 11:23:56 2000 @@ -201,7 +201,7 @@ /* Free the variable bindings that have been allocated.*/ SnmpUtilVarBindListFree(&variableBindings); SnmpUtilOidFree(&root); - } // end if (operation) + } /* end if (operation) */ /* Close SNMP session with the remote agent.*/ Index: php4/ext/com/COM.c diff -u php4/ext/com/COM.c:1.36 php4/ext/com/COM.c:1.37 --- php4/ext/com/COM.c:1.36 Fri Jun 9 01:40:26 2000 +++ php4/ext/com/COM.c Fri Jun 16 11:23:56 2000 @@ -135,7 +135,7 @@ char *clsid_str; StringFromCLSID(clsid, &ole_clsid); - //s_clsid = OLE2A(ole_clsid); + /*s_clsid = OLE2A(ole_clsid);*/ clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, 0); LocalFree(ole_clsid); @@ -270,7 +270,7 @@ hr=CLSIDFromProgID(ProgID, &clsid); efree(ProgID); - // obtain CLSID + /* obtain CLSID */ if (FAILED(hr)) { error_message = php_COM_error_message(hr); php_error(E_WARNING,"Invalid ProgID: %s\n", error_message); @@ -278,7 +278,7 @@ RETURN_FALSE; } - // obtain IDispatch + /* obtain IDispatch */ if (!server_name) { hr=CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (void **) &i_dispatch); } else { @@ -447,15 +447,15 @@ case IS_LONG: case IS_BOOL: if (pval_arg->is_ref == 0) { - var_arg->vt = VT_I4; // assuming 32-bit platform + var_arg->vt = VT_I4; /* assuming 32-bit platform */ var_arg->lVal = pval_arg->value.lval; } else { - var_arg->vt = VT_I4 | VT_BYREF; // assuming 32-bit platform + var_arg->vt = VT_I4 | VT_BYREF; /* assuming 32-bit platform */ var_arg->plVal = &(pval_arg->value.lval); } break; case IS_DOUBLE: - var_arg->vt = VT_R8; // assuming 64-bit double precision + var_arg->vt = VT_R8; /* assuming 64-bit double precision */ var_arg->dblVal = pval_arg->value.dval; break; case IS_STRING: @@ -523,7 +523,7 @@ return FAILURE; } -// variant_args = dispparams.rgvarg; +/* variant_args = dispparams.rgvarg; */ for (current_arg=0; current_arg<arg_count; current_arg++) { current_variant = arg_count - current_arg - 1; @@ -1035,7 +1035,7 @@ c.flags = mode; zend_register_constant(&c ELS_CC); - //printf("%s -> %ld\n", ids, pVarDesc->lpvarValue->lVal); + /*printf("%s -> %ld\n", ids, pVarDesc->lpvarValue->lVal);*/ j++; } TypeInfo->lpVtbl->Release(TypeInfo); Index: php4/ext/cpdf/cpdf.c diff -u php4/ext/cpdf/cpdf.c:1.17 php4/ext/cpdf/cpdf.c:1.18 --- php4/ext/cpdf/cpdf.c:1.17 Thu Jun 15 16:45:03 2000 +++ php4/ext/cpdf/cpdf.c Fri Jun 16 11:23:56 2000 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cpdf.c,v 1.17 2000/06/15 23:45:03 andi Exp $ */ +/* $Id: cpdf.c,v 1.18 2000/06/16 18:23:56 hholzgra Exp $ */ /* cpdflib.h -- C language API definitions for ClibPDF library * Copyright (C) 1998 FastIO Systems, All Rights Reserved. */ @@ -360,7 +360,7 @@ RETURN_FALSE; } -// cpdf_setViewerPreferences(pdf, pagemode, 0, 0, 0, 0, 0, 0, pagemode); +/* cpdf_setViewerPreferences(pdf, pagemode, 0, 0, 0, 0, 0, 0, pagemode); */ RETURN_TRUE; } Index: php4/ext/dav/dav.c diff -u php4/ext/dav/dav.c:1.20 php4/ext/dav/dav.c:1.21 --- php4/ext/dav/dav.c:1.20 Mon Jun 5 12:47:40 2000 +++ php4/ext/dav/dav.c Fri Jun 16 11:23:56 2000 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dav.c,v 1.20 2000/06/05 19:47:40 andi Exp $ */ +/* $Id: dav.c,v 1.21 2000/06/16 18:23:56 hholzgra Exp $ */ #define IS_EXT_MODULE #ifdef COMPILE_DL_DAV @@ -34,6 +34,8 @@ #endif #if HAVE_MOD_DAV + +#error The DAV support in PHP needs to be completely rewritten. Everything has changed # include "mod_dav.h" #include "ext/standard/info.h" Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.3 php4/ext/domxml/php_domxml.c:1.4 --- php4/ext/domxml/php_domxml.c:1.3 Thu Jun 15 00:05:38 2000 +++ php4/ext/domxml/php_domxml.c Fri Jun 16 11:23:56 2000 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_domxml.c,v 1.3 2000/06/15 07:05:38 steinm Exp $ */ +/* $Id: php_domxml.c,v 1.4 2000/06/16 18:23:56 hholzgra Exp $ */ #include "php.h" @@ -24,7 +24,7 @@ #if HAVE_DOMXML #include "ext/standard/info.h" -//#define newcode +/*#define newcode*/ static int le_domxmldocp; static int le_domxmldtdp; @@ -108,7 +108,7 @@ }; void _free_node(xmlNode *tmp) { -//fprintf(stderr, "Freeing node: %s\n", tmp->name); +/*fprintf(stderr, "Freeing node: %s\n", tmp->name);*/ } PHP_MINIT_FUNCTION(domxml) @@ -129,7 +129,7 @@ */ le_domxmlnodep = register_list_destructors(_free_node, NULL); le_domxmlattrp = register_list_destructors(NULL, NULL); -// le_domxmlnsp = register_list_destructors(NULL, NULL); +/* le_domxmlnsp = register_list_destructors(NULL, NULL); */ INIT_CLASS_ENTRY(domxmldoc_class_entry, "DomDocument", php_domxmldoc_class_functions); INIT_CLASS_ENTRY(domxmldtd_class_entry, "Dtd", php_domxmldtd_class_functions); @@ -320,7 +320,7 @@ /* don't know why that line was commented out in the previous version, so i left it (cmv) */ php_info_print_table_start(); php_info_print_table_row(2, "DOM/XML Support", "enabled"); -// php_info_print_table_row(2, "libmxl Version", LIBXML_VERSION ); +/* php_info_print_table_row(2, "libmxl Version", LIBXML_VERSION ); */ php_info_print_table_end(); } @@ -376,7 +376,7 @@ object_init_ex(pattr, domxmlattr_class_entry_ptr); add_property_resource(pattr, "attribute", ret); add_property_stringl(pattr, "name", (char *) attr->name, strlen(attr->name), 1); -// add_property_stringl(pattr, "content", (char *) attr->val->content, strlen(attr->val->content), 1); +/* add_property_stringl(pattr, "content", (char *) attr->val->content, strlen(attr->val->content), 1); */ zend_hash_next_index_insert(return_value->value.ht, &pattr, sizeof(zval *), NULL); attr = attr->next; } @@ -918,7 +918,7 @@ zval *id, **tmp; int id_to_find; xmlDoc *docp; -// char *mem; +/* char *mem; */ xmlChar *mem; int size; int type; @@ -1181,11 +1181,11 @@ while(ns) { zval *pattr; MAKE_STD_ZVAL(pattr); -// ret = zend_list_insert(attr, le_domxmlattrp); +/* ret = zend_list_insert(attr, le_domxmlattrp); */ /* construct an object with some methods */ object_init_ex(pattr, domxmlns_class_entry_ptr); -// add_property_resource(pattr, "attribute", ret); +/* add_property_resource(pattr, "attribute", ret); */ if(ns->href) add_property_stringl(pattr, "href", (char *) ns->href, strlen(ns->href), 1); if(ns->prefix) @@ -1214,7 +1214,7 @@ } /* create an php array for the children */ -// MAKE_STD_ZVAL(*attributes); // Don't do this if *attributes are the return_value +/* MAKE_STD_ZVAL(*attributes); *//* Don't do this if *attributes are the return_value */ if (array_init(*attributes) == FAILURE) { return -1; } @@ -1262,7 +1262,7 @@ /* Each child is a node object */ MAKE_STD_ZVAL(child); -// ret = zend_list_insert(last, le_domxmlnodep); +/* ret = zend_list_insert(last, le_domxmlnodep); */ /* construct a node object for each child */ object_init_ex(child, domxmlnode_class_entry_ptr); @@ -1275,7 +1275,7 @@ add_property_long(child, "type", last->type); if(last->content) add_property_stringl(child, "content", (char *) last->content, strlen(last->content), 1); -// add_property_resource(child, "node", ret); +/* add_property_resource(child, "node", ret); */ /* Get the namespace of the current node and add it as a property */ /* if(!node_namespace(&namespace, last)) @@ -1283,7 +1283,7 @@ */ /* Get the attributes of the current node and add it as a property */ - MAKE_STD_ZVAL(attributes); // Because it was taken out of node_attributes() + MAKE_STD_ZVAL(attributes); /* Because it was taken out of node_attributes() */ if(0 <= node_attributes(&attributes, last)) zend_hash_update(child->value.obj.properties, "attributes", sizeof("attributes"), (void *) &attributes, sizeof(zval *), NULL); Index: php4/ext/hyperwave/hw.c diff -u php4/ext/hyperwave/hw.c:1.57 php4/ext/hyperwave/hw.c:1.58 --- php4/ext/hyperwave/hw.c:1.57 Thu Jun 15 16:45:04 2000 +++ php4/ext/hyperwave/hw.c Fri Jun 16 11:23:56 2000 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: hw.c,v 1.57 2000/06/15 23:45:04 andi Exp $ */ +/* $Id: hw.c,v 1.58 2000/06/16 18:23:56 hholzgra Exp $ */ #ifdef COMPILE_DL_HYPERWAVE #include "dl/phpdl.h" #endif @@ -42,7 +42,7 @@ #include "php_ini.h" #include "php_hyperwave.h" -//hw_module php_hw_module; +/*hw_module php_hw_module;*/ #define HW_ATTR_NONE 1 #define HW_ATTR_LANG 2 @@ -375,9 +375,11 @@ attrname = php_strtok_r(NULL, "\n", &strtok_buf); } if(NULL == sarr){ -// spec_arr->refcount--; -// zend_hash_destroy(spec_arr->value.ht); -// efree(spec_arr->value.ht); +/* + spec_arr->refcount--; + zend_hash_destroy(spec_arr->value.ht); + efree(spec_arr->value.ht); +*/ zval_dtor(spec_arr); efree(spec_arr); } @@ -546,7 +548,7 @@ *objrec = '\0'; for(i=0; i<count; i++) { keytype = zend_hash_get_current_key(lht, &key, &length); -// if(HASH_KEY_IS_STRING == keytype) { +/* if(HASH_KEY_IS_STRING == keytype) { */ zend_hash_get_current_data(lht, (void **) &keydataptr); keydata = *keydataptr; switch(keydata->type) { @@ -598,7 +600,7 @@ if(HASH_KEY_IS_STRING == keytype) efree(key); objrec = realloc(objrec, strlen(objrec)+strlen(str)+1); strcat(objrec, str); -// } +/* } */ zend_hash_move_forward(lht); } return objrec; Index: php4/ext/hyperwave/php_hyperwave.h diff -u php4/ext/hyperwave/php_hyperwave.h:1.5 php4/ext/hyperwave/php_hyperwave.h:1.6 --- php4/ext/hyperwave/php_hyperwave.h:1.5 Sat Jun 10 01:47:56 2000 +++ php4/ext/hyperwave/php_hyperwave.h Fri Jun 16 11:23:56 2000 @@ -23,7 +23,7 @@ */ -/* $Id: php_hyperwave.h,v 1.5 2000/06/10 08:47:56 andi Exp $ */ +/* $Id: php_hyperwave.h,v 1.6 2000/06/16 18:23:56 hholzgra Exp $ */ #ifndef _HW_H #define _HW_H @@ -74,7 +74,7 @@ extern PHP_HW_API php_hw_globals hw_globals; #endif -//extern hw_module php_hw_module; +/*extern hw_module php_hw_module;*/ typedef struct { int size; Index: php4/ext/icap/php_icap.c diff -u php4/ext/icap/php_icap.c:1.15 php4/ext/icap/php_icap.c:1.16 --- php4/ext/icap/php_icap.c:1.15 Fri Jun 9 01:10:15 2000 +++ php4/ext/icap/php_icap.c Fri Jun 16 11:23:57 2000 @@ -272,8 +272,10 @@ flags = options->value.lval; icap_le_struct->flags = cl_flags; } - // icap_stream = cal_connect(calendar->value.str.val); - // cal_login(icap_stream, calendar->value.str.val); + /* + icap_stream = cal_connect(calendar->value.str.val); + cal_login(icap_stream, calendar->value.str.val); + */ if (icap_stream == NULL) { php_error(E_WARNING,"Couldn't re-open stream\n"); RETURN_FALSE; Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.29 php4/ext/imap/php_imap.c:1.30 --- php4/ext/imap/php_imap.c:1.29 Wed Jun 14 20:02:36 2000 +++ php4/ext/imap/php_imap.c Fri Jun 16 11:23:57 2000 @@ -20,10 +20,11 @@ | Rasmus Lerdorf <rasmus@lerdorf.on.ca> | | Chuck Hagenbuch <chuck@horde.org> | | Andrew Skalski <askalski@chekinc.com> | + | Hartmut Holzgraefe <hartmut@six.de> | | PHP 4.0 updates: Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.c,v 1.29 2000/06/15 03:02:36 chagenbu Exp $ */ +/* $Id: php_imap.c,v 1.30 2000/06/16 18:23:57 hholzgra Exp $ */ #define IMAP41 @@ -1026,6 +1027,8 @@ } imap_le_struct->flags = flags; } + mail_close_it(imap_le_struct); + zend_list_delete(ind); RETURN_TRUE; } Index: php4/ext/msql/php_msql.c diff -u php4/ext/msql/php_msql.c:1.19 php4/ext/msql/php_msql.c:1.20 --- php4/ext/msql/php_msql.c:1.19 Thu Jun 8 18:41:15 2000 +++ php4/ext/msql/php_msql.c Fri Jun 16 11:23:57 2000 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_msql.c,v 1.19 2000/06/09 01:41:15 zeev Exp $ */ +/* $Id: php_msql.c,v 1.20 2000/06/16 18:23:57 hholzgra Exp $ */ #include "php.h" #include "php_msql.h" @@ -944,7 +944,9 @@ add_assoc_stringl(return_value, msql_field->name, data, data_len, should_copy); } } else { - //add_get_index_stringl(return_value, i, empty_string, 0, (void **) &pval_ptr, 1); + /* + add_get_index_stringl(return_value, i, empty_string, 0, (void **) &pval_ptr, 1); + */ } } } Index: php4/ext/mysql/libmysql/config-win32.h diff -u php4/ext/mysql/libmysql/config-win32.h:1.4 php4/ext/mysql/libmysql/config-win32.h:1.5 --- php4/ext/mysql/libmysql/config-win32.h:1.4 Wed Mar 1 18:55:01 2000 +++ php4/ext/mysql/libmysql/config-win32.h Fri Jun 16 11:23:57 2000 @@ -206,7 +206,7 @@ #define HAVE_ALLOCA #define HAVE_STRPBRK #define HAVE_STRSTR -//#define HAVE_COMPRESS +/*#define HAVE_COMPRESS*/ #ifdef _MSC_VER #define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */ Index: php4/ext/mysql/libmysql/my_pthread.h diff -u php4/ext/mysql/libmysql/my_pthread.h:1.1 php4/ext/mysql/libmysql/my_pthread.h:1.2 --- php4/ext/mysql/libmysql/my_pthread.h:1.1 Sat Feb 19 02:10:46 2000 +++ php4/ext/mysql/libmysql/my_pthread.h Fri Jun 16 11:23:57 2000 @@ -8,7 +8,7 @@ #include <errno.h> #ifndef ETIME -#define ETIME ETIMEDOUT // For FreeBSD +#define ETIME ETIMEDOUT /* For FreeBSD */ #endif #if defined(__WIN32__) @@ -102,8 +102,8 @@ #define pthread_condattr_init(A) #define pthread_condattr_destroy(A) -//Irena: compiler does not like this: -//#define my_pthread_getprio(pthread_t thread_id) pthread_dummy(0) +/*Irena: compiler does not like this:*/ +/*#define my_pthread_getprio(pthread_t thread_id) pthread_dummy(0)*/ #define my_pthread_getprio(thread_id) pthread_dummy(0) #elif defined(HAVE_UNIXWARE7_THREADS) Index: php4/ext/standard/info.c diff -u php4/ext/standard/info.c:1.99 php4/ext/standard/info.c:1.100 --- php4/ext/standard/info.c:1.99 Thu Jun 8 18:50:44 2000 +++ php4/ext/standard/info.c Fri Jun 16 11:23:57 2000 @@ -145,7 +145,7 @@ char *zend_version = get_zend_version(); #ifdef PHP_WIN32 - // Get build numbers for Windows NT or Win95 + /* Get build numbers for Windows NT or Win95 */ if (dwVersion < 0x80000000){ dwBuild = (DWORD)(HIWORD(dwVersion)); snprintf(php_windows_uname,255,"%s %d.%d build %d","Windows NT",dwWindowsMajorVersion,dwWindowsMinorVersion,dwBuild); @@ -554,7 +554,7 @@ } -/* {{{ proto void phpinfo(void) +/* {{{ proto void phpinfo([int what]) Output a page of useful information about PHP and the current request */ PHP_FUNCTION(phpinfo) { Index: php4/ext/standard/levenshtein.c diff -u php4/ext/standard/levenshtein.c:1.8 php4/ext/standard/levenshtein.c:1.9 --- php4/ext/standard/levenshtein.c:1.8 Mon Jun 5 12:47:44 2000 +++ php4/ext/standard/levenshtein.c Fri Jun 16 11:23:57 2000 @@ -15,7 +15,7 @@ | Author: Hartmut Holzgraefe <hartmut@six.de> | +----------------------------------------------------------------------+ */ -/* $Id: levenshtein.c,v 1.8 2000/06/05 19:47:44 andi Exp $ */ +/* $Id: levenshtein.c,v 1.9 2000/06/16 18:23:57 hholzgra Exp $ */ #include "php.h" #include <stdlib.h> @@ -23,7 +23,8 @@ #include <ctype.h> #include "php_string.h" -static int calc_levdist(const char *s1, const char *s2) /* faster, but obfuscated */ +/* faster, but obfuscated, all operations have a cost of 1 */ +static int fastest_levdist(const char *s1, const char *s2) { register char *p1,*p2; register int i,j,n; @@ -68,7 +69,7 @@ /* fill initial row */ - n=(*s1!=*s2); + n=1; for(i=0,p1=r;i<l1;i++,*p1++=n++,p1++) {/*empty*/} /* calc. rowwise */ @@ -84,7 +85,7 @@ for(i=1;i<l1;i++) { if(*p1<n) n=*p1+(*(s1+i)!=*(s2)); /* replace cheaper than delete? */ p1++; - if(*++p1<n) n=*p1+1; /* insert cheaper then insert ? */ + if(*++p1<n) n=*p1+1; /* insert cheaper then replace ? */ *p2++=n++; /* update field and cost for next col's delete */ p2++; } @@ -95,26 +96,157 @@ } +static int weighted_levdist( const char *s1 + , const char *s2 + , const int cost_ins + , const int cost_rep + , const int cost_del + ) +{ + register int *p1,*p2; + register int i,j,n,c; + int l1=0,l2=0; + int r[512]; + const char *tmp; + + /* skip equal start sequence, if any */ + while(*s1==*s2) { + if(!*s1) break; + s1++; s2++; + } + + /* if we already used up one string, then + the result is the length of the other */ + if(*s1=='\0') return strlen(s2); + if(*s2=='\0') return strlen(s1); + + /* length count */ + while(*s1++) l1++; + while(*s2++) l2++; + + /* cut of equal tail sequence, if any */ + while(*--s1 == *--s2) { + l1--; l2--; + } + + + /* reset pointers, adjust length */ + s1-=l1++; + s2-=l2++; + + + /* possible dist to great? */ + if(abs(l1-l2)>=255) return -1; + + /* swap if l2 longer than l1 */ + if(l1<l2) { + tmp=s1; s1=s2; s2=tmp; + l1 ^= l2; l2 ^= l1; l1 ^= l2; + } + + if((l1==1)&&(l2==1)) { + n= cost_del+cost_ins; + return n<cost_rep?n:cost_rep; + } + + /* fill initial row */ + n=cost_ins; + for(i=0,p1=r;i<l1;i++,*p1++=n,p1++) {n+=cost_ins;} + + /* calc. rowwise */ + for(j=1;j<l2;j++) { + /* init pointers and col#0 */ + p1 = r + !(j&1); + p2 = r + (j&1); + n=*p1+cost_del; + *p2++=n;p2++; + s2++; + + /* foreach column */ + for(i=1;i<l1;i++) { + c = *p1; if(*(s1+i)!=*(s2)) c+=cost_rep; + if(c<n) n=c; /* replace cheaper than delete? */ + p1++; + c= *++p1+cost_ins; + if(c<n) n=c; /* insert cheaper then replace ? */ + *p2++=n; /* update field and cost for next col's delete */ + n+=cost_del; /* update field and cost for next col's delete */ + p2++; + } + } + + /* return result */ + return n-=cost_del; +} + +int custom_levdist(char *str1,char *str2,char *callback_name) +{ + php_error(E_WARNING,"the general Levenshtein support is not there yet"); + /* not there yet */ + + return -1; +} + + /* {{{ proto int levenshtein(string str1, string str2) Calculate Levenshtein distance between two strings */ PHP_FUNCTION(levenshtein) { - zval **str1, **str2; - int l; + zval **str1, **str2, **cost_ins, **cost_rep, **cost_del,**callback_name; + int distance=-1; + + switch(ZEND_NUM_ARGS()) { + case 2: /* just two string: use maximum performance version */ + if (zend_get_parameters_ex(2, &str1, &str2) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_string_ex(str1); + convert_to_string_ex(str2); + + distance = fastest_levdist((*str1)->value.str.val, (*str2)->value.str.val); + break; - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &str1, &str2) == FAILURE) { + case 5: /* more general version: calc cost by ins/rep/del weights */ + if (zend_get_parameters_ex(5, &str1, &str2, &cost_ins, &cost_rep, &cost_del) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_string_ex(str1); + convert_to_string_ex(str2); + convert_to_long_ex(cost_ins); + convert_to_long_ex(cost_rep); + convert_to_long_ex(cost_del); + + distance = weighted_levdist((*str1)->value.str.val + , (*str2)->value.str.val + , (*cost_ins)->value.lval + , (*cost_rep)->value.lval + , (*cost_del)->value.lval + ); + + break; + + case 3: /* most general version: calc cost by user-supplied function */ + if (zend_get_parameters_ex(3, &str1, &str2, &callback_name) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_string_ex(str1); + convert_to_string_ex(str2); + convert_to_string_ex(callback_name); + + distance = custom_levdist((*str1)->value.str.val + , (*str2)->value.str.val + , (*callback_name)->value.str.lval + ); + break; + + default: WRONG_PARAM_COUNT; - } - convert_to_string_ex(str1); - convert_to_string_ex(str2); - - l = calc_levdist((*str1)->value.str.val, (*str2)->value.str.val); + } - if(l<0) { + if(distance<0) { php_error(E_WARNING,"levenshtein(): argument string(s) too long"); } - - RETURN_LONG(l); + + RETURN_LONG(distance); } /* }}} */ - Index: php4/ext/yaz/php_yaz.c diff -u php4/ext/yaz/php_yaz.c:1.3 php4/ext/yaz/php_yaz.c:1.4 --- php4/ext/yaz/php_yaz.c:1.3 Fri Jun 9 20:35:56 2000 +++ php4/ext/yaz/php_yaz.c Fri Jun 16 11:23:57 2000 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_yaz.c,v 1.3 2000/06/10 03:35:56 sas Exp $ */ +/* $Id: php_yaz.c,v 1.4 2000/06/16 18:23:57 hholzgra Exp $ */ #include "php.h" @@ -1296,7 +1296,7 @@ eno[level]++; continue; } - // eno[level]++; + /* eno[level]++; */ *tag = '\0'; for (i = 0; i<=level; i++) Index: php4/ext/zlib/zlib.c diff -u php4/ext/zlib/zlib.c:1.45 php4/ext/zlib/zlib.c:1.46 --- php4/ext/zlib/zlib.c:1.45 Mon Jun 5 12:47:46 2000 +++ php4/ext/zlib/zlib.c Fri Jun 16 11:23:57 2000 @@ -16,7 +16,7 @@ | Stefan Röhrich <sr@linux.de> | +----------------------------------------------------------------------+ */ -/* $Id: zlib.c,v 1.45 2000/06/05 19:47:46 andi Exp $ */ +/* $Id: zlib.c,v 1.46 2000/06/16 18:23:57 hholzgra Exp $ */ #define IS_EXT_MODULE #include "php.h" @@ -822,12 +822,14 @@ WRONG_PARAM_COUNT; } convert_to_string_ex(data); - - // zlib::uncompress() wants to know the output data length - // if none was given as a parameter - // we try from input length * 2 up to input length * 2^8 - // doubling it whenever it wasn't big enough - // that should be eneugh for all real life cases + + /* + zlib::uncompress() wants to know the output data length + if none was given as a parameter + we try from input length * 2 up to input length * 2^8 + doubling it whenever it wasn't big enough + that should be eneugh for all real life cases + */ do { length=plength?plength:(*data)->value.str.len*(1<<factor++); s2 = (char *) erealloc(s1,length); Index: php4/sapi/isapi/php4isapi.c diff -u php4/sapi/isapi/php4isapi.c:1.45 php4/sapi/isapi/php4isapi.c:1.46 --- php4/sapi/isapi/php4isapi.c:1.45 Mon Jun 5 16:21:58 2000 +++ php4/sapi/isapi/php4isapi.c Fri Jun 16 11:23:57 2000 @@ -518,8 +518,10 @@ } #ifdef PHP_WIN32 -// ___except can only call a function, so we have to do this -// to retrieve the pointer. +/* + ___except can only call a function, so we have to do this + to retrieve the pointer. + */ BOOL exceptionhandler(LPEXCEPTION_POINTERS *e,LPEXCEPTION_POINTERS ep) { *e=ep; Index: php4/win32/sendmail.c diff -u php4/win32/sendmail.c:1.6 php4/win32/sendmail.c:1.7 --- php4/win32/sendmail.c:1.6 Sat Jun 19 06:18:48 1999 +++ php4/win32/sendmail.c Fri Jun 16 11:23:57 2000 @@ -48,13 +48,13 @@ #ifndef THREAD_SAFE char Buffer[MAIL_BUFFER_SIZE]; -// socket related data +/* socket related data */ SOCKET sc; WSADATA Data; struct hostent *adr; SOCKADDR_IN sock_in; int WinsockStarted; -// values set by the constructor +/* values set by the constructor */ char *AppName; char MailHost[HOST_NAME_LEN]; char LocalHost[HOST_NAME_LEN]; @@ -64,7 +64,7 @@ char *get_header(char *h, char *headers); -// Error messages +/* Error messages */ static char *ErrorMessages[] = { {"Success"}, @@ -91,7 +91,7 @@ -//******************************************************************** +/********************************************************************* // Name: TSendMail // Input: 1) host: Name of the mail host where the SMTP server resides // max accepted length of name = 256 @@ -103,7 +103,7 @@ // SUCCESS otherwise. // // See SendText() for additional args! -//******************************************************************** +//********************************************************************/ int TSendMail(char *host, int *error, char *headers, char *Subject, char *mailTo, char *data) { @@ -128,7 +128,7 @@ return 19; } - // attempt to connect with mail host + /* attempt to connect with mail host */ *error = MailConnect(); if (*error != 0) { if(RPath)efree(RPath); @@ -144,32 +144,33 @@ } } -//******************************************************************** +/'******************************************************************** // Name: TSendMail::~TSendMail // Input: // Output: // Description: DESTRUCTOR // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//********************************************************************/ void TSMClose() { Post("QUIT\n"); Ack(); - // to guarantee that the cleanup is not made twice and - // compomise the rest of the application if sockets are used - // elesewhere + /* to guarantee that the cleanup is not made twice and + compomise the rest of the application if sockets are used + elesewhere + */ } -//******************************************************************** +/********************************************************************* // Name: char *GetSMErrorText // Input: Error index returned by the menber functions // Output: pointer to a string containing the error description // Description: // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//*******************************************************************/ char *GetSMErrorText(int index) { @@ -180,7 +181,7 @@ } -//******************************************************************** +/********************************************************************* // Name: TSendText // Input: 1) RPath: return path of the message // Is used to fill the "Return-Path" and the @@ -193,14 +194,14 @@ // Description: // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//*******************************************************************/ int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers) { int res, i; char *p; - // check for NULL parameters + /* check for NULL parameters */ if (data == NULL) return (BAD_MSG_CONTENTS); if (mailTo == NULL) @@ -208,15 +209,15 @@ if (RPath == NULL) return (BAD_MSG_RPATH); - // simple checks for the mailto address - // have ampersand ? + /* simple checks for the mailto address */ + /* have ampersand ? */ if (strchr(mailTo, '@') == NULL) return (BAD_MSG_DESTINATION); sprintf(Buffer, "HELO %s\n", LocalHost); - // in the beggining of the dialog - // attempt reconnect if the first Post fail + /* in the beggining of the dialog */ + /* attempt reconnect if the first Post fail */ if ((res = Post(Buffer)) != SUCCESS) { MailConnect(); if ((res = Post(Buffer)) != SUCCESS) @@ -244,7 +245,7 @@ return (res); - // send message header + /* send message header */ if (Subject == NULL) res = PostHeader(RPath, "No Subject", mailTo, headers); else @@ -253,7 +254,7 @@ return (res); - // send message contents in 1024 chunks + /* send message contents in 1024 chunks */ if (strlen(data) <= 1024) { if ((res = Post(data)) != SUCCESS) return (res); @@ -267,18 +268,18 @@ else i = strlen(p); - // put next chunk in buffer + /* put next chunk in buffer */ strncpy(Buffer, p, i); Buffer[i] = '\0'; p += i; - // send chunk + /* send chunk */ if ((res = Post(Buffer)) != SUCCESS) return (res); } } - //send termination dot + /*send termination dot */ if ((res = Post("\r\n.\r\n")) != SUCCESS) return (res); if ((res = Ack()) != SUCCESS) @@ -289,7 +290,7 @@ -//******************************************************************** +/********************************************************************* // Name: PostHeader // Input: 1) return path // 2) Subject @@ -299,12 +300,12 @@ // Description: // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//********************************************************************/ int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders) { - // Print message header according to RFC 822 - // Return-path, Received, Date, From, Subject, Sender, To, cc + /* Print message header according to RFC 822 */ + /* Return-path, Received, Date, From, Subject, Sender, To, cc */ time_t tNow = time(NULL); struct tm *tm = localtime(&tNow); @@ -350,34 +351,36 @@ -//******************************************************************** +/********************************************************************* // Name: MailConnect // Input: None // Output: None // Description: Connect to the mail host and receive the welcome message. // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//********************************************************************/ int MailConnect() { int res; - // Create Socket + /* Create Socket */ if ((sc = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) return (FAILED_TO_OBTAIN_SOCKET_HANDLE); - // Get our own host name + /* Get our own host name */ if (gethostname(LocalHost, HOST_NAME_LEN)) return (FAILED_TO_GET_HOSTNAME); - // Resolve the servers IP - //if (!isdigit(MailHost[0])||!gethostbyname(MailHost)) - //{ - // return (FAILED_TO_RESOLVE_HOST); - //} + /* Resolve the servers IP */ + /* + if (!isdigit(MailHost[0])||!gethostbyname(MailHost)) + { + return (FAILED_TO_RESOLVE_HOST); + } + */ - // Connect to server + /* Connect to server */ sock_in.sin_family = AF_INET; sock_in.sin_port = htons(25); sock_in.sin_addr.S_un.S_addr = GetAddr(MailHost); @@ -385,7 +388,7 @@ if (connect(sc, (LPSOCKADDR) & sock_in, sizeof(sock_in))) return (FAILED_TO_CONNECT); - // receive Server welcome message + /* receive Server welcome message */ res = Ack(); return (res); } @@ -395,14 +398,14 @@ -//******************************************************************** +/********************************************************************* // Name: Post // Input: // Output: // Description: // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//********************************************************************/ int Post(LPCSTR msg) { int len = strlen(msg); @@ -420,7 +423,7 @@ -//******************************************************************** +/********************************************************************* // Name: Ack // Input: // Output: @@ -429,7 +432,7 @@ // last command was successful. // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//********************************************************************/ int Ack() { static char *buf; @@ -448,13 +451,13 @@ Received += rlen; buf[Received] = 0; - //err_msg fprintf(stderr,"Received: (%d bytes) %s", rlen, buf + Index); + /*err_msg fprintf(stderr,"Received: (%d bytes) %s", rlen, buf + Index); */ - // Check for newline + /* Check for newline */ Index += rlen; if ((buf[Received - 2] != '\r') || (buf[Received - 1] != '\n')) - // err_msg fprintf(stderr,"Incomplete server message. Awaiting CRLF\n"); - goto again; // Incomplete data. Line must be terminated by CRLF + /* err_msg fprintf(stderr,"Incomplete server message. Awaiting CRLF\n"); */ + goto again; /* Incomplete data. Line must be terminated by CRLF */ if (buf[0] > '3') return (SMTP_SERVER_ERROR); @@ -463,7 +466,7 @@ } -//******************************************************************** +/********************************************************************* // Name: unsigned long GetAddr (LPSTR szHost) // Input: // Output: @@ -474,7 +477,7 @@ // WARNING: gethostbyname() is a blocking function // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//********************************************************************/ unsigned long GetAddr(LPSTR szHost) { LPHOSTENT lpstHost; Index: php4/win32/sendmail.h diff -u php4/win32/sendmail.h:1.1.1.1 php4/win32/sendmail.h:1.2 --- php4/win32/sendmail.h:1.1.1.1 Wed Apr 7 14:05:12 1999 +++ php4/win32/sendmail.h Fri Jun 16 11:23:57 2000 @@ -1,4 +1,4 @@ -#if !defined(sendmail_h) // Sentry, use file only if it's not already included. +#if !defined(sendmail_h) /* Sentry, use file only if it's not already included. */ #define sendmail_h #include <windows.h> @@ -6,8 +6,8 @@ #define MAX_APPNAME_LENGHT 100 #define MAX_ERROR_INDEX 17 #define MIN_ERROR_INDEX 0 -#define MAIL_BUFFER_SIZE (1024*4) // 4k buffer -// Return values +#define MAIL_BUFFER_SIZE (1024*4) /* 4k buffer */ +/* Return values */ #define SUCCESS 0 #define FAILED_TO_PARSE_ARGUMENTS 1 #define FAILED_TO_OPEN_MAILFILE 2 @@ -43,4 +43,4 @@ -#endif // sendmail_h +#endif /* sendmail_h */ Index: php4/win32/syslog.h diff -u php4/win32/syslog.h:1.2 php4/win32/syslog.h:1.3 --- php4/win32/syslog.h:1.2 Sat Feb 19 05:11:02 2000 +++ php4/win32/syslog.h Fri Jun 16 11:23:57 2000 @@ -65,8 +65,8 @@ extern void closelog(void); extern void openlog(const char *, int, int); -// setlogmask not implemented -//extern int setlogmask (int); +/* setlogmask not implemented */ +/* extern int setlogmask (int); */ extern void syslog(int, const char *, ...); Index: php4/win32/winutil.c diff -u php4/win32/winutil.c:1.3 php4/win32/winutil.c:1.4 --- php4/win32/winutil.c:1.3 Fri Dec 17 14:34:04 1999 +++ php4/win32/winutil.c Fri Jun 16 11:23:57 2000 @@ -12,7 +12,7 @@ FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ (LPTSTR) Win_Error_msg, 256, NULL);

« previous php.cvs (#313) next »