diff options
author | Christophe Fergeau <teuf@gnome.org> | 2007-10-07 11:33:30 +0000 |
---|---|---|
committer | Christophe Fergeau <teuf@gnome.org> | 2007-10-07 11:33:30 +0000 |
commit | b08a8f2aa63218b9e9d6baeb116dc3280574aa73 (patch) | |
tree | 3e73ca8d96ce70c2c1636953c25e8706db08cfdc | |
parent | 69fbd48465a71730c384540d0151fd43ba829f87 (diff) | |
download | libgpod-b08a8f2aa63218b9e9d6baeb116dc3280574aa73.tar.gz libgpod-b08a8f2aa63218b9e9d6baeb116dc3280574aa73.tar.xz libgpod-b08a8f2aa63218b9e9d6baeb116dc3280574aa73.zip |
* src/itdb_device.c: (itdb_device_requires_checksum):
* src/itdb_itunesdb.c: (write_db_checksum):
* src/itdb_private.h: add an itdb_device_requires_checksum function so
that we only error out because of checksum writing issues on ipods which
require a checksum. Ideally, we should restore the old file when there is
a fatal checksum writing error, but libgpod isn't currently doing that
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1722 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/itdb_device.c | 22 | ||||
-rw-r--r-- | src/itdb_itunesdb.c | 4 | ||||
-rw-r--r-- | src/itdb_private.h | 1 |
4 files changed, 34 insertions, 2 deletions
@@ -1,3 +1,12 @@ +2007-10-07 Christophe Fergeau <teuf@gnome.org> + + * src/itdb_device.c: (itdb_device_requires_checksum): + * src/itdb_itunesdb.c: (write_db_checksum): + * src/itdb_private.h: add an itdb_device_requires_checksum function so + that we only error out because of checksum writing issues on ipods which + require a checksum. Ideally, we should restore the old file when there is + a fatal checksum writing error, but libgpod isn't currently doing that + 2007-10-05 Christophe Fergeau <teuf@gnome.org> * src/itdb_sha1.c: (generate_key): move cryptic calculations diff --git a/src/itdb_device.c b/src/itdb_device.c index 62391db..b4c5584 100644 --- a/src/itdb_device.c +++ b/src/itdb_device.c @@ -1061,3 +1061,25 @@ guint64 itdb_device_get_firewire_id (Itdb_Device *device) } return g_ascii_strtoull (fwid, NULL, 16); } + +G_GNUC_INTERNAL gboolean itdb_device_requires_checksum (Itdb_Device *device) +{ + const Itdb_IpodInfo *info; + + if (device == NULL) { + return FALSE; + } + + info = itdb_device_get_ipod_info (device); + if (info == NULL) { + return FALSE; + } + switch (info->ipod_generation) { + case ITDB_IPOD_GENERATION_CLASSIC_1: + return TRUE; + case ITDB_IPOD_GENERATION_NANO_3: + return TRUE; + default: + return FALSE; + } +} diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c index 360e27d..a31de38 100644 --- a/src/itdb_itunesdb.c +++ b/src/itdb_itunesdb.c @@ -4867,9 +4867,9 @@ static gboolean write_db_checksum (FExport *fexp, GError **error) unsigned char *itdb_data; unsigned char *checksum; gsize len; - + fwid = itdb_device_get_firewire_id (fexp->itdb->device); - if (fwid == 0) { + if ((fwid == 0) && (itdb_device_requires_checksum (fexp->itdb->device))) { g_set_error (error, 0, -1, "Couldn't find the iPod firewire ID"); return FALSE; } diff --git a/src/itdb_private.h b/src/itdb_private.h index f3951bb..e87dc67 100644 --- a/src/itdb_private.h +++ b/src/itdb_private.h @@ -156,4 +156,5 @@ 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_device_requires_checksum (Itdb_Device *device); #endif |