summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Van Hoof <philip@codeminded.be>2011-09-22 17:11:34 +0200
committerPhilip Van Hoof <philip@codeminded.be>2011-09-23 13:00:31 +0200
commitcb5e0a753027b8c272b2deea1ce6546228e37689 (patch)
treee6cee39f000586ebfa5939c3072329846fd7d765
parent3083ffab8617238d97a0e01bd6a9980e11a19e50 (diff)
downloadtracker-cb5e0a753027b8c272b2deea1ce6546228e37689.tar.gz
tracker-extract, gif: Don't use a FILE* when we don't have to
Conflicts: src/tracker-extract/tracker-extract-gif.c
-rw-r--r--src/tracker-extract/tracker-extract-gif.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/tracker-extract/tracker-extract-gif.c b/src/tracker-extract/tracker-extract-gif.c
index b483c39fc..3d3d18471 100644
--- a/src/tracker-extract/tracker-extract-gif.c
+++ b/src/tracker-extract/tracker-extract-gif.c
@@ -24,6 +24,13 @@
#define _GNU_SOURCE
#endif
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
#include <gif_lib.h>
#include <libtracker-common/tracker-common.h>
@@ -544,7 +551,6 @@ extract_gif (const gchar *uri,
goffset size;
GifFileType *gifFile = NULL;
gchar *filename;
- FILE *f;
int fd;
filename = g_filename_from_uri (uri, NULL, NULL);
@@ -555,12 +561,15 @@ extract_gif (const gchar *uri,
return;
}
- f = tracker_file_open (filename);
- if (!f) {
- return;
- }
+ fd = g_open (filename, O_RDONLY | O_NOATIME, 0);
- fd = fileno (f);
+ if (fd == -1) {
+ g_warning ("Could not open gif file '%s': %s\n",
+ filename,
+ g_strerror (errno));
+ g_free (filename);
+ return;
+ }
if ((gifFile = DGifOpenFileHandle (fd)) == NULL) {
PrintGifError ();
@@ -579,7 +588,7 @@ extract_gif (const gchar *uri,
PrintGifError ();
}
- tracker_file_close (f, FALSE);
+ close (fd);
}
TrackerExtractData *