CVS update: php3/functions
| From: | sas | Date: | Wed, 26 May 1999 13:08:50 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-6016@lists.php.net to get a copy of this message | ||
Date: Wednesday May 26, 1999 @ 9:08
Author: sas
Update of /repository/php3/functions
In directory php:/tmp/cvs-serv23885
Modified Files:
file.c fsock.c fsock.h interbase.c
Log Message:
- let SOCK_FGETS() return char * instead of size_t
- there were some functions using SOCK_FGETS for sockets, but fread for
normal files. changed them to use SOCK_FREAD
Index: php3/functions/file.c
diff -u php3/functions/file.c:1.211 php3/functions/file.c:1.212
--- php3/functions/file.c:1.211 Wed May 26 08:42:24 1999
+++ php3/functions/file.c Wed May 26 09:08:49 1999
@@ -26,7 +26,7 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.211 1999/05/26 12:42:24 sas Exp $ */
+/* $Id: file.c,v 1.212 1999/05/26 13:08:49 sas Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
@@ -275,7 +275,7 @@
}
/* Now loop through the file and do the magic quotes thing if needed */
memset(buf,0,8191);
- while((issock?SOCK_FGETS(buf,8191,socketd):fgets(buf,8191,fp) != NULL)
+ while((issock?SOCK_FGETS(buf,8191,socketd):fgets(buf,8191,fp)) != NULL
&& !php3i_stristr(buf,"</head>")) {
if(php3i_stristr(buf,"<meta")) {
@@ -393,7 +393,7 @@
/* Now loop through the file and do the magic quotes thing if needed */
memset(buf,0,8191);
- while(issock?SOCK_FGETS(buf,8191,socketd):fgets(buf,8191,fp) != NULL) {
+ while((issock?SOCK_FGETS(buf,8191,socketd):fgets(buf,8191,fp)) != NULL) {
if (php3_ini.magic_quotes_runtime) {
int len;
@@ -790,7 +790,7 @@
buf = emalloc(sizeof(char) * (len + 1));
/* needed because recv doesnt put a null at the end*/
memset(buf,0,len+1);
- if (!(issock?SOCK_FGETS(buf,len,socketd):fgets(buf,len,fp) != NULL)) {
+ if (!((issock?SOCK_FGETS(buf,len,socketd):fgets(buf,len,fp)) != NULL)) {
efree(buf);
RETVAL_FALSE;
} else {
@@ -884,7 +884,7 @@
buf = emalloc(sizeof(char) * (len + 1));
/*needed because recv doesnt set null char at end*/
memset(buf,0,len+1);
- if (!(issock?SOCK_FGETS(buf,len,socketd):fgets(buf, len, fp) != NULL)) {
+ if (!((issock?SOCK_FGETS(buf,len,socketd):fgets(buf, len, fp)) != NULL)) {
efree(buf);
RETURN_FALSE;
}
@@ -1188,7 +1188,7 @@
}
size= 0;
if (php3_header()) { /* force header if not already sent */
- while(issock?(b=SOCK_FGETS(buf,sizeof(buf),socketd)):(b = fread(buf, 1, sizeof(buf), fp)) > 0)
{
+ while(issock?(b=SOCK_FREAD(buf,sizeof(buf),socketd)):(b = fread(buf, 1, sizeof(buf), fp)) > 0)
{
PHPWRITE(buf,b);
size += b ;
}
@@ -1257,7 +1257,7 @@
}
size = 0;
if (php3_header()) { /* force headers if not already sent */
- while(issock?(b=SOCK_FGETS(buf,sizeof(buf),socketd)):(b = fread(buf, 1, sizeof(buf), fp)) > 0)
{
+ while(issock?(b=SOCK_FREAD(buf,sizeof(buf),socketd)):(b = fread(buf, 1, sizeof(buf), fp)) > 0)
{
PHPWRITE(buf,b);
size += b ;
}
@@ -1510,7 +1510,7 @@
buf = emalloc(sizeof(char) * (len + 1));
/*needed because recv doesnt set null char at end*/
memset(buf,0,len+1);
- if (!(issock?SOCK_FGETS(buf,len,socketd):(long)fgets(buf, len, fp))) {
+ if ((issock?SOCK_FGETS(buf,len,socketd):fgets(buf, len, fp)) == NULL) {
efree(buf);
RETURN_FALSE;
}
Index: php3/functions/fsock.c
diff -u php3/functions/fsock.c:1.103 php3/functions/fsock.c:1.104
--- php3/functions/fsock.c:1.103 Wed May 26 08:45:00 1999
+++ php3/functions/fsock.c Wed May 26 09:08:50 1999
@@ -27,7 +27,7 @@
| Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
-/* $Id: fsock.c,v 1.103 1999/05/26 12:45:00 sas Exp $ */
+/* $Id: fsock.c,v 1.104 1999/05/26 13:08:50 sas Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
@@ -412,10 +412,10 @@
SOCK_FIND(sock, socket); \
if(sock->is_blocked) _php3_sock_read_limited(sock, max); else _php3_sock_read(sock)
-size_t _php3_sock_fgets(char *buf, size_t maxlen, int socket)
+char *_php3_sock_fgets(char *buf, size_t maxlen, int socket)
{
char *p;
- size_t ret = 0;
+ char *ret = NULL;
size_t amount = 0;
size_t nr_read;
SOCK_FIND_AND_READ_MAX(1);
@@ -423,7 +423,7 @@
if(sock->is_blocked) {
for(nr_read = 1; !sock->eof && nr_read < maxlen; ) {
nr_read += _php3_sock_read_limited(sock, 1);
- if((p = memchr(READPTR(sock, '\n', TOREAD(sock)))) != NULL) break;
+ if((p = memchr(READPTR(sock), '\n', TOREAD(sock))) != NULL) break;
}
} else {
p = memchr(READPTR(sock), '\n', MIN(TOREAD(sock), maxlen - 1));
@@ -441,7 +441,7 @@
buf[amount] = '\0';
- ret = amount;
+ ret = buf;
}
return ret;
Index: php3/functions/fsock.h
diff -u php3/functions/fsock.h:1.19 php3/functions/fsock.h:1.20
--- php3/functions/fsock.h:1.19 Wed May 26 08:42:24 1999
+++ php3/functions/fsock.h Wed May 26 09:08:50 1999
@@ -27,7 +27,7 @@
| Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
-/* $Id: fsock.h,v 1.19 1999/05/26 12:42:24 sas Exp $ */
+/* $Id: fsock.h,v 1.20 1999/05/26 13:08:50 sas Exp $ */
#ifndef _FSOCK_H
#define _FSOCK_H
@@ -38,7 +38,7 @@
PHP_FUNCTION(fsockopen);
PHP_FUNCTION(pfsockopen);
int lookup_hostname(const char *addr, struct in_addr *in);
-size_t _php3_sock_fgets(char *buf, size_t maxlen, int socket);
+char *_php3_sock_fgets(char *buf, size_t maxlen, int socket);
size_t _php3_sock_fread(char *buf, size_t maxlen, int socket);
int _php3_sock_feof(int socket);
int _php3_sock_fgetc(int socket);
Index: php3/functions/interbase.c
diff -u php3/functions/interbase.c:1.16 php3/functions/interbase.c:1.17
--- php3/functions/interbase.c:1.16 Mon May 24 07:55:54 1999
+++ php3/functions/interbase.c Wed May 26 09:08:50 1999
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interbase.c,v 1.16 1999/05/24 11:55:54 sas Exp $ */
+/* $Id: interbase.c,v 1.17 1999/05/26 13:08:50 sas Exp $ */
/* TODO: Arrays, roles?
A lot... */
@@ -474,7 +474,7 @@
void php3_info_ibase(void)
{
- php3_printf("$Revision: 1.16 $");
+ php3_printf("$Revision: 1.17 $");
}
/* }}} */
@@ -2533,7 +2533,7 @@
}
size = 0;
- while(issock?(b=SOCK_FGETS(bl_data,sizeof(bl_data),socketd)):(b = fread(bl_data, 1,
sizeof(bl_data), fp)) > 0) {
+ while(issock?(b=SOCK_FREAD(bl_data,sizeof(bl_data),socketd)):(b = fread(bl_data, 1,
sizeof(bl_data), fp)) > 0) {
if (isc_put_segment(IB_STATUS, &ib_blob.bl_handle, b, bl_data)){
_php3_ibase_error();
RETURN_FALSE;
--
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