[tracker/tracker-0.10-no-atime: 6/23] libtracker-common, tracker-extract: Change the internal tracker_file_open API
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10-no-atime: 6/23] libtracker-common, tracker-extract: Change the internal tracker_file_open API
- Date: Fri, 23 Sep 2011 11:04:10 +0000 (UTC)
commit 4f16ccd3ea204cc0f29190fbba19d830c346aa84
Author: Philip Van Hoof <philip codeminded be>
Date: Wed Sep 21 17:35:48 2011 +0200
libtracker-common, tracker-extract: Change the internal tracker_file_open API
Conflicts:
src/tracker-extract/tracker-extract-vorbis.c
src/libtracker-common/tracker-file-utils.c | 14 ++++----------
src/libtracker-common/tracker-file-utils.h | 4 +---
src/tracker-extract/tracker-extract-jpeg.c | 2 +-
src/tracker-extract/tracker-extract-png.c | 2 +-
src/tracker-extract/tracker-extract-ps.c | 2 +-
src/tracker-extract/tracker-extract-vorbis.c | 5 ++++-
src/tracker-extract/tracker-gsf.c | 2 +-
7 files changed, 13 insertions(+), 18 deletions(-)
---
diff --git a/src/libtracker-common/tracker-file-utils.c b/src/libtracker-common/tracker-file-utils.c
index e6a0280..f60e624 100644
--- a/src/libtracker-common/tracker-file-utils.c
+++ b/src/libtracker-common/tracker-file-utils.c
@@ -51,30 +51,24 @@
static GHashTable *file_locks = NULL;
FILE *
-tracker_file_open (const gchar *path,
- const gchar *how,
- gboolean sequential)
+tracker_file_open (const gchar *path)
{
FILE *file;
- gboolean readonly;
int fd;
g_return_val_if_fail (path != NULL, NULL);
- g_return_val_if_fail (how != NULL, NULL);
-
- readonly = !strstr (how, "r+") && strchr (how, 'r');
#if defined(__linux__)
- fd = g_open (path, (readonly ? O_RDONLY : O_RDWR) | O_NOATIME);
+ fd = g_open (path, O_RDONLY | O_NOATIME);
#else
- fd = g_open (path, readonly ? O_RDONLY : O_RDWR);
+ fd = g_open (path, O_RDONLY);
#endif
if (fd == -1) {
return NULL;
}
- file = fdopen (fd, how);
+ file = fdopen (fd, "r");
if (!file) {
return NULL;
diff --git a/src/libtracker-common/tracker-file-utils.h b/src/libtracker-common/tracker-file-utils.h
index 6c5be1e..d3a8bc8 100644
--- a/src/libtracker-common/tracker-file-utils.h
+++ b/src/libtracker-common/tracker-file-utils.h
@@ -32,9 +32,7 @@ G_BEGIN_DECLS
#endif
/* File utils */
-FILE* tracker_file_open (const gchar *path,
- const gchar *how,
- gboolean sequential);
+FILE* tracker_file_open (const gchar *path);
void tracker_file_close (FILE *file,
gboolean need_again_soon);
goffset tracker_file_get_size (const gchar *path);
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index dd856cf..149bd30 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -178,7 +178,7 @@ extract_jpeg (const gchar *uri,
return;
}
- f = tracker_file_open (filename, "rb", FALSE);
+ f = tracker_file_open (filename);
g_free (filename);
if (!f) {
diff --git a/src/tracker-extract/tracker-extract-png.c b/src/tracker-extract/tracker-extract-png.c
index 538c4a0..1f832d8 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -768,7 +768,7 @@ extract_png (const gchar *uri,
return;
}
- f = tracker_file_open (filename, "r", FALSE);
+ f = tracker_file_open (filename);
g_free (filename);
if (!f) {
diff --git a/src/tracker-extract/tracker-extract-ps.c b/src/tracker-extract/tracker-extract-ps.c
index fcd24a4..a9f0649 100644
--- a/src/tracker-extract/tracker-extract-ps.c
+++ b/src/tracker-extract/tracker-extract-ps.c
@@ -222,7 +222,7 @@ extract_ps (const gchar *uri,
gchar *filename;
filename = g_filename_from_uri (uri, NULL, NULL);
- f = tracker_file_open (filename, "r", TRUE);
+ f = tracker_file_open (filename);
g_free (filename);
if (!f) {
diff --git a/src/tracker-extract/tracker-extract-vorbis.c b/src/tracker-extract/tracker-extract-vorbis.c
index 0108fcc..e0d8d72 100644
--- a/src/tracker-extract/tracker-extract-vorbis.c
+++ b/src/tracker-extract/tracker-extract-vorbis.c
@@ -111,7 +111,10 @@ extract_vorbis (const char *uri,
gint time;
filename = g_filename_from_uri (uri, NULL, NULL);
- f = tracker_file_open (filename, "r", FALSE);
+
+ file = tracker_extract_info_get_file (info);
+ filename = g_file_get_path (file);
+ f = tracker_file_open (filename);
g_free (filename);
if (!f) {
diff --git a/src/tracker-extract/tracker-gsf.c b/src/tracker-extract/tracker-gsf.c
index a715d6c..b33aeba 100644
--- a/src/tracker-extract/tracker-gsf.c
+++ b/src/tracker-extract/tracker-gsf.c
@@ -102,7 +102,7 @@ tracker_gsf_parse_xml_in_zip (const gchar *zip_file_uri,
zip_file_uri, error ? error->message : "no error given");
} else { /* Create a new Input GSF object for the given file */
- file = tracker_file_open (filename, "rb", FALSE);
+ file = tracker_file_open (filename);
if (!file) {
g_warning ("Can't open file from uri '%s': %s",
zip_file_uri, g_strerror (errno));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]