[tracker/tracker-0.10-no-atime: 14/23] tracker-extract, gif: Don't use a FILE* when we don't have to
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10-no-atime: 14/23] tracker-extract, gif: Don't use a FILE* when we don't have to
- Date: Fri, 23 Sep 2011 11:04:50 +0000 (UTC)
commit cb5e0a753027b8c272b2deea1ce6546228e37689
Author: Philip Van Hoof <philip codeminded be>
Date: Thu Sep 22 17:11:34 2011 +0200
tracker-extract, gif: Don't use a FILE* when we don't have to
Conflicts:
src/tracker-extract/tracker-extract-gif.c
src/tracker-extract/tracker-extract-gif.c | 23 ++++++++++++++++-------
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 b483c39..3d3d184 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 *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]