summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <teuf@gnome.org>2005-09-27 07:25:25 +0000
committerChristophe Fergeau <teuf@gnome.org>2005-09-27 07:25:25 +0000
commit5d38cbffd827dd36c7e7f91580ec31da9ebaf92d (patch)
tree9b7b473b8e72733ac29a6e6bd7d68f140c55f442
parent6a0e830586380aafe71e9709814624057e21ca79 (diff)
downloadlibgpod-tmz-5d38cbffd827dd36c7e7f91580ec31da9ebaf92d.tar.gz
libgpod-tmz-5d38cbffd827dd36c7e7f91580ec31da9ebaf92d.tar.xz
libgpod-tmz-5d38cbffd827dd36c7e7f91580ec31da9ebaf92d.zip
2005-09-27 Christophe Fergeau <teuf@gnome.org>
* src/itdb_itunesdb.c: (write_mhsd_tracks), (write_playlist_mhips), (write_podcast_mhips): move variable declaration before code to fix compilation * src/db-artwork-parser.c: (ipod_parse_artwork_db): * src/db-artwork-writer.c: (ipod_write_artwork_db): * src/ithumb-writer.c: (ithumb_writer_new): added some sanity checks git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1103 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r--ChangeLog10
-rw-r--r--src/db-artwork-parser.c4
-rw-r--r--src/db-artwork-writer.c9
-rw-r--r--src/itdb_itunesdb.c8
-rw-r--r--src/ithumb-writer.c5
5 files changed, 32 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 92ee788..8d7e3a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-09-27 Christophe Fergeau <teuf@gnome.org>
+
+ * src/itdb_itunesdb.c: (write_mhsd_tracks), (write_playlist_mhips),
+ (write_podcast_mhips): move variable declaration before code to fix
+ compilation
+ * src/db-artwork-parser.c: (ipod_parse_artwork_db):
+ * src/db-artwork-writer.c: (ipod_write_artwork_db):
+ * src/ithumb-writer.c: (ithumb_writer_new): added some sanity checks
+ to detect better when the iPod doesn't have any artwork data
+
2005-09-24 Jorg Schuler <jcsjcs at users.sourceforge.net>
* itdb.h/itdb_playlist.c: new functions: itdb_playlist_is_mpl()
diff --git a/src/db-artwork-parser.c b/src/db-artwork-parser.c
index 8c41dd6..7cc7b82 100644
--- a/src/db-artwork-parser.c
+++ b/src/db-artwork-parser.c
@@ -352,7 +352,11 @@ ipod_parse_artwork_db (Itdb_iTunesDB *db)
DBParseContext *ctx;
char *filename;
+ ctx = NULL;
filename = ipod_db_get_artwork_db_path (db->mountpoint);
+ if (filename == NULL) {
+ goto error;
+ }
ctx = db_parse_context_new_from_file (filename);
g_free (filename);
if (ctx == NULL) {
diff --git a/src/db-artwork-writer.c b/src/db-artwork-writer.c
index cb97b7a..c87bffa 100644
--- a/src/db-artwork-writer.c
+++ b/src/db-artwork-writer.c
@@ -730,11 +730,18 @@ ipod_write_artwork_db (Itdb_iTunesDB *db, const char *mount_point)
* 'artwork_size' fields, as well as the 2 Itdb_Image fields
*/
itdb_write_ithumb_files (db, mount_point);
- g_print ("%s\n", G_GNUC_FUNCTION);
/* Now we can update the ArtworkDB file */
id_max = ipod_artwork_db_set_ids (db);
+ /* FIXME: need to create the file if it doesn't exist */
filename = ipod_db_get_artwork_db_path (mount_point);
+ if (filename == NULL) {
+ /* FIXME: the iTunesDB will be inconsistent wrt artwork_count
+ * it might be better to 0 out this field in all tracks
+ * when we encounter an error
+ */
+ return -1;
+ }
buf = ipod_buffer_new (filename);
if (buf == NULL) {
g_print ("Couldn't create %s\n", filename);
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c
index 0a55075..d853d67 100644
--- a/src/itdb_itunesdb.c
+++ b/src/itdb_itunesdb.c
@@ -3022,10 +3022,10 @@ static gboolean write_mhsd_tracks (FExport *fexp)
{
Itdb_Track *track = gl->data;
guint32 mhod_num = 0;
+ gulong mhit_seek = cts->pos;
g_return_val_if_fail (track, FALSE);
- gulong mhit_seek = cts->pos;
mk_mhit (cts, track);
if (track->title && *track->title)
@@ -3132,9 +3132,10 @@ static gboolean write_playlist_mhips (FExport *fexp,
for (gl=pl->members; gl; gl=gl->next)
{
Itdb_Track *track = gl->data;
+ glong mhip_seek = cts->pos;
+
g_return_val_if_fail (track, FALSE);
- glong mhip_seek = cts->pos;
mk_mhip (fexp, 1, 0, 0, track->id, 0, 0);
mk_mhod (cts, MHOD_ID_PLAYLIST, (void *)i);
/* note: with iTunes 4.9 the mhod is counted as a child to
@@ -3202,9 +3203,10 @@ static gboolean write_podcast_mhips (FExport *fexp,
for (gl=*memberlist; gl; gl=gl->next)
{
Itdb_Track *track = gl->data;
- g_return_if_fail (track);
guint32 mhip_id;
+ g_return_if_fail (track);
+
mhip_seek = cts->pos;
mhip_id = itdb->next_id++;
mk_mhip (fexp, 1, 0, mhip_id, track->id, 0, groupid);
diff --git a/src/ithumb-writer.c b/src/ithumb-writer.c
index 99c2f7a..671d96c 100644
--- a/src/ithumb-writer.c
+++ b/src/ithumb-writer.c
@@ -208,6 +208,11 @@ ithumb_writer_new (const char *mount_point, enum ItdbImageType type,
return NULL;
}
filename = ipod_image_get_ithmb_filename (mount_point, correlation_id);
+ if (filename == NULL) {
+ g_hash_table_destroy (writer->cache);
+ g_free (writer);
+ return NULL;
+ }
writer->f = fopen (filename, "w");
if (writer->f == NULL) {
g_print ("Error opening %s: %s\n", filename, strerror (errno));