forked from pool/tracker
Fix build against giflib 5 OBS-URL: https://build.opensuse.org/request/show/159151 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/tracker?expand=0&rev=28
95 lines
2.3 KiB
Diff
95 lines
2.3 KiB
Diff
diff --git a/src/tracker-extract/tracker-extract-gif.c b/src/tracker-extract/tracker-extract-gif.c
|
|
index ce69ed4..e0d1e88 100644
|
|
--- a/src/tracker-extract/tracker-extract-gif.c
|
|
+++ b/src/tracker-extract/tracker-extract-gif.c
|
|
@@ -75,6 +75,18 @@ ext_block_append(ExtBlock *extBlock,
|
|
return (GIF_OK);
|
|
}
|
|
|
|
+#if GIFLIB_MAJOR >= 5
|
|
+static void
|
|
+gif_error(int err)
|
|
+{
|
|
+ const char * Err = GifErrorString(err);
|
|
+ if (Err != NULL)
|
|
+ fprintf(stderr, "\nGIF-LIB error: %s.\n", Err);
|
|
+ else
|
|
+ fprintf(stderr, "\nGIF-LIB undefined error %d.\n", err);
|
|
+}
|
|
+#endif
|
|
+
|
|
static void
|
|
read_metadata (TrackerSparqlBuilder *preupdate,
|
|
TrackerSparqlBuilder *metadata,
|
|
@@ -100,14 +112,22 @@ read_metadata (TrackerSparqlBuilder *preupdate,
|
|
ExtBlock extBlock;
|
|
|
|
if (DGifGetRecordType(gifFile, &RecordType) == GIF_ERROR) {
|
|
+#if GIFLIB_MAJOR < 5
|
|
PrintGifError();
|
|
+#else
|
|
+ gif_error(gifFile->Error);
|
|
+#endif
|
|
return;
|
|
}
|
|
|
|
switch (RecordType) {
|
|
case IMAGE_DESC_RECORD_TYPE:
|
|
if (DGifGetImageDesc(gifFile) == GIF_ERROR) {
|
|
+#if GIFLIB_MAJOR < 5
|
|
PrintGifError();
|
|
+#else
|
|
+ gif_error(gifFile->Error);
|
|
+#endif
|
|
return;
|
|
}
|
|
|
|
@@ -117,7 +137,11 @@ read_metadata (TrackerSparqlBuilder *preupdate,
|
|
framedata = g_malloc (framewidth*frameheight);
|
|
|
|
if (DGifGetLine(gifFile, framedata, framewidth*frameheight)==GIF_ERROR) {
|
|
+#if GIFLIB_MAJOR < 5
|
|
PrintGifError();
|
|
+#else
|
|
+ gif_error(gifFile->Error);
|
|
+#endif
|
|
return;
|
|
}
|
|
|
|
@@ -593,6 +617,9 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
|
|
gchar *filename, *uri;
|
|
GFile *file;
|
|
int fd;
|
|
+#if GIFLIB_MAJOR >= 5
|
|
+ int err;
|
|
+#endif
|
|
|
|
preupdate = tracker_extract_info_get_preupdate_builder (info);
|
|
metadata = tracker_extract_info_get_metadata_builder (info);
|
|
@@ -617,8 +644,13 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
|
|
return FALSE;
|
|
}
|
|
|
|
+#if GIFLIB_MAJOR < 5
|
|
if ((gifFile = DGifOpenFileHandle (fd)) == NULL) {
|
|
PrintGifError ();
|
|
+#else
|
|
+ if ((gifFile = DGifOpenFileHandle (fd, &err)) == NULL) {
|
|
+ gif_error(err);
|
|
+#endif
|
|
close (fd);
|
|
return FALSE;
|
|
}
|
|
@@ -639,7 +671,11 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
|
|
g_free (uri);
|
|
|
|
if (DGifCloseFile (gifFile) != GIF_OK) {
|
|
+#if GIFLIB_MAJOR < 5
|
|
PrintGifError ();
|
|
+#else
|
|
+ gif_error(gifFile->Error);
|
|
+#endif
|
|
}
|
|
|
|
return TRUE;
|