diff options
author | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2008-05-11 07:17:29 +0000 |
---|---|---|
committer | Jorg Schuler <jcsjcs@users.sourceforge.net> | 2008-05-11 07:17:29 +0000 |
commit | 9f188ee8a1e8524df0ce1353d54e48d5934f0e43 (patch) | |
tree | 6947112a14808c0192fe61381e9ddde904b4bf95 /src | |
parent | 20bb4a2d6214a89d2838b885b400ab79061fa7a9 (diff) | |
download | libgpod-tmz-9f188ee8a1e8524df0ce1353d54e48d5934f0e43.tar.gz libgpod-tmz-9f188ee8a1e8524df0ce1353d54e48d5934f0e43.tar.xz libgpod-tmz-9f188ee8a1e8524df0ce1353d54e48d5934f0e43.zip |
* src/itdb_photoalbum.c
src/itdb_private.h
src/db-artwork-writer.c: renamed itdb_get_free_photo_id() to
itdb_get_max_photo_id() and implemented Jacob Hoffman-Andrew's
patch about the photo_ids and album_ids being shared.
* tests/test-covers.c: print more info (marginally)
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1971 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src')
-rw-r--r-- | src/db-artwork-writer.c | 4 | ||||
-rw-r--r-- | src/itdb_photoalbum.c | 17 | ||||
-rw-r--r-- | src/itdb_private.h | 2 |
3 files changed, 15 insertions, 8 deletions
diff --git a/src/db-artwork-writer.c b/src/db-artwork-writer.c index 21b6a91..50e65b3 100644 --- a/src/db-artwork-writer.c +++ b/src/db-artwork-writer.c @@ -1086,8 +1086,8 @@ ipod_write_photo_db (Itdb_PhotoDB *photodb) g_free (filename); return -1; } - id_max = itdb_get_free_photo_id( photodb ); - bytes_written = write_mhfd (&db, buf, id_max); + id_max = itdb_get_max_photo_id( photodb ); + bytes_written = write_mhfd (&db, buf, id_max+1); /* Refcount of the shared buffer should drop to 0 and this should * sync buffered data to disk diff --git a/src/itdb_photoalbum.c b/src/itdb_photoalbum.c index 994875e..b55c4d0 100644 --- a/src/itdb_photoalbum.c +++ b/src/itdb_photoalbum.c @@ -309,19 +309,26 @@ void itdb_photodb_free (Itdb_PhotoDB *photodb) -G_GNUC_INTERNAL gint itdb_get_free_photo_id ( Itdb_PhotoDB *db ) +G_GNUC_INTERNAL gint itdb_get_max_photo_id ( Itdb_PhotoDB *db ) { - gint photo_id = 0; + gint max_seen_id = 0; GList *it; for (it = db->photos; it != NULL; it = it->next) { Itdb_Artwork *artwork; artwork = (Itdb_Artwork *)it->data; - if( artwork->id > photo_id ) - photo_id = artwork->id; + if( artwork->id > max_seen_id ) + max_seen_id = artwork->id; } - return photo_id + 1; + for (it = db->photoalbums; it != NULL; it = it->next) { + Itdb_PhotoAlbum *album; + album = (Itdb_PhotoAlbum *)it->data; + if ( album->album_id > max_seen_id ) + max_seen_id = album->album_id; + + } + return max_seen_id; } static void itdb_photodb_photoalbum_free (Itdb_PhotoAlbum *album) diff --git a/src/itdb_private.h b/src/itdb_private.h index 7e9e410..2417423 100644 --- a/src/itdb_private.h +++ b/src/itdb_private.h @@ -146,7 +146,7 @@ G_GNUC_INTERNAL void itdb_splr_free (Itdb_SPLRule *splr); G_GNUC_INTERNAL const gchar *itdb_photodb_get_mountpoint (Itdb_PhotoDB *photodb); G_GNUC_INTERNAL gchar *db_get_mountpoint (Itdb_DB *db); G_GNUC_INTERNAL Itdb_Device *db_get_device(Itdb_DB *db); -G_GNUC_INTERNAL gint itdb_get_free_photo_id ( Itdb_PhotoDB *db ); +G_GNUC_INTERNAL gint itdb_get_max_photo_id ( Itdb_PhotoDB *db ); G_GNUC_INTERNAL Itdb_iTunesDB *db_get_itunesdb (Itdb_DB *db); G_GNUC_INTERNAL Itdb_PhotoDB *db_get_photodb (Itdb_DB *db); G_GNUC_INTERNAL gint itdb_thumb_get_byteorder (ItdbThumbFormat format); |