CVS update: php3/functions
| From: | sas | Date: | Mon, 21 Dec 1998 04:21:08 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-2942@lists.php.net to get a copy of this message | ||
Date: Sunday December 20, 1998 @ 23:21
Author: sas
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv26506/functions
Modified Files:
base64.c file.c gd.c gdttf.c image.c iptc.c md5.c pgsql.c
string.c sysvsem.c
Log Message:
Oh, I hate warnings. Especially if I trigger them.
-pedantic -Wall -Wmissing-prototypes -Wmissing-declarations
If one ignores warnings about inline functions, PHP (almost) compiles quietly.
Index: php3/functions/base64.c
diff -c php3/functions/base64.c:1.25 php3/functions/base64.c:1.26
*** php3/functions/base64.c:1.25 Wed Nov 18 16:23:02 1998
--- php3/functions/base64.c Sun Dec 20 23:21:06 1998
***************
*** 26,32 ****
| Author: Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
! /* $Id: base64.c,v 1.25 1998/11/18 21:23:02 ssb Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
--- 26,32 ----
| Author: Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
! /* $Id: base64.c,v 1.26 1998/12/21 04:21:06 sas Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
***************
*** 154,162 ****
WRONG_PARAM_COUNT;
}
convert_to_string(string);
! result = _php3_base64_encode(string->value.str.val, string->value.str.len,
&ret_length);
if (result != NULL) {
! return_value->value.str.val = result;
return_value->value.str.len = ret_length;
return_value->type = IS_STRING;
} else {
--- 154,162 ----
WRONG_PARAM_COUNT;
}
convert_to_string(string);
! result = _php3_base64_encode((unsigned char *) string->value.str.val,
string->value.str.len, &ret_length);
if (result != NULL) {
! return_value->value.str.val = (char *) result;
return_value->value.str.len = ret_length;
return_value->type = IS_STRING;
} else {
***************
*** 178,186 ****
WRONG_PARAM_COUNT;
}
convert_to_string(string);
! result = _php3_base64_decode(string->value.str.val, string->value.str.len,
&ret_length);
if (result != NULL) {
! return_value->value.str.val = result;
return_value->value.str.len = ret_length;
return_value->type = IS_STRING;
} else {
--- 178,186 ----
WRONG_PARAM_COUNT;
}
convert_to_string(string);
! result = _php3_base64_decode((unsigned char *) string->value.str.val,
string->value.str.len, &ret_length);
if (result != NULL) {
! return_value->value.str.val = (char *) result;
return_value->value.str.len = ret_length;
return_value->type = IS_STRING;
} else {
Index: php3/functions/file.c
diff -c php3/functions/file.c:1.187 php3/functions/file.c:1.188
*** php3/functions/file.c:1.187 Mon Dec 7 10:40:42 1998
--- php3/functions/file.c Sun Dec 20 23:21:07 1998
***************
*** 26,32 ****
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
! /* $Id: file.c,v 1.187 1998/12/07 15:40:42 shane Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 26,32 ----
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
! /* $Id: file.c,v 1.188 1998/12/21 04:21:07 sas Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 264,275 ****
/* Now loop through the file and do the magic quotes thing if needed */
memset(buf,0,8191);
while((issock?SOCK_FGETS(buf,8191,socketd):(int)fgets(buf,8191,fp))
! && !php3i_stristr(buf,"</head>")) {
! if(php3i_stristr(buf,"<meta")) {
memset(var_name,0,50);
/* get the variable name from the name attribute of the meta tag */
! tmp=php3i_stristr(buf,"name=\"");
if(tmp) {
tmp+=6;
end=strstr(tmp,"\"");
--- 264,275 ----
/* Now loop through the file and do the magic quotes thing if needed */
memset(buf,0,8191);
while((issock?SOCK_FGETS(buf,8191,socketd):(int)fgets(buf,8191,fp))
! && !php3i_stristr((unsigned char *) buf, (unsigned char *) "</head>")) {
! if(php3i_stristr((unsigned char *) buf, (unsigned char *) "<meta")) {
memset(var_name,0,50);
/* get the variable name from the name attribute of the meta tag */
! tmp=php3i_stristr((unsigned char *)buf,(unsigned char *)"name=\"");
if(tmp) {
tmp+=6;
end=strstr(tmp,"\"");
***************
*** 304,310 ****
}
/* get the variable value from the content attribute of the meta tag */
! tmp=php3i_stristr(buf,"content=\"");
if(tmp) {
tmp+=9;
end=strstr(tmp,"\"");
--- 304,310 ----
}
/* get the variable value from the content attribute of the meta tag */
! tmp=php3i_stristr((unsigned char *)buf,(unsigned char *)"content=\"");
if(tmp) {
tmp+=9;
end=strstr(tmp,"\"");
Index: php3/functions/gd.c
diff -c php3/functions/gd.c:1.101 php3/functions/gd.c:1.102
*** php3/functions/gd.c:1.101 Wed Nov 18 16:23:06 1998
--- php3/functions/gd.c Sun Dec 20 23:21:07 1998
***************
*** 29,35 ****
+----------------------------------------------------------------------+
*/
! /* $Id: gd.c,v 1.101 1998/11/18 21:23:06 ssb Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
--- 29,35 ----
+----------------------------------------------------------------------+
*/
! /* $Id: gd.c,v 1.102 1998/12/21 04:21:07 sas Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
***************
*** 1464,1470 ****
ch = (int)((unsigned char)*(C->value.str.val));
} else {
string = (unsigned char *) estrndup(C->value.str.val,C->value.str.len);
! l = strlen(string);
}
y = Y->value.lval;
--- 1464,1470 ----
ch = (int)((unsigned char)*(C->value.str.val));
} else {
string = (unsigned char *) estrndup(C->value.str.val,C->value.str.len);
! l = strlen((char *) string);
}
y = Y->value.lval;
***************
*** 1761,1770 ****
angle = ANGLE->value.dval * (M_PI/180); /* convert to radians */
string = (unsigned char *) C->value.str.val;
! l = strlen(string);
fontname = (unsigned char *) FONTNAME->value.str.val;
! error = gdttf(im, brect, col, fontname, ptsize, angle, x, y, string);
if (error) {
php3_error(E_WARNING, error);
--- 1761,1770 ----
angle = ANGLE->value.dval * (M_PI/180); /* convert to radians */
string = (unsigned char *) C->value.str.val;
! l = strlen((char *) string);
fontname = (unsigned char *) FONTNAME->value.str.val;
! error = gdttf(im, brect, col, (char*) fontname, ptsize, angle, x, y, (char *) string);
if (error) {
php3_error(E_WARNING, error);
Index: php3/functions/gdttf.c
diff -c php3/functions/gdttf.c:1.15 php3/functions/gdttf.c:1.16
*** php3/functions/gdttf.c:1.15 Tue Oct 6 05:47:08 1998
--- php3/functions/gdttf.c Sun Dec 20 23:21:07 1998
***************
*** 409,415 ****
n = TT_Get_CharMap_Count(a->face);
for (i = 0; i < n; i++) {
! TT_Get_CharMap_ID(a->face, i, &platform, &encoding);
if ((platform == 3 && encoding == 1) ||
(platform == 0 && encoding == 0)) {
TT_Get_CharMap(a->face, i, &a->char_map);
--- 409,415 ----
n = TT_Get_CharMap_Count(a->face);
for (i = 0; i < n; i++) {
! TT_Get_CharMap_ID(a->face, i, (unsigned short*) &platform, (unsigned short
*)&encoding);
if ((platform == 3 && encoding == 1) ||
(platform == 0 && encoding == 0)) {
TT_Get_CharMap(a->face, i, &a->char_map);
Index: php3/functions/image.c
diff -c php3/functions/image.c:1.39 php3/functions/image.c:1.40
*** php3/functions/image.c:1.39 Thu Oct 15 09:31:48 1998
--- php3/functions/image.c Sun Dec 20 23:21:07 1998
***************
*** 26,32 ****
| Authors: Rasmus Lerdorf |
+----------------------------------------------------------------------+
*/
! /* $Id: image.c,v 1.39 1998/10/15 13:31:48 thies Exp $ */
/*
* Based on Daniel Schmitt's imageinfo.c which carried the following
* Copyright notice.
--- 26,32 ----
| Authors: Rasmus Lerdorf |
+----------------------------------------------------------------------+
*/
! /* $Id: image.c,v 1.40 1998/12/21 04:21:07 sas Exp $ */
/*
* Based on Daniel Schmitt's imageinfo.c which carried the following
* Copyright notice.
***************
*** 210,218 ****
return;
}
! sprintf(markername,"APP%d",marker - M_APP0);
! add_assoc_stringl(info,markername,buffer,length,1);
efree(buffer);
}
--- 210,218 ----
return;
}
! sprintf((char *) markername,"APP%d",marker - M_APP0);
! add_assoc_stringl(info,(char *) markername,(char *) buffer,length,1);
efree(buffer);
}
Index: php3/functions/iptc.c
diff -c php3/functions/iptc.c:1.5 php3/functions/iptc.c:1.6
*** php3/functions/iptc.c:1.5 Tue Dec 15 03:54:58 1998
--- php3/functions/iptc.c Sun Dec 20 23:21:07 1998
***************
*** 27,33 ****
+----------------------------------------------------------------------+
*/
! /* $Id: iptc.c,v 1.5 1998/12/15 08:54:58 thies Exp $ */
/*
* Functions to parse & compse IPTC data.
--- 27,33 ----
+----------------------------------------------------------------------+
*/
! /* $Id: iptc.c,v 1.6 1998/12/21 04:21:07 sas Exp $ */
/*
* Functions to parse & compse IPTC data.
***************
*** 61,67 ****
inx = 0;
length = str->value.str.len;
! buffer = str->value.str.val;
inheader = 0; /* have we already found the IPTC-Header??? */
tagsfound = 0; /* number of tags already found */
--- 61,67 ----
inx = 0;
length = str->value.str.len;
! buffer = (unsigned char *) str->value.str.val;
inheader = 0; /* have we already found the IPTC-Header??? */
tagsfound = 0; /* number of tags already found */
***************
*** 92,98 ****
inx += 2;
}
! sprintf(key,"%d#%03d",(unsigned int) dataset,(unsigned int) recnum);
if ((inx + len) > length)
break;
--- 92,99 ----
inx += 2;
}
! sprintf((char *) key,"%d#%03d",
! (unsigned int) dataset,(unsigned int) recnum);
if ((inx + len) > length)
break;
***************
*** 104,119 ****
}
}
! if (_php3_hash_find(return_value->value.ht,key,strlen(key) + 1,(void **) &element) ==
FAILURE) {
if (array_init(&values) == FAILURE) {
php3_error(E_ERROR, "Unable to initialize array");
RETURN_FALSE;
}
! _php3_hash_update(return_value->value.ht, key, strlen(key)+1, (void *) &values,
sizeof(pval), (void **) &element);
}
! add_next_index_stringl(element,buffer+inx,len,1);
inx += len;
--- 105,120 ----
}
}
! if (_php3_hash_find(return_value->value.ht,(char *) key,strlen((char *) key) + 1,(void **)
&element) == FAILURE) {
if (array_init(&values) == FAILURE) {
php3_error(E_ERROR, "Unable to initialize array");
RETURN_FALSE;
}
! _php3_hash_update(return_value->value.ht, (char *) key, strlen((char *) key)+1, (void *)
&values, sizeof(pval), (void **) &element);
}
! add_next_index_stringl(element,(char *) (buffer+inx),len,1);
inx += len;
Index: php3/functions/md5.c
diff -c php3/functions/md5.c:1.31 php3/functions/md5.c:1.32
*** php3/functions/md5.c:1.31 Wed Nov 18 16:23:09 1998
--- php3/functions/md5.c Sun Dec 20 23:21:07 1998
***************
*** 59,65 ****
md5str[0] = '\0';
PHP3_MD5Init(&context);
! PHP3_MD5Update(&context, arg->value.str.val, arg->value.str.len);
PHP3_MD5Final(digest, &context);
for (i = 0, r = md5str; i < 16; i++, r += 2) {
sprintf(r, "%02x", digest[i]);
--- 59,65 ----
md5str[0] = '\0';
PHP3_MD5Init(&context);
! PHP3_MD5Update(&context, (unsigned char *) arg->value.str.val, arg->value.str.len);
PHP3_MD5Final(digest, &context);
for (i = 0, r = md5str; i < 16; i++, r += 2) {
sprintf(r, "%02x", digest[i]);
Index: php3/functions/pgsql.c
diff -c php3/functions/pgsql.c:1.73 php3/functions/pgsql.c:1.74
*** php3/functions/pgsql.c:1.73 Tue Dec 15 17:46:26 1998
--- php3/functions/pgsql.c Sun Dec 20 23:21:07 1998
***************
*** 28,34 ****
+----------------------------------------------------------------------+
*/
! /* $Id: pgsql.c,v 1.73 1998/12/15 22:46:26 rasmus Exp $ */
#include <stdlib.h>
--- 28,34 ----
+----------------------------------------------------------------------+
*/
! /* $Id: pgsql.c,v 1.74 1998/12/21 04:21:07 sas Exp $ */
#include <stdlib.h>
***************
*** 880,886 ****
int type;
int i,num_fields;
char *element;
! uint element_len;
if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &result, &row)==FAILURE) {
--- 880,886 ----
int type;
int i,num_fields;
char *element;
! int element_len;
if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &result, &row)==FAILURE) {
***************
*** 930,936 ****
int type;
int i,num_fields;
char *element,*field_name;
! uint element_len;
if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &result, &row)==FAILURE) {
--- 930,936 ----
int type;
int i,num_fields;
char *element,*field_name;
! int element_len;
if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &result, &row)==FAILURE) {
Index: php3/functions/string.c
diff -c php3/functions/string.c:1.156 php3/functions/string.c:1.157
*** php3/functions/string.c:1.156 Sun Dec 20 14:00:15 1998
--- php3/functions/string.c Sun Dec 20 23:21:08 1998
***************
*** 30,36 ****
*/
! /* $Id: string.c,v 1.156 1998/12/20 19:00:15 shane Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 30,36 ----
*/
! /* $Id: string.c,v 1.157 1998/12/21 04:21:08 sas Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 533,539 ****
tolower(s[k]) == tolower(t[j]); j++, k++)
;
if (t[j] == '\0')
! return s + l;
}
return NULL;
}
--- 533,539 ----
tolower(s[k]) == tolower(t[j]); j++, k++)
;
if (t[j] == '\0')
! return ((char *) s + l);
}
return NULL;
}
***************
*** 557,563 ****
php3_error(E_WARNING,"Empty delimiter");
RETURN_FALSE;
}
! found = php3i_stristr(haystack->value.str.val, needle->value.str.val);
if (found) {
RETVAL_STRING(found,1);
--- 557,564 ----
php3_error(E_WARNING,"Empty delimiter");
RETURN_FALSE;
}
! found = php3i_stristr((unsigned char *) haystack->value.str.val,
! (unsigned char *)needle->value.str.val);
if (found) {
RETVAL_STRING(found,1);
***************
*** 1236,1247 ****
*/
static inline char *
! _php3_memnstr(unsigned char *haystack, char *needle, int needle_len, unsigned char *end)
{
! unsigned char *p=NULL;
! unsigned char *s=NULL;
! for(p = haystack; p < end - needle_len + 1&&
(s = memchr(p, *needle, end - haystack)); p = s + 1) {
if(memcmp(s, needle, needle_len) == 0)
return s;
--- 1237,1248 ----
*/
static inline char *
! _php3_memnstr(char *haystack, char *needle, int needle_len, char *end)
{
! char *p = haystack;
! char *s = NULL;
! for(; p < end - needle_len + 1&&
(s = memchr(p, *needle, end - haystack)); p = s + 1) {
if(memcmp(s, needle, needle_len) == 0)
return s;
***************
*** 1266,1272 ****
new = malloc(length);
/* we jump through haystack searching for the needle. hurray! */
for(p = haystack, q = new;
! (r = _php3_memnstr((void*) p, needle, needle_len, (void*) end));) {
/* this ain't optimal. you could call it `efficient memory usage' */
realloc(new, (q - new) + (r - p) + (str_len) + 1);
memcpy(q, p, r - p);
--- 1267,1273 ----
new = malloc(length);
/* we jump through haystack searching for the needle. hurray! */
for(p = haystack, q = new;
! (r = _php3_memnstr(p, needle, needle_len, end));) {
/* this ain't optimal. you could call it `efficient memory usage' */
realloc(new, (q - new) + (r - p) + (str_len) + 1);
memcpy(q, p, r - p);
Index: php3/functions/sysvsem.c
diff -c php3/functions/sysvsem.c:1.3 php3/functions/sysvsem.c:1.4
*** php3/functions/sysvsem.c:1.3 Sat Dec 19 06:26:25 1998
--- php3/functions/sysvsem.c Sun Dec 20 23:21:08 1998
***************
*** 27,36 ****
+----------------------------------------------------------------------+
*/
! /* $Id: sysvsem.c,v 1.3 1998/12/19 11:26:25 sas Exp $ */
/* This has been built and tested on Solaris 2.6 and Linux 2.1.122.
* It may not compile or execute correctly on other systems.
*/
#ifndef MSVC5
--- 27,38 ----
+----------------------------------------------------------------------+
*/
! /* $Id: sysvsem.c,v 1.4 1998/12/21 04:21:08 sas Exp $ */
/* This has been built and tested on Solaris 2.6 and Linux 2.1.122.
* It may not compile or execute correctly on other systems.
+ *
+ * sas: Works for me on Linux 2.0.36 and FreeBSD 3.0-current
*/
#ifndef MSVC5
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net