Hi,
Could someone with interbase test this patch that provides streams
support?
I would like to know the outcome of doing a regular compile (with no
streams support) and a compile with --enable-php-streams before I commit.
I'm just being overly cautious...
--Wez.
Index: ext/interbase/interbase.c
===================================================================
RCS file: /repository/php4/ext/interbase/interbase.c,v
retrieving revision 1.54
diff -u -r1.54 interbase.c
--- ext/interbase/interbase.c 2001/05/02 22:41:09 1.54
+++ ext/interbase/interbase.c 2001/05/12 21:52:59
@@ -2876,6 +2876,8 @@
char bl_data[IBASE_BLOB_SEG]; /* FIXME? blob_seg_size parameter? */
FILE *fp;
IBLS_FETCH();
+ void * what;
+ int type;
RESET_ERRMSG;
@@ -2903,8 +2905,12 @@
RETURN_FALSE;
}
- ZEND_FETCH_RESOURCE(fp, FILE *, file_arg, -1, "File-Handle",
php_file_le_fopen());
+ what = zend_fetch_resource(arg1, -1, "File-Handle", &type, 2,
+php_file_le_fopen(), php_file_le_stream());
+ ZEND_VERIFY_RESOURCE(what);
+ if (type == php_file_le_fopen())
+ fp = (FILE*)what;
+
ib_blob.link = ib_link->link;
ib_blob.trans_handle = ib_link->trans[trans_n];
ib_blob.bl_handle = NULL;
@@ -2917,6 +2923,21 @@
}
size = 0;
+
+#if HAVE_PHP_STREAM
+ if (type == php_file_le_stream()) {
+ while(b = php_stream_read((php_stream*)what, bl_data, 1,
+sizeof(bl_data)) > 0) {
+ if (isc_put_segment(IB_STATUS, &ib_blob.bl_handle, b,
+bl_data)) {
+ _php_ibase_error();
+ RETURN_FALSE;
+ }
+ size += b;
+
+ }
+ }
+ else {
+#endif
+ /* Can't see much use for the issock stuff here, it should be nuked --Wez */
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)) {
_php_ibase_error();
@@ -2924,6 +2945,10 @@
}
size += b;
}
+
+#if HAVE_PHP_STREAM
+ }
+#endif
if (isc_close_blob(IB_STATUS, &ib_blob.bl_handle)) {
_php_ibase_error();
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]