Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. --- mapserver-6.2.1.orig/mapimageio.c 2013-04-19 21:08:49.000000000 -0700
  2. +++ mapserver-6.2.1/mapimageio.c 2015-01-30 16:47:46.000000000 -0800
  3. @@ -994,11 +994,18 @@
  4. }
  5. }
  6. #ifdef USE_GIF
  7. +#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
  8. +#define gif_error_msg() _gif_error_msg(image->Error)
  9. +static char const *_gif_error_msg(int code)
  10. +#else
  11. static char const *gif_error_msg()
  12. +#endif
  13. {
  14. static char msg[80];
  15.  
  16. +#if !(defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5)
  17. int code = GifLastError();
  18. +#endif
  19. switch (code) {
  20. case E_GIF_ERR_OPEN_FAILED: /* should not see this */
  21. return "Failed to open given file";
  22. @@ -1075,7 +1082,6 @@
  23. }
  24. }
  25.  
  26. -
  27. /* not fully implemented and tested */
  28. /* missing: set the first pointer to a,r,g,b */
  29. int readGIF(char *path, rasterBufferObj *rb)
  30. @@ -1092,12 +1098,21 @@
  31. int interlacedJumps[] = {8,8,4,2};
  32.  
  33.  
  34. - rb->type = MS_BUFFER_BYTE_RGBA;
  35. +#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
  36. + int err = 0;
  37. + image = DGifOpenFileName(path, &err);
  38. + if (image == NULL) {
  39. + msSetError(MS_MISCERR,"failed to load gif image: %s","readGIF()", _gif_error_msg(err));
  40. + return MS_FAILURE;
  41. + }
  42. +#else
  43. image = DGifOpenFileName(path);
  44. if (image == NULL) {
  45. msSetError(MS_MISCERR,"failed to load gif image: %s","readGIF()", gif_error_msg());
  46. return MS_FAILURE;
  47. }
  48. +#endif
  49. + rb->type = MS_BUFFER_BYTE_RGBA;
  50. rb->width = image->SWidth;
  51. rb->height = image->SHeight;
  52. rb->data.rgba.row_step = rb->width * 4;
  53. @@ -1253,11 +1268,17 @@
  54.  
  55. } while (recordType != TERMINATE_RECORD_TYPE);
  56.  
  57. +#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
  58. + if (DGifCloseFile(image, &err) == GIF_ERROR) {
  59. + msSetError(MS_MISCERR,"failed to close gif after loading: %s","readGIF()", _gif_error_msg(err));
  60. + return MS_FAILURE;
  61. + }
  62. +#else
  63. if (DGifCloseFile(image) == GIF_ERROR) {
  64. msSetError(MS_MISCERR,"failed to close gif after loading: %s","readGIF()", gif_error_msg());
  65. return MS_FAILURE;
  66. }
  67. -
  68. +#endif
  69. return MS_SUCCESS;
  70. }
  71. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement