martin Wed Jan 28 11:25:13 2004 EDT
Modified files:
/php-src/ext/gd gd_ctx.c
Log:
Bug fix: Images would be broken on big-endian machines because the putc
function wrote the first (instead of "the low order") byte. That resulted
in unexpected zero bytes.
http://cvs.php.net/diff.php/php-src/ext/gd/gd_ctx.c?r1=1.19&r2=1.20&ty=u
Index: php-src/ext/gd/gd_ctx.c
diff -u php-src/ext/gd/gd_ctx.c:1.19 php-src/ext/gd/gd_ctx.c:1.20
--- php-src/ext/gd/gd_ctx.c:1.19 Thu Jan 8 03:15:29 2004
+++ php-src/ext/gd/gd_ctx.c Wed Jan 28 11:25:12 2004
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd_ctx.c,v 1.19 2004/01/08 08:15:29 andi Exp $ */
+/* $Id: gd_ctx.c,v 1.20 2004/01/28 16:25:12 martin Exp $ */
#include "php_gd.h"
@@ -24,8 +24,13 @@
static void _php_image_output_putc(struct gdIOCtx *ctx, int c)
{
+ /* without the following downcast, the write will fail
+ * (i.e., will write a zero byte) for all
+ * big endian architectures:
+ */
+ unsigned char ch = (unsigned char) c;
TSRMLS_FETCH();
- php_write(&c, 1 TSRMLS_CC);
+ php_write(&ch, 1 TSRMLS_CC);
}
static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php