# This is a patch for GD-1.32 to update it to GD-1.32-ak00
# 
# To apply this patch:
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'applypatch' program with this patch file as input.
#
# If you do not have 'applypatch', it is part of the 'makepatch' package
# that you can fetch from the Comprehensive Perl Archive Network:
# http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz
# In the above URL, 'x' should be 2 or higher.
#
# To apply this patch without the use of 'applypatch':
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'patch' program with this file as input.
#
#### End of Preamble ####

#### Patch data follows ####
diff -u 'GD-1.32/GD.pm' 'GD-1.32-ak00/GD.pm'
Index: ./GD.pm
--- ./GD.pm	Fri Nov 10 16:55:58 2000
+++ ./GD.pm	Sun Jan 28 12:21:18 2001
@@ -12,7 +12,7 @@
 use Carp 'croak','carp';
 use strict;
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $AUTOLOAD);
-$VERSION = "1.32";
+$VERSION = "1.32_01ak";
 
 @ISA = qw(Exporter DynaLoader);
 # Items to export into callers namespace by default. Note: do not export
diff -u 'GD-1.32/GD.xs' 'GD-1.32-ak00/GD.xs'
Index: ./GD.xs
--- ./GD.xs	Thu Aug 24 16:41:47 2000
+++ ./GD.xs	Sun Jan 28 12:18:37 2001
@@ -242,26 +242,6 @@
 extern	gdFontPtr	gdFontMediumBold;
 extern	gdFontPtr	gdFontTiny;
 
-#ifdef PERL_OBJECT
-#  ifdef WIN32
-#define GDIMAGECREATEFROMPNG(x) gdImageCreateFromPng((FILE*)x)
-#define GDIMAGECREATEFROMXBM(x) gdImageCreateFromXbm((FILE*)x)
-#define GDIMAGECREATEFROMJPEG(x) gdImageCreateFromJpeg((FILE*)x)
-#define GDIMAGECREATEFROMWBMP(x) gdImageCreateFromWBMP((FILE*)x)
-#define GDIMAGECREATEFROMGD(x) gdImageCreateFromGd((FILE*)x)
-#define GDIMAGECREATEFROMGD2(x) gdImageCreateFromGd2((FILE*)x)
-#define GDIMAGECREATEFROMGD2PART(x,a,b,c,d) gdImageCreateFromGd2Part((FILE*)x,a,b,c,d)
-#  endif
-#else
-#define GDIMAGECREATEFROMPNG(x) gdImageCreateFromPng(x)
-#define GDIMAGECREATEFROMXBM(x) gdImageCreateFromXbm(x)
-#define GDIMAGECREATEFROMJPEG(x) gdImageCreateFromJpeg(x)
-#define GDIMAGECREATEFROMWBMP(x) gdImageCreateFromWBMP(x)
-#define GDIMAGECREATEFROMGD(x) gdImageCreateFromGd(x)
-#define GDIMAGECREATEFROMGD2(x) gdImageCreateFromGd2(x)
-#define GDIMAGECREATEFROMGD2PART(x,a,b,c,d) gdImageCreateFromGd2Part(x,a,b,c,d)
-#endif
-
 /* definitions required to create images from in-memory buffers */
 		     
 typedef struct bufIOCtx {
@@ -332,6 +312,13 @@
   return (gdIOCtx*)ctx;
 }
 
+/* Nick Ing-Simmons suggested this wrapper: */
+static int
+PerlIO_gd_source(void *fv,char *buf,int size)
+{
+ return (int) PerlIO_read((PerlIO *)fv,buf,size);
+}
+
 MODULE = GD		PACKAGE = GD
 
 double
@@ -362,7 +349,14 @@
 	InputStream	filehandle
 	PROTOTYPE: $$
 	CODE:
-	RETVAL = (GD__Image) GDIMAGECREATEFROMPNG(filehandle);
+ {
+  /* Nick Ing-Simmons' trick to have 5.7.0 perlio coexist with older perls */
+  /* XXX gdImageCreateFromXbm */
+  gdSource src;
+  src.source  = &PerlIO_gd_source;
+  src.context = filehandle;
+  RETVAL = (GD__Image) gdImageCreateFromPngSource(&src);
+ }
 	OUTPUT:
 	RETVAL
 
@@ -464,7 +458,14 @@
 	InputStream	filehandle
 	PROTOTYPE: $$
 	CODE:
-	RETVAL = GDIMAGECREATEFROMXBM(filehandle);
+ {
+  gdSource src;
+  src.source  = &PerlIO_gd_source;
+  src.context = filehandle;
+  RETVAL = (GD__Image) gdImageCreateFromXbm((FILE *)&src);
+  /* without the (FILE *) cast I get warning: passing arg 1 of
+  `gdImageCreateFromXbm' from incompatible pointer type */
+ }
 	OUTPUT:
 	RETVAL
 
@@ -474,7 +475,14 @@
 	InputStream	filehandle
 	PROTOTYPE: $$
 	CODE:
-	RETVAL = GDIMAGECREATEFROMGD(filehandle);
+ {
+  gdSource src;
+  src.source  = &PerlIO_gd_source;
+  src.context = filehandle;
+  RETVAL = (GD__Image) gdImageCreateFromGd((FILE *)&src);
+  /* without the (FILE *) cast I get warning: passing arg 1 of
+  `gdImageCreateFromXbm' from incompatible pointer type */
+ }
 	OUTPUT:
 	RETVAL
 
@@ -484,7 +492,14 @@
 	InputStream	filehandle
 	PROTOTYPE: $$
 	CODE:
-	RETVAL = GDIMAGECREATEFROMGD2(filehandle);
+ {
+  gdSource src;
+  src.source  = &PerlIO_gd_source;
+  src.context = filehandle;
+  RETVAL = (GD__Image) gdImageCreateFromGd2((FILE *)&src);
+  /* without the (FILE *) cast I get warning: passing arg 1 of
+  `gdImageCreateFromXbm' from incompatible pointer type */
+ }
 	OUTPUT:
 	RETVAL
 
@@ -498,7 +513,14 @@
 	  SV* errormsg;
 	CODE:
 #ifdef HAVE_JPEG
-	img = GDIMAGECREATEFROMJPEG(filehandle);
+ {
+  gdSource src;
+  src.source  = &PerlIO_gd_source;
+  src.context = filehandle;
+  img = (GD__Image) gdImageCreateFromJpeg((FILE *)&src);
+  /* without the (FILE *) cast I get warning: passing arg 1 of
+  `gdImageCreateFromXbm' from incompatible pointer type */
+ }
         if (img == NULL) {
           errormsg = perl_get_sv("@",0);
 	  if (errormsg != NULL)
@@ -523,7 +545,14 @@
 	  gdImagePtr img;
 	  SV* errormsg;
 	CODE:
-	img = GDIMAGECREATEFROMWBMP(filehandle);
+ {
+  gdSource src;
+  src.source  = &PerlIO_gd_source;
+  src.context = filehandle;
+  img = (GD__Image) gdImageCreateFromWBMP((FILE *)&src);
+  /* without the (FILE *) cast I get warning: passing arg 1 of
+  `gdImageCreateFromXbm' from incompatible pointer type */
+ }
         if (img == NULL) {
           errormsg = perl_get_sv("@",0);
 	  if (errormsg != NULL)
@@ -564,7 +593,14 @@
 	int height
 	PROTOTYPE: $$
 	CODE:
-	RETVAL = GDIMAGECREATEFROMGD2PART(filehandle,srcX,srcY,width,height);
+ {
+  gdSource src;
+  src.source  = &PerlIO_gd_source;
+  src.context = filehandle;
+  RETVAL = (GD__Image) gdImageCreateFromGd2Part((FILE *)&src,srcX,srcY,width,height);
+  /* without the (FILE *) cast I get warning: passing arg 1 of
+  `gdImageCreateFromXbm' from incompatible pointer type */
+ }
 	OUTPUT:
 	RETVAL
 
#### End of Patch data ####

#### ApplyPatch data follows ####
# Data version        : 1.0
# Date generated      : Sun Jan 28 12:23:45 2001
# Generated by        : makepatch 2.00_03
# Recurse directories : Yes
# p 'GD.pm' 44979 980680878 0100644
# p 'GD.xs' 23742 980680717 0100644
#### End of ApplyPatch data ####

#### End of Patch kit [created: Sun Jan 28 12:23:45 2001] ####
#### Patch checksum: 183 5410 14167 ####
#### Checksum: 201 6091 4527 ####