libgdiplus0-giflib5.patch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. ---
  2. src/gifcodec.c | 50 +++++++++++++++++++++++++++++++++++++++++---------
  3. 1 file changed, 41 insertions(+), 9 deletions(-)
  4. Index: libgdiplus-2.10.9/src/gifcodec.c
  5. ===================================================================
  6. --- libgdiplus-2.10.9.orig/src/gifcodec.c
  7. +++ libgdiplus-2.10.9/src/gifcodec.c
  8. @@ -105,7 +112,7 @@ gdip_gif_inputfunc (GifFileType *gif, Gi
  9. */
  10. static int
  11. -AddExtensionBlockMono(SavedImage *New, int Len, BYTE ExtData[])
  12. +AddExtensionBlockMono(SavedImage *New, int Len, int func, BYTE ExtData[])
  13. {
  14. ExtensionBlock *ep;
  15. @@ -129,7 +136,7 @@ AddExtensionBlockMono(SavedImage *New, i
  16. if (ExtData) {
  17. memcpy(ep->Bytes, ExtData, Len);
  18. - ep->Function = New->Function;
  19. + ep->Function = func;
  20. }
  21. return (GIF_OK);
  22. @@ -232,20 +239,20 @@ DGifSlurpMono(GifFileType * GifFile, Sav
  23. }
  24. case EXTENSION_RECORD_TYPE: {
  25. - if (DGifGetExtension(GifFile, &temp_save.Function, &ExtData) == GIF_ERROR) {
  26. + int func;
  27. + if (DGifGetExtension(GifFile, &func, &ExtData) == GIF_ERROR) {
  28. return (GIF_ERROR);
  29. }
  30. while (ExtData != NULL) {
  31. /* Create an extension block with our data */
  32. - if (AddExtensionBlockMono(&temp_save, ExtData[0], &ExtData[1]) == GIF_ERROR) {
  33. + if (AddExtensionBlockMono(&temp_save, func, ExtData[0], &ExtData[1]) == GIF_ERROR) {
  34. return (GIF_ERROR);
  35. }
  36. if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR) {
  37. return (GIF_ERROR);
  38. }
  39. - temp_save.Function = 0;
  40. }
  41. break;
  42. }
  43. @@ -303,12 +310,19 @@ gdip_load_gif_image (void *stream, GpIma
  44. result = NULL;
  45. loop_counter = FALSE;
  46. +#if GIFLIB_MAJOR < 5
  47. if (from_file) {
  48. gif = DGifOpen(stream, &gdip_gif_fileinputfunc);
  49. } else {
  50. gif = DGifOpen (stream, &gdip_gif_inputfunc);
  51. }
  52. -
  53. +#else
  54. + if (from_file)
  55. + gif = DGifOpen(stream, &gdip_gif_fileinputfunc, NULL);
  56. + else
  57. + gif = DGifOpen(stream, &gdip_gif_inputfunc, NULL);
  58. +#endif
  59. +
  60. if (gif == NULL) {
  61. goto error;
  62. }
  63. @@ -581,7 +595,7 @@ gdip_load_gif_image (void *stream, GpIma
  64. }
  65. FreeExtensionMono(&global_extensions);
  66. - DGifCloseFile (gif);
  67. + DGifCloseFile (gif, NULL);
  68. *image = result;
  69. return Ok;
  70. @@ -597,7 +611,7 @@ error:
  71. if (gif != NULL) {
  72. FreeExtensionMono (&global_extensions);
  73. - DGifCloseFile (gif);
  74. + DGifCloseFile (gif, NULL);
  75. }
  76. *image = NULL;
  77. @@ -660,11 +674,22 @@ gdip_save_gif_image (void *stream, GpIma
  78. return InvalidParameter;
  79. }
  80. +#if GIFLIB_MAJOR < 5
  81. if (from_file) {
  82. fp = EGifOpenFileName (stream, 0);
  83. } else {
  84. fp = EGifOpen (stream, gdip_gif_outputfunc);
  85. }
  86. +#else
  87. + if (from_file)
  88. + fp = EGifOpenFileName (stream, 0, NULL);
  89. + else
  90. + fp = EGifOpen (stream, gdip_gif_outputfunc, NULL);
  91. +#define MakeMapObject GifMakeMapObject
  92. +#define FreeMapObject GifFreeMapObject
  93. +#define QuantizeBuffer GifQuantizeBuffer
  94. +#define BitSize GifBitSize
  95. +#endif
  96. if (!fp) {
  97. return FileNotFound;
  98. @@ -848,8 +873,15 @@ gdip_save_gif_image (void *stream, GpIma
  99. Buffer[0] = 1;
  100. Buffer[1] = ptr[0];
  101. Buffer[2] = ptr[1];
  102. +#if GIFLIB_MAJOR < 5
  103. EGifPutExtensionFirst(fp, APPLICATION_EXT_FUNC_CODE, 11, "NETSCAPE2.0");
  104. EGifPutExtensionLast(fp, APPLICATION_EXT_FUNC_CODE, 3, Buffer);
  105. +#else
  106. + EGifPutExtensionLeader(fp, APPLICATION_EXT_FUNC_CODE);
  107. + EGifPutExtensionBlock(fp, 11, "NETSCAPE2.0");
  108. + EGifPutExtensionBlock(fp, 3, Buffer);
  109. + EGifPutExtensionTrailer(fp);
  110. +#endif
  111. }
  112. }
  113. @@ -923,7 +955,7 @@ gdip_save_gif_image (void *stream, GpIma
  114. }
  115. }
  116. - EGifCloseFile (fp);
  117. + EGifCloseFile (fp, NULL);
  118. return Ok;