[tracker] tracker-extract, tiff: Use O_NOATIME for opening tiff files



commit 8c687c9d7cb6ad40e856b2129167e43a7dae7583
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Sep 22 11:42:25 2011 +0200

    tracker-extract, tiff: Use O_NOATIME for opening tiff files

 src/tracker-extract/tracker-extract-tiff.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index 72878a6..e1190ff 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -261,6 +261,8 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 	TrackerSparqlBuilder *metadata, *preupdate;
 	const gchar *graph;
 	GString *where;
+	FILE *mfile = NULL;
+	int fd;
 
 #ifdef HAVE_LIBIPTCDATA
 	gchar *iptc_offset;
@@ -279,9 +281,18 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 	metadata = tracker_extract_info_get_metadata_builder (info);
 	graph = tracker_extract_info_get_graph (info);
 
-	if ((image = TIFFOpen (filename, "r")) == NULL){
+	mfile = tracker_file_open (filename);
+	
+	if (!mfile) {
+		return FALSE;
+	}
+
+	fd = fileno (mfile);
+
+	if ((image = TIFFFdOpen (fd, filename, "r")) == NULL){
 		g_warning ("Could not open image:'%s'\n", filename);
 		g_free (filename);
+		tracker_file_close (mfile, FALSE);
 		return FALSE;
 	}
 
@@ -834,5 +845,9 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 	tracker_iptc_free (id);
 	g_free (uri);
 
+	if (mfile) {
+		tracker_file_close (mfile, FALSE);
+	}
+
 	return TRUE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]