Browse Source

Merge pull request #447 from svandecappelle/master

giflib 5.1
v1.x
Nathan Rajlich 10 years ago
parent
commit
cfac76c848
  1. 6
      src/Image.cc
  2. 8
      src/Image.h

6
src/Image.cc

@ -517,7 +517,7 @@ Image::loadGIFFromBuffer(uint8_t *buf, unsigned len) {
#endif
if (GIF_OK != DGifSlurp(gif)) {
DGifCloseFile(gif);
GIF_CLOSE_FILE(gif);
return CAIRO_STATUS_READ_ERROR;
}
@ -526,7 +526,7 @@ Image::loadGIFFromBuffer(uint8_t *buf, unsigned len) {
uint8_t *data = (uint8_t *) malloc(width * height * 4);
if (!data) {
DGifCloseFile(gif);
GIF_CLOSE_FILE(gif);
return CAIRO_STATUS_NO_MEMORY;
}
@ -608,7 +608,7 @@ Image::loadGIFFromBuffer(uint8_t *buf, unsigned len) {
}
}
DGifCloseFile(gif);
GIF_CLOSE_FILE(gif);
// New image surface
_surface = cairo_image_surface_create_for_data(

8
src/Image.h

@ -17,8 +17,16 @@
#ifdef HAVE_GIF
#include <gif_lib.h>
#if GIFLIB_MAJOR > 5 || GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1
#define GIF_CLOSE_FILE(gif) DGifCloseFile(gif, NULL)
#else
#define GIF_CLOSE_FILE(gif) DGifCloseFile(gif)
#endif
#endif
class Image: public node::ObjectWrap {
public:
char *filename;

Loading…
Cancel
Save