commit ee89ac21a141af2afee278e871d57ee8564554fc
Author: Christophe Fergeau <[email protected]>
Date:   Wed Oct 28 13:24:08 2009 +0100

    get rid of itdb_file_set_contents
    
    It was added as a workaround for a sshfs limitation (used to access
    jailbroken iPhones). With iFuse/libiphone, sshfs is no longer needed, so
    drop this workaround

 src/db-artwork-writer.c |    6 ++--
 src/itdb_itunesdb.c     |   49 +---------------------------------------------
 src/itdb_private.h      |    3 --
 3 files changed, 5 insertions(+), 53 deletions(-)
---
diff --git a/src/db-artwork-writer.c b/src/db-artwork-writer.c
index a3c006e..a828c26 100644
--- a/src/db-artwork-writer.c
+++ b/src/db-artwork-writer.c
@@ -75,9 +75,9 @@ ipod_gstring_flush (struct iPodSharedDataBuffer *shared, 
GError **error)
 {
        gboolean success;
 
-       success = itdb_file_set_contents (shared->filename, 
-                                         shared->data->str, shared->data->len,
-                                         error);
+       success = g_file_set_contents (shared->filename, 
+                                      shared->data->str, shared->data->len,
+                                      error);
        if (!success) {
                 return FALSE;
        }
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c
index e975205..187b73c 100644
--- a/src/itdb_itunesdb.c
+++ b/src/itdb_itunesdb.c
@@ -5359,8 +5359,8 @@ static gboolean wcontents_write (WContents *cts)
     g_return_val_if_fail (cts->filename, FALSE);
 
     cts->error = NULL;
-    return itdb_file_set_contents (cts->filename, cts->contents, 
-                                   cts->pos, &cts->error);
+    return g_file_set_contents (cts->filename, cts->contents, 
+                                cts->pos, &cts->error);
 }
 
 
@@ -6843,51 +6843,6 @@ gboolean itdb_cp (const gchar *from_file, const gchar 
*to_file,
     return FALSE;
 }
 
-
-G_GNUC_INTERNAL gboolean
-itdb_file_set_contents (const char *filename, 
-                        const char *data, gssize len, 
-                        GError **error)
-{
-    gchar *backup;
-    gboolean success;
-
-    /* sshfs (which is used to access iPhones/iTouches) can't successfully
-     * rename a file if the destination file already exist.
-     * We first move away the existing file to workaround that limitation
-     *                            */
-    if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
-        gint result;
-        backup = g_strdup_printf ("%sXXXXXX", filename);
-        result = g_rename (filename, backup);
-        if (result != 0) {
-            g_free (backup);
-            return FALSE;
-        }
-    } else {
-        backup = NULL;
-    }
-
-    success = g_file_set_contents (filename, data, len, error);
-    if (!success) {
-        if (backup != NULL) {
-            g_rename (backup, filename);
-            g_free (backup);
-        }
-        return FALSE;
-    }
-
-    /* File saving was
-     * ok, clean up our
-     * mess */
-    if (backup != NULL) {
-        g_unlink (backup);
-        g_free (backup);
-    }
-
-    return TRUE;
-}
-
 /**
  * itdb_get_control_dir:
  * @mountpoint: the iPod mountpoint
diff --git a/src/itdb_private.h b/src/itdb_private.h
index eab8d24..8793bf8 100644
--- a/src/itdb_private.h
+++ b/src/itdb_private.h
@@ -199,9 +199,6 @@ G_GNUC_INTERNAL time_t device_time_mac_to_time_t 
(Itdb_Device *device,
 G_GNUC_INTERNAL guint64 device_time_time_t_to_mac (Itdb_Device *device,
                                                 time_t timet);
 G_GNUC_INTERNAL gint itdb_musicdirs_number_by_mountpoint (const gchar 
*mountpoint);
-G_GNUC_INTERNAL gboolean itdb_file_set_contents (const char *filename, 
-                                                 const char *data, gssize len, 
-                                                 GError **error);
 G_GNUC_INTERNAL int itdb_sqlite_generate_itdbs(FExport *fexp);
 G_GNUC_INTERNAL gboolean itdb_hash72_extract_hash_info(const Itdb_Device 
*device, 
                                                       unsigned char 
*itdb_data, 

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to