imagemagick-zlib-fix.patch 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. [PATCH] Fix build with recent versions of zlib
  2. From upstream:
  3. r6633 + r6636 @ https://www.imagemagick.org/subversion/ImageMagick
  4. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
  5. ---
  6. magick/blob.c | 68 ++++++++++++++++++++++++++++++++++------------------------
  7. 1 file changed, 40 insertions(+), 28 deletions(-)
  8. Index: ImageMagick-6.7.2-10/magick/blob.c
  9. ===================================================================
  10. --- ImageMagick-6.7.2-10.orig/magick/blob.c
  11. +++ ImageMagick-6.7.2-10/magick/blob.c
  12. @@ -120,8 +120,20 @@
  13. StreamType
  14. type;
  15. - FILE
  16. - *file;
  17. + union {
  18. + FILE
  19. + *file;
  20. +
  21. +#if defined(MAGICKCORE_ZLIB_DELEGATE)
  22. + gzFile
  23. + gzfile;
  24. +#endif
  25. +
  26. +#if defined(MAGICKCORE_BZLIB_DELEGATE)
  27. + BZFILE
  28. + *bzfile;
  29. +#endif
  30. + };
  31. struct stat
  32. properties;
  33. @@ -505,14 +517,14 @@
  34. case ZipStream:
  35. {
  36. #if defined(MAGICKCORE_ZLIB_DELEGATE)
  37. - (void) gzerror(image->blob->file,&status);
  38. + (void) gzerror(image->blob->gzfile,&status);
  39. #endif
  40. break;
  41. }
  42. case BZipStream:
  43. {
  44. #if defined(MAGICKCORE_BZLIB_DELEGATE)
  45. - (void) BZ2_bzerror((BZFILE *) image->blob->file,&status);
  46. + (void) BZ2_bzerror(image->blob->bzfile,&status);
  47. #endif
  48. break;
  49. }
  50. @@ -546,14 +558,14 @@
  51. case ZipStream:
  52. {
  53. #if defined(MAGICKCORE_ZLIB_DELEGATE)
  54. - status=gzclose(image->blob->file);
  55. + status=gzclose(image->blob->gzfile);
  56. #endif
  57. break;
  58. }
  59. case BZipStream:
  60. {
  61. #if defined(MAGICKCORE_BZLIB_DELEGATE)
  62. - BZ2_bzclose((BZFILE *) image->blob->file);
  63. + BZ2_bzclose(image->blob->bzfile);
  64. #endif
  65. break;
  66. }
  67. @@ -843,7 +855,7 @@
  68. status;
  69. status=0;
  70. - (void) BZ2_bzerror((BZFILE *) image->blob->file,&status);
  71. + (void) BZ2_bzerror(image->blob->bzfile,&status);
  72. image->blob->eof=status == BZ_UNEXPECTED_EOF ? MagickTrue : MagickFalse;
  73. #endif
  74. break;
  75. @@ -2486,8 +2498,8 @@
  76. ((int) magick[2] == 0x08))
  77. {
  78. (void) fclose(image->blob->file);
  79. - image->blob->file=(FILE *) gzopen(filename,type);
  80. - if (image->blob->file != (FILE *) NULL)
  81. + image->blob->gzfile=gzopen(filename,type);
  82. + if (image->blob->gzfile != (gzFile) NULL)
  83. image->blob->type=ZipStream;
  84. }
  85. #endif
  86. @@ -2495,8 +2507,8 @@
  87. if (strncmp((char *) magick,"BZh",3) == 0)
  88. {
  89. (void) fclose(image->blob->file);
  90. - image->blob->file=(FILE *) BZ2_bzopen(filename,type);
  91. - if (image->blob->file != (FILE *) NULL)
  92. + image->blob->bzfile=BZ2_bzopen(filename,type);
  93. + if (image->blob->bzfile != (BZFILE *) NULL)
  94. image->blob->type=BZipStream;
  95. }
  96. #endif
  97. @@ -2555,8 +2567,8 @@
  98. {
  99. if (mode == WriteBinaryBlobMode)
  100. type="wb";
  101. - image->blob->file=(FILE *) gzopen(filename,type);
  102. - if (image->blob->file != (FILE *) NULL)
  103. + image->blob->gzfile=gzopen(filename,type);
  104. + if (image->blob->gzfile != (gzFile) NULL)
  105. image->blob->type=ZipStream;
  106. }
  107. else
  108. @@ -2564,8 +2576,8 @@
  109. #if defined(MAGICKCORE_BZLIB_DELEGATE)
  110. if (LocaleCompare(extension,".bz2") == 0)
  111. {
  112. - image->blob->file=(FILE *) BZ2_bzopen(filename,type);
  113. - if (image->blob->file != (FILE *) NULL)
  114. + image->blob->bzfile=BZ2_bzopen(filename,type);
  115. + if (image->blob->bzfile != (BZFILE *) NULL)
  116. image->blob->type=BZipStream;
  117. }
  118. else
  119. @@ -2771,12 +2783,12 @@
  120. {
  121. default:
  122. {
  123. - count=(ssize_t) gzread(image->blob->file,q,(unsigned int) length);
  124. + count=(ssize_t) gzread(image->blob->gzfile,q,(unsigned int) length);
  125. break;
  126. }
  127. case 2:
  128. {
  129. - c=gzgetc(image->blob->file);
  130. + c=gzgetc(image->blob->gzfile);
  131. if (c == EOF)
  132. break;
  133. *q++=(unsigned char) c;
  134. @@ -2784,7 +2796,7 @@
  135. }
  136. case 1:
  137. {
  138. - c=gzgetc(image->blob->file);
  139. + c=gzgetc(image->blob->gzfile);
  140. if (c == EOF)
  141. break;
  142. *q++=(unsigned char) c;
  143. @@ -2799,7 +2811,7 @@
  144. case BZipStream:
  145. {
  146. #if defined(MAGICKCORE_BZLIB_DELEGATE)
  147. - count=(ssize_t) BZ2_bzread((BZFILE *) image->blob->file,q,(int) length);
  148. + count=(ssize_t) BZ2_bzread(image->blob->bzfile,q,(int) length);
  149. #endif
  150. break;
  151. }
  152. @@ -3527,7 +3539,7 @@
  153. case ZipStream:
  154. {
  155. #if defined(MAGICKCORE_ZLIB_DELEGATE)
  156. - if (gzseek(image->blob->file,(off_t) offset,whence) < 0)
  157. + if (gzseek(image->blob->gzfile,(off_t) offset,whence) < 0)
  158. return(-1);
  159. #endif
  160. image->blob->offset=TellBlob(image);
  161. @@ -3791,14 +3803,14 @@
  162. case ZipStream:
  163. {
  164. #if defined(MAGICKCORE_ZLIB_DELEGATE)
  165. - status=gzflush(image->blob->file,Z_SYNC_FLUSH);
  166. + status=gzflush(image->blob->gzfile,Z_SYNC_FLUSH);
  167. #endif
  168. break;
  169. }
  170. case BZipStream:
  171. {
  172. #if defined(MAGICKCORE_BZLIB_DELEGATE)
  173. - status=BZ2_bzflush((BZFILE *) image->blob->file);
  174. + status=BZ2_bzflush(image->blob->bzfile);
  175. #endif
  176. break;
  177. }
  178. @@ -3865,7 +3877,7 @@
  179. case ZipStream:
  180. {
  181. #if defined(MAGICKCORE_ZLIB_DELEGATE)
  182. - offset=(MagickOffsetType) gztell(image->blob->file);
  183. + offset=(MagickOffsetType) gztell(image->blob->gzfile);
  184. #endif
  185. break;
  186. }
  187. @@ -4014,20 +4026,20 @@
  188. {
  189. default:
  190. {
  191. - count=(ssize_t) gzwrite(image->blob->file,(void *) data,
  192. + count=(ssize_t) gzwrite(image->blob->gzfile,(void *) data,
  193. (unsigned int) length);
  194. break;
  195. }
  196. case 2:
  197. {
  198. - c=gzputc(image->blob->file,(int) *p++);
  199. + c=gzputc(image->blob->gzfile,(int) *p++);
  200. if (c == EOF)
  201. break;
  202. count++;
  203. }
  204. case 1:
  205. {
  206. - c=gzputc(image->blob->file,(int) *p++);
  207. + c=gzputc(image->blob->gzfile,(int) *p++);
  208. if (c == EOF)
  209. break;
  210. count++;
  211. @@ -4041,8 +4053,8 @@
  212. case BZipStream:
  213. {
  214. #if defined(MAGICKCORE_BZLIB_DELEGATE)
  215. - count=(ssize_t) BZ2_bzwrite((BZFILE *) image->blob->file,(void *) data,
  216. - (int) length);
  217. + count=(ssize_t) BZ2_bzwrite(image->blob->bzfile,(void *) data,(int)
  218. + length);
  219. #endif
  220. break;
  221. }