On Sat, 11 Jan 2003, Moriyoshi Koizumi wrote: > moriyoshi Sat Jan 11 17:32:19 2003 EDT > > Modified files: > /php4/ext/standard browscap.c datetime.c pack.c reg.c string.c > Log: > Reduced warnings in ZE2 build
Isn't there another way for this, as this makes the code quire ugly? Derick > Index: php4/ext/standard/browscap.c > diff -u php4/ext/standard/browscap.c:1.65 php4/ext/standard/browscap.c:1.66 > --- php4/ext/standard/browscap.c:1.65 Mon Jan 6 16:43:28 2003 > +++ php4/ext/standard/browscap.c Sat Jan 11 17:32:19 2003 > @@ -16,7 +16,7 @@ > +----------------------------------------------------------------------+ > */ > > -/* $Id: browscap.c,v 1.65 2003/01/06 21:43:28 iliaa Exp $ */ > +/* $Id: browscap.c,v 1.66 2003/01/11 22:32:19 moriyoshi Exp $ */ > > #include "php.h" > #include "php_regex.h" > @@ -49,20 +49,20 @@ > register int i, j; > char *t; > > - for (i=0; i<Z_STRLEN_P(pattern); i++) { > + for (i = 0; i < (int)Z_STRLEN_P(pattern); i++) { > if (Z_STRVAL_P(pattern)[i]=='*' || Z_STRVAL_P(pattern)[i]=='?' || >Z_STRVAL_P(pattern)[i]=='.') { > break; > } > } > > - if (i==Z_STRLEN_P(pattern)) { /* no wildcards */ > + if (i == (int)Z_STRLEN_P(pattern)) { /* no wildcards */ > Z_STRVAL_P(pattern) = zend_strndup(Z_STRVAL_P(pattern), >Z_STRLEN_P(pattern)); > return; > } > > t = (char *) malloc(Z_STRLEN_P(pattern)*2 + 1); > > - for (i=0, j=0; i<Z_STRLEN_P(pattern); i++, j++) { > + for (i = 0, j = 0; i < (int)Z_STRLEN_P(pattern); i++, j++) { > switch (Z_STRVAL_P(pattern)[i]) { > case '?': > t[j] = '.'; > Index: php4/ext/standard/datetime.c > diff -u php4/ext/standard/datetime.c:1.99 php4/ext/standard/datetime.c:1.100 > --- php4/ext/standard/datetime.c:1.99 Tue Dec 31 11:07:35 2002 > +++ php4/ext/standard/datetime.c Sat Jan 11 17:32:19 2003 > @@ -19,7 +19,7 @@ > */ > > > -/* $Id: datetime.c,v 1.99 2002/12/31 16:07:35 sebastian Exp $ */ > +/* $Id: datetime.c,v 1.100 2003/01/11 22:32:19 moriyoshi Exp $ */ > > > #include "php.h" > @@ -313,7 +313,7 @@ > php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected error"); > RETURN_FALSE; > } > - for (i = 0; i < Z_STRLEN_PP(format); i++) { > + for (i = 0; i < (int)Z_STRLEN_PP(format); i++) { > switch (Z_STRVAL_PP(format)[i]) { > case 'r': /* rfc822 format */ > size += 31; > @@ -366,7 +366,7 @@ > size += 2; > break; > case '\\': > - if(i < Z_STRLEN_PP(format)-1) { > + if(i < ((int)Z_STRLEN_PP(format)) - 1) { > i++; > } > size ++; > @@ -383,10 +383,10 @@ > Z_STRVAL_P(return_value) = (char *) emalloc(size + 1); > Z_STRVAL_P(return_value)[0] = '\0'; > > - for (i = 0; i < Z_STRLEN_PP(format); i++) { > + for (i = 0; i < (int)Z_STRLEN_PP(format); i++) { > switch (Z_STRVAL_PP(format)[i]) { > case '\\': > - if(i < Z_STRLEN_PP(format)-1) { > + if(i < (int)(Z_STRLEN_PP(format)) - 1) { > char ch[2]; > ch[0]=Z_STRVAL_PP(format)[i+1]; > ch[1]='\0'; > Index: php4/ext/standard/pack.c > diff -u php4/ext/standard/pack.c:1.43 php4/ext/standard/pack.c:1.44 > --- php4/ext/standard/pack.c:1.43 Tue Dec 31 11:07:49 2002 > +++ php4/ext/standard/pack.c Sat Jan 11 17:32:19 2003 > @@ -15,7 +15,7 @@ > | Author: Chris Schneider <[EMAIL PROTECTED]> | > +----------------------------------------------------------------------+ > */ > -/* $Id: pack.c,v 1.43 2002/12/31 16:07:49 sebastian Exp $ */ > +/* $Id: pack.c,v 1.44 2003/01/11 22:32:19 moriyoshi Exp $ */ > > #include "php.h" > > @@ -320,7 +320,7 @@ > val = argv[currentarg++]; > convert_to_string_ex(val); > memcpy(&output[outputpos], Z_STRVAL_PP(val), > - (Z_STRLEN_PP(val) < arg) ? Z_STRLEN_PP(val) >: arg); > + ((int)Z_STRLEN_PP(val) < arg) ? >Z_STRLEN_PP(val) : arg); > outputpos += arg; > break; > > @@ -334,7 +334,7 @@ > convert_to_string_ex(val); > v = Z_STRVAL_PP(val); > outputpos--; > - if(arg > Z_STRLEN_PP(val)) { > + if(arg > (int)Z_STRLEN_PP(val)) { > php_error_docref(NULL TSRMLS_CC, E_WARNING, >"Type %c: not enough characters in string", code); > arg = Z_STRLEN_PP(val); > } > Index: php4/ext/standard/reg.c > diff -u php4/ext/standard/reg.c:1.70 php4/ext/standard/reg.c:1.71 > --- php4/ext/standard/reg.c:1.70 Thu Jan 9 23:44:21 2003 > +++ php4/ext/standard/reg.c Sat Jan 11 17:32:19 2003 > @@ -17,7 +17,7 @@ > | Jaakko Hyvätti <[EMAIL PROTECTED]> | > +----------------------------------------------------------------------+ > */ > -/* $Id: reg.c,v 1.70 2003/01/10 04:44:21 moriyoshi Exp $ */ > +/* $Id: reg.c,v 1.71 2003/01/11 22:32:19 moriyoshi Exp $ */ > > #include <stdio.h> > #include <ctype.h> > @@ -605,7 +605,7 @@ > > tmp = emalloc((Z_STRLEN_PP(string) * 4) + 1); > > - for (i = j = 0; i < Z_STRLEN_PP(string); i++) { > + for (i = j = 0; i < (int)Z_STRLEN_PP(string); i++) { > c = (unsigned char) Z_STRVAL_PP(string)[i]; > if(isalpha(c)) { > tmp[j++] = '['; > Index: php4/ext/standard/string.c > diff -u php4/ext/standard/string.c:1.344 php4/ext/standard/string.c:1.345 > --- php4/ext/standard/string.c:1.344 Sat Jan 11 12:52:38 2003 > +++ php4/ext/standard/string.c Sat Jan 11 17:32:19 2003 > @@ -18,7 +18,7 @@ > +----------------------------------------------------------------------+ > */ > > -/* $Id: string.c,v 1.344 2003/01/11 17:52:38 iliaa Exp $ */ > +/* $Id: string.c,v 1.345 2003/01/11 22:32:19 moriyoshi Exp $ */ > > /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ > > @@ -1557,7 +1557,7 @@ > > if (argc == 3) { > convert_to_long_ex(offset); > - if (Z_LVAL_PP(offset) < 0 || Z_LVAL_PP(offset) > >Z_STRLEN_PP(haystack)) { > + if (Z_LVAL_PP(offset) < 0 || Z_LVAL_PP(offset) > >(int)Z_STRLEN_PP(haystack)) { > php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not >contained in string."); > RETURN_FALSE; > } > @@ -1597,7 +1597,7 @@ > > if (argc == 3) { > convert_to_long_ex(offset); > - if (Z_LVAL_PP(offset) < 0 || Z_LVAL_PP(offset) > >Z_STRLEN_PP(haystack)) { > + if (Z_LVAL_PP(offset) < 0 || Z_LVAL_PP(offset) > >(int)Z_STRLEN_PP(haystack)) { > php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not >contained in string."); > RETURN_FALSE; > } > @@ -1786,11 +1786,11 @@ > } > } > > - if (f >= Z_STRLEN_PP(str)) { > + if (f >= (int)Z_STRLEN_PP(str)) { > RETURN_FALSE; > } > > - if ((f + l) > Z_STRLEN_PP(str)) { > + if ((f + l) > (int)Z_STRLEN_PP(str)) { > l = Z_STRLEN_PP(str) - f; > } > > @@ -1833,11 +1833,11 @@ > * of the string > */ > if (f < 0) { > - f = Z_STRLEN_PP(str) + f; > + f = (int)Z_STRLEN_PP(str) + f; > if (f < 0) { > f = 0; > } > - } else if (f > Z_STRLEN_PP(str)) { > + } else if (f > (int)Z_STRLEN_PP(str)) { > f = Z_STRLEN_PP(str); > } > > @@ -1852,7 +1852,7 @@ > } > } > > - if ((f + l) > Z_STRLEN_PP(str)) { > + if ((f + l) > (int)Z_STRLEN_PP(str)) { > l = Z_STRLEN_PP(str) - f; > } > > @@ -3014,7 +3014,7 @@ > > do { > if (block_type == _HEB_BLOCK_TYPE_HEB) { > - while ((isheb((int)*(tmp+1)) || _isblank((int)*(tmp+1)) || >ispunct((int)*(tmp+1)) || (int)*(tmp+1)=='\n' ) && block_end<Z_STRLEN_PP(str)-1) { > + while ((isheb((int)*(tmp+1)) || _isblank((int)*(tmp+1)) || >ispunct((int)*(tmp+1)) || (int)*(tmp+1)=='\n' ) && >block_end<((int)Z_STRLEN_PP(str))-1) { > tmp++; > block_end++; > block_length++; > @@ -3059,7 +3059,7 @@ > } > block_type = _HEB_BLOCK_TYPE_ENG; > } else { > - while (!isheb(*(tmp+1)) && (int)*(tmp+1)!='\n' && block_end < >Z_STRLEN_PP(str)-1) { > + while (!isheb(*(tmp+1)) && (int)*(tmp+1)!='\n' && block_end < >((int)Z_STRLEN_PP(str))-1) { > tmp++; > block_end++; > block_length++; > @@ -3075,7 +3075,7 @@ > block_type = _HEB_BLOCK_TYPE_HEB; > } > block_start=block_end+1; > - } while (block_end < Z_STRLEN_PP(str)-1); > + } while (block_end < ((int)Z_STRLEN_PP(str))-1); > > > broken_str = (char *) emalloc(Z_STRLEN_PP(str)+1); > > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- ------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ ------------------------------------------------------------------------- -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php