Ard, hi - ssize_t was originally defined as ptrdiff_t in config.w32.h, which is itself defined as int in win32 (in stddef.h). It was then redefined as int in the fcgi configuration. It was also redefined in gd_jpeg.c (one of the few win32-affecting places that uses it) prior to any includes:
#if PHP_WIN32 && !defined(ssize_t) typedef int ssize_t; #endif - this was originally preventing some of the gd functions from working, because ssize_t WAS defined already (in config.w32.h) - as ptrdiff_t, which there was no definition for that gd_jpeg.c knew of. >From to the Single Unix Specification (http://www.opengroup.org/onlinepubs/007908799/xsh/systypes.h.html): "ssize_t Used for a count of bytes or an error indication. <snip/> ssize_t is a signed integral type .. capable of storing values at least in the range [-1, SSIZE_MAX]." Windows - uniquely - uses the definition SSIZE_T (type: INT_PTR) - note that ssize_t isn't the same thing as SSIZE_T, anywhere - but if I go that route for ssize_t definition (as I already tried to do) we end up with the fcgi redefinition to int anyway. Basically all I'm doing here is going back to the original, just saying it in a less obfuscated and more generic way :) so if it breaks on 64-bit architectures (which it shouldn't), it's not going to break in a way that it wouldn't have broken if I'd never been born. If you follow. Steph > -----Original Message----- > From: Ard Biesheuvel [mailto:[EMAIL PROTECTED] > Sent: 14 November 2003 11:17 > To: [EMAIL PROTECTED] > Subject: [PHP-DEV] Re: PATCH ssize_t without messing with fcgi source > > > > Works with everything. (phew!) > > > > You might wanna use long instead of int here, as sizeof(ssize_t) is > supposed to match the native pointer size. > > -- > Ard > > > > > ------------------------------------------------------------------------ > > > > Index: main/config.w32.h > > =================================================================== > > RCS file: /repository/php-src/main/config.w32.h,v > > retrieving revision 1.80 > > diff -u -r1.80 config.w32.h > > --- main/config.w32.h 13 Nov 2003 10:32:04 -0000 1.80 > > +++ main/config.w32.h 14 Nov 2003 00:56:36 -0000 > > @@ -174,7 +174,7 @@ > > #define SIZEOF_LONG_LONG_INT 0 > > #define SIZEOF_LONG_LONG 0 > > #define SIZEOF_INTMAX_T 0 > > -#define ssize_t SSIZE_T > > +#define ssize_t int > > #ifdef _WIN64 > > # define SIZEOF_SIZE_T 8 > > # define SIZEOF_PTRDIFF_T 8 > > Index: sapi/cgi/libfcgi/include/fcgi_config_win32.h > > =================================================================== > > RCS file: > /repository/php-src/sapi/cgi/libfcgi/include/fcgi_config_win32.h,v > > retrieving revision 1.2 > > diff -u -r1.2 fcgi_config_win32.h > > --- sapi/cgi/libfcgi/include/fcgi_config_win32.h 13 Nov 2003 > 10:32:05 -0000 1.2 > > +++ sapi/cgi/libfcgi/include/fcgi_config_win32.h 14 Nov 2003 > 00:56:38 -0000 > > @@ -106,3 +106,6 @@ > > /* Define as `__inline' if that's what the C compiler calls > it, or to nothing > > if it is not supported. */ > > /* #undef inline */ > > + > > +/* Define to `int' if <sys/types.h> does not define. */ > > +#define ssize_t int > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php