diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/db-artwork-parser.c | 4 | ||||
-rw-r--r-- | src/db-artwork-writer.c | 9 | ||||
-rw-r--r-- | src/itdb_itunesdb.c | 8 | ||||
-rw-r--r-- | src/ithumb-writer.c | 5 |
4 files changed, 22 insertions, 4 deletions
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)); |