123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- [PATCH] Fix build with recent versions of zlib
- From upstream:
- r6633 + r6636 @ https://www.imagemagick.org/subversion/ImageMagick
- Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
- ---
- magick/blob.c | 68 ++++++++++++++++++++++++++++++++++------------------------
- 1 file changed, 40 insertions(+), 28 deletions(-)
- Index: ImageMagick-6.7.2-10/magick/blob.c
- ===================================================================
- --- ImageMagick-6.7.2-10.orig/magick/blob.c
- +++ ImageMagick-6.7.2-10/magick/blob.c
- @@ -120,8 +120,20 @@
- StreamType
- type;
-
- - FILE
- - *file;
- + union {
- + FILE
- + *file;
- +
- +#if defined(MAGICKCORE_ZLIB_DELEGATE)
- + gzFile
- + gzfile;
- +#endif
- +
- +#if defined(MAGICKCORE_BZLIB_DELEGATE)
- + BZFILE
- + *bzfile;
- +#endif
- + };
-
- struct stat
- properties;
- @@ -505,14 +517,14 @@
- case ZipStream:
- {
- #if defined(MAGICKCORE_ZLIB_DELEGATE)
- - (void) gzerror(image->blob->file,&status);
- + (void) gzerror(image->blob->gzfile,&status);
- #endif
- break;
- }
- case BZipStream:
- {
- #if defined(MAGICKCORE_BZLIB_DELEGATE)
- - (void) BZ2_bzerror((BZFILE *) image->blob->file,&status);
- + (void) BZ2_bzerror(image->blob->bzfile,&status);
- #endif
- break;
- }
- @@ -546,14 +558,14 @@
- case ZipStream:
- {
- #if defined(MAGICKCORE_ZLIB_DELEGATE)
- - status=gzclose(image->blob->file);
- + status=gzclose(image->blob->gzfile);
- #endif
- break;
- }
- case BZipStream:
- {
- #if defined(MAGICKCORE_BZLIB_DELEGATE)
- - BZ2_bzclose((BZFILE *) image->blob->file);
- + BZ2_bzclose(image->blob->bzfile);
- #endif
- break;
- }
- @@ -843,7 +855,7 @@
- status;
-
- status=0;
- - (void) BZ2_bzerror((BZFILE *) image->blob->file,&status);
- + (void) BZ2_bzerror(image->blob->bzfile,&status);
- image->blob->eof=status == BZ_UNEXPECTED_EOF ? MagickTrue : MagickFalse;
- #endif
- break;
- @@ -2486,8 +2498,8 @@
- ((int) magick[2] == 0x08))
- {
- (void) fclose(image->blob->file);
- - image->blob->file=(FILE *) gzopen(filename,type);
- - if (image->blob->file != (FILE *) NULL)
- + image->blob->gzfile=gzopen(filename,type);
- + if (image->blob->gzfile != (gzFile) NULL)
- image->blob->type=ZipStream;
- }
- #endif
- @@ -2495,8 +2507,8 @@
- if (strncmp((char *) magick,"BZh",3) == 0)
- {
- (void) fclose(image->blob->file);
- - image->blob->file=(FILE *) BZ2_bzopen(filename,type);
- - if (image->blob->file != (FILE *) NULL)
- + image->blob->bzfile=BZ2_bzopen(filename,type);
- + if (image->blob->bzfile != (BZFILE *) NULL)
- image->blob->type=BZipStream;
- }
- #endif
- @@ -2555,8 +2567,8 @@
- {
- if (mode == WriteBinaryBlobMode)
- type="wb";
- - image->blob->file=(FILE *) gzopen(filename,type);
- - if (image->blob->file != (FILE *) NULL)
- + image->blob->gzfile=gzopen(filename,type);
- + if (image->blob->gzfile != (gzFile) NULL)
- image->blob->type=ZipStream;
- }
- else
- @@ -2564,8 +2576,8 @@
- #if defined(MAGICKCORE_BZLIB_DELEGATE)
- if (LocaleCompare(extension,".bz2") == 0)
- {
- - image->blob->file=(FILE *) BZ2_bzopen(filename,type);
- - if (image->blob->file != (FILE *) NULL)
- + image->blob->bzfile=BZ2_bzopen(filename,type);
- + if (image->blob->bzfile != (BZFILE *) NULL)
- image->blob->type=BZipStream;
- }
- else
- @@ -2771,12 +2783,12 @@
- {
- default:
- {
- - count=(ssize_t) gzread(image->blob->file,q,(unsigned int) length);
- + count=(ssize_t) gzread(image->blob->gzfile,q,(unsigned int) length);
- break;
- }
- case 2:
- {
- - c=gzgetc(image->blob->file);
- + c=gzgetc(image->blob->gzfile);
- if (c == EOF)
- break;
- *q++=(unsigned char) c;
- @@ -2784,7 +2796,7 @@
- }
- case 1:
- {
- - c=gzgetc(image->blob->file);
- + c=gzgetc(image->blob->gzfile);
- if (c == EOF)
- break;
- *q++=(unsigned char) c;
- @@ -2799,7 +2811,7 @@
- case BZipStream:
- {
- #if defined(MAGICKCORE_BZLIB_DELEGATE)
- - count=(ssize_t) BZ2_bzread((BZFILE *) image->blob->file,q,(int) length);
- + count=(ssize_t) BZ2_bzread(image->blob->bzfile,q,(int) length);
- #endif
- break;
- }
- @@ -3527,7 +3539,7 @@
- case ZipStream:
- {
- #if defined(MAGICKCORE_ZLIB_DELEGATE)
- - if (gzseek(image->blob->file,(off_t) offset,whence) < 0)
- + if (gzseek(image->blob->gzfile,(off_t) offset,whence) < 0)
- return(-1);
- #endif
- image->blob->offset=TellBlob(image);
- @@ -3791,14 +3803,14 @@
- case ZipStream:
- {
- #if defined(MAGICKCORE_ZLIB_DELEGATE)
- - status=gzflush(image->blob->file,Z_SYNC_FLUSH);
- + status=gzflush(image->blob->gzfile,Z_SYNC_FLUSH);
- #endif
- break;
- }
- case BZipStream:
- {
- #if defined(MAGICKCORE_BZLIB_DELEGATE)
- - status=BZ2_bzflush((BZFILE *) image->blob->file);
- + status=BZ2_bzflush(image->blob->bzfile);
- #endif
- break;
- }
- @@ -3865,7 +3877,7 @@
- case ZipStream:
- {
- #if defined(MAGICKCORE_ZLIB_DELEGATE)
- - offset=(MagickOffsetType) gztell(image->blob->file);
- + offset=(MagickOffsetType) gztell(image->blob->gzfile);
- #endif
- break;
- }
- @@ -4014,20 +4026,20 @@
- {
- default:
- {
- - count=(ssize_t) gzwrite(image->blob->file,(void *) data,
- + count=(ssize_t) gzwrite(image->blob->gzfile,(void *) data,
- (unsigned int) length);
- break;
- }
- case 2:
- {
- - c=gzputc(image->blob->file,(int) *p++);
- + c=gzputc(image->blob->gzfile,(int) *p++);
- if (c == EOF)
- break;
- count++;
- }
- case 1:
- {
- - c=gzputc(image->blob->file,(int) *p++);
- + c=gzputc(image->blob->gzfile,(int) *p++);
- if (c == EOF)
- break;
- count++;
- @@ -4041,8 +4053,8 @@
- case BZipStream:
- {
- #if defined(MAGICKCORE_BZLIB_DELEGATE)
- - count=(ssize_t) BZ2_bzwrite((BZFILE *) image->blob->file,(void *) data,
- - (int) length);
- + count=(ssize_t) BZ2_bzwrite(image->blob->bzfile,(void *) data,(int)
- + length);
- #endif
- break;
- }
|