cvs: php3 /functions file.c
| From: | Sascha Schumann | Date: | Wed, 27 Sep 2000 16:15:08 +0000 |
| Subject: | cvs: php3 /functions file.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1846@lists.php.net to get a copy of this message | ||
sas Wed Sep 27 09:15:08 2000 EDT
Modified files:
/php3/functions file.c
Log:
Automatic conversion might cause interpretation of 0xff in the data stream
as EOF, so we store the result in an object of type int first.
Submitted by: melchers@cis.fu-berlin.de
Index: php3/functions/file.c
diff -u php3/functions/file.c:1.232 php3/functions/file.c:1.233
--- php3/functions/file.c:1.232 Sun Feb 20 12:42:14 2000
+++ php3/functions/file.c Wed Sep 27 09:15:07 2000
@@ -26,7 +26,7 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.232 2000/02/20 20:42:14 eschmid Exp $ */
+/* $Id: file.c,v 1.233 2000/09/27 16:15:07 sas Exp $ */
#include "php.h"
#include <stdio.h>
@@ -828,6 +828,7 @@
char *buf;
int issock=0;
int *sock, socketd=0;
+ int result;
TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
@@ -847,10 +848,12 @@
RETURN_FALSE;
}
buf = emalloc(sizeof(char) * 2);
- if (!(issock?(*buf=SOCK_FGETC(socketd)):(*buf=fgetc(fp)))) {
+#define FP_FGETC(a, b, c) (a?SOCK_FGETC(b):fgetc(c))
+ if ((result = FP_FGETC(issock, socketd, fp)) == EOF) {
efree(buf);
RETVAL_FALSE;
} else {
+ buf[0]=result;
buf[1]='\0';
return_value->value.str.val = buf;
return_value->value.str.len = 1;