[tracker] tracker-extract: Add support for giflib 5.
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-extract: Add support for giflib 5.
- Date: Thu, 14 Mar 2013 16:42:50 +0000 (UTC)
commit a4cb0a7b084e1f298e18b84bec0a4ddfbe8db6d0
Author: Dominique Leuenberger <dimstar opensuse org>
Date: Wed Mar 13 13:58:41 2013 +0100
tracker-extract: Add support for giflib 5.
https://bugzilla.gnome.org/show_bug.cgi?id=695769
src/tracker-extract/tracker-extract-gif.c | 43 ++++++++++++++++++++++++++---
1 files changed, 39 insertions(+), 4 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gif.c b/src/tracker-extract/tracker-extract-gif.c
index ce69ed4..cfb4722 100644
--- a/src/tracker-extract/tracker-extract-gif.c
+++ b/src/tracker-extract/tracker-extract-gif.c
@@ -57,8 +57,6 @@ typedef struct {
char *bytes;
} ExtBlock;
-
-
static int
ext_block_append(ExtBlock *extBlock,
unsigned int len,
@@ -75,6 +73,19 @@ ext_block_append(ExtBlock *extBlock,
return (GIF_OK);
}
+#if GIFLIB_MAJOR >= 5
+static inline void
+gif_error (const gchar *action, int err)
+{
+ const char *str = GifErrorString (err);
+ if (str != NULL) {
+ g_message ("%s, error: '%s'", action, str);
+ } else {
+ g_message ("%s, undefined error %d", action, err);
+ }
+}
+#endif /* GIFLIB_MAJOR >= 5 */
+
static void
read_metadata (TrackerSparqlBuilder *preupdate,
TrackerSparqlBuilder *metadata,
@@ -100,14 +111,22 @@ read_metadata (TrackerSparqlBuilder *preupdate,
ExtBlock extBlock;
if (DGifGetRecordType(gifFile, &RecordType) == GIF_ERROR) {
- PrintGifError();
+#if GIFLIB_MAJOR < 5
+ PrintGifError ();
+#else /* GIFLIB_MAJOR < 5 */
+ gif_error ("Could not read next GIF record type", gifFile->Error);
+#endif /* GIFLIB_MAJOR < 5 */
return;
}
switch (RecordType) {
case IMAGE_DESC_RECORD_TYPE:
if (DGifGetImageDesc(gifFile) == GIF_ERROR) {
+#if GIFLIB_MAJOR < 5
PrintGifError();
+#else /* GIFLIB_MAJOR < 5 */
+ gif_error ("Could not get GIF record information", gifFile->Error);
+#endif /* GIFLIB_MAJOR < 5 */
return;
}
@@ -117,7 +136,11 @@ read_metadata (TrackerSparqlBuilder *preupdate,
framedata = g_malloc (framewidth*frameheight);
if (DGifGetLine(gifFile, framedata, framewidth*frameheight)==GIF_ERROR) {
+#if GIFLIB_MAJOR < 5
PrintGifError();
+#else /* GIFLIB_MAJOR < 5 */
+ gif_error ("Could not load a block of GIF pixes", gifFile->Error);
+#endif /* GIFLIB_MAJOR < 5 */
return;
}
@@ -593,6 +616,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);
@@ -610,15 +636,20 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
fd = tracker_file_open_fd (filename);
if (fd == -1) {
- g_warning ("Could not open gif file '%s': %s\n",
+ g_warning ("Could not open GIF file '%s': %s\n",
filename,
g_strerror (errno));
g_free (filename);
return FALSE;
}
+#if GIFLIB_MAJOR < 5
if ((gifFile = DGifOpenFileHandle (fd)) == NULL) {
PrintGifError ();
+#else /* GIFLIB_MAJOR < 5 */
+ if ((gifFile = DGifOpenFileHandle (fd, &err)) == NULL) {
+ gif_error ("Could not open GIF file with handle", err);
+#endif /* GIFLIB_MAJOR < 5 */
close (fd);
return FALSE;
}
@@ -639,7 +670,11 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
g_free (uri);
if (DGifCloseFile (gifFile) != GIF_OK) {
+#if GIFLIB_MAJOR < 5
PrintGifError ();
+#else /* GIFLIB_MAJOR < 5 */
+ gif_error ("Could not close GIF file", gifFile->Error);
+#endif /* GIFLIB_MAJOR < 5 */
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]