On Thu, 11 Apr 2002 01:14:37 -0400 (EDT), Cliff Woolley wrote: >On Thu, 11 Apr 2002, Brian Havard wrote: > >> > - while (str_length > 0) { >... >> > - str += now; >> > - str_length -= now; >> > - } >... >> > >> > - return str_length; >> > + return 0; /* we wrote everything, we promise! */ >> >> Why did you change this to return 0? It breaks ImageJpeg >> (and likely other things) as GD checks that the return value >> matches the passed length & aborts if it doesn't. > > >Because the old version was already always returning 0. If that's >incorrect, it was incorrect before was well.
Well, actually, that's quite possible (I only just upgraded my GD library to support JPEG). Inside the GD library (gd_jpeg.c:702 in GD 1.8.4) it compares the return value of gdPutBuf() to the requested write size & aborts if it doesn't match. This value is ultimately the return value of php_apache_sapi_ub_write() which tells me that it should be returning the number of bytes written. The call stack actually looks like this: [...] empty_output_buffer gdPutBuf _php_image_output_putbuf php_write php_body_write php_ub_body_write php_ub_body_write_no_header php_apache_sapi_ub_write When I change php_apache_sapi_ub_write() to return str_length instead of 0 (after the new patch so str_length is the full write size) the JPEG is written in full rather than just the first 4k. -- ______________________________________________________________________________ | Brian Havard | "He is not the messiah! | | [EMAIL PROTECTED] | He's a very naughty boy!" - Life of Brian | ------------------------------------------------------------------------------ -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php