diff options
author | Philip Van Hoof <philip@codeminded.be> | 2011-09-22 17:10:20 +0200 |
---|---|---|
committer | Philip Van Hoof <philip@codeminded.be> | 2011-09-23 12:59:02 +0200 |
commit | 3083ffab8617238d97a0e01bd6a9980e11a19e50 (patch) | |
tree | 90b08df87fb397229e53a59af8a12fc3861cc7c1 | |
parent | e1bbc9e7de901420f79b631ed4c55489029e3164 (diff) | |
download | tracker-3083ffab8617238d97a0e01bd6a9980e11a19e50.tar.gz |
tracker-extract, tiff: Don't use a FILE* when we don't have to
Conflicts:
src/tracker-extract/tracker-extract-tiff.c
-rw-r--r-- | src/tracker-extract/tracker-extract-tiff.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c index 7e2d44a96..ae248ab68 100644 --- a/src/tracker-extract/tracker-extract-tiff.c +++ b/src/tracker-extract/tracker-extract-tiff.c @@ -20,6 +20,17 @@ #include "config.h" +#ifndef _GNU_SOURCE +#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 <glib/gstdio.h> #include <tiffio.h> @@ -269,7 +280,6 @@ extract_tiff (const gchar *uri, GPtrArray *keywords; guint i; GString *where = NULL; - FILE *mfile = NULL; int fd; #ifdef HAVE_LIBIPTCDATA @@ -284,18 +294,20 @@ extract_tiff (const gchar *uri, filename = g_filename_from_uri (uri, NULL, NULL); - mfile = tracker_file_open (filename); - - if (!mfile) { - return; - } + fd = g_open (filename, O_RDONLY | O_NOATIME, 0); - fd = fileno (mfile); + if (fd == -1) { + g_warning ("Could not open tiff file '%s': %s\n", + filename, + g_strerror (errno)); + g_free (filename); + return; + } if ((image = TIFFFdOpen (fd, filename, "r")) == NULL){ g_warning ("Could not open image:'%s'\n", filename); g_free (filename); - tracker_file_close (mfile, FALSE); + close (fd); return; } @@ -785,10 +797,7 @@ extract_tiff (const gchar *uri, tracker_exif_free (ed); tracker_xmp_free (xd); tracker_iptc_free (id); - - if (mfile) { - tracker_file_close (mfile, FALSE); - } + close (fd); } TrackerExtractData * |