From 157bddcb019f4cacc1808c4664d4f113d4b08f16 Mon Sep 17 00:00:00 2001
From: Nikias Bassen <nikias@gmx.li>
Date: Mon, 4 Oct 2010 02:00:47 +0200
Subject: [PATCH 3/3] write empty mhsd of type 10
Found since iOS4. We don't know yet what this is for -- this is for
completeness.
---
src/itdb_itunesdb.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c
index 4e2debb..e08988f 100644
--- a/src/itdb_itunesdb.c
+++ b/src/itdb_itunesdb.c
@@ -5655,6 +5655,23 @@ static gboolean write_genius_mhsd (FExport *fexp)
return TRUE;
}
+static gboolean write_mhsd_type10 (FExport *fexp)
+{
+ gulong mhsd_seek;
+ WContents *cts;
+
+ g_return_val_if_fail (fexp, FALSE);
+ g_return_val_if_fail (fexp->itdb, FALSE);
+ g_return_val_if_fail (fexp->wcontents, FALSE);
+
+ cts = fexp->wcontents;
+ mhsd_seek = cts->pos; /* get position of mhsd header */
+ mk_mhsd (fexp, 10); /* write header */
+ mk_mhlt (fexp, 0); /* for now, produce an empty set */
+ fix_header (cts, mhsd_seek);
+ return TRUE;
+}
+
/* create a WContents structure */
static WContents *wcontents_new (const gchar *filename)
{
@@ -5942,7 +5959,7 @@ static gboolean itdb_write_file_internal (Itdb_iTunesDB *itdb,
#endif
/* default mhsd count */
- num_mhsds = 7; /* seven mhsds */
+ num_mhsds = 8; /* eight mhsds */
/* if genius_cuid present, we have one more */
if (fexp->itdb->priv->genius_cuid) {
@@ -6003,6 +6020,15 @@ static gboolean itdb_write_file_internal (Itdb_iTunesDB *itdb,
goto err;
}
+ /* write empty mhsd type 10, whatever it is */
+ if (!fexp->error && !write_mhsd_type10 (fexp)) {
+ g_set_error (&fexp->error,
+ ITDB_FILE_ERROR,
+ ITDB_FILE_ERROR_ITDB_CORRUPT,
+ _("Error writing mhsd type 10"));
+ goto err;
+ }
+
/* write mhsd5 playlists */
if (!fexp->error && !write_mhsd_playlists (fexp, 5)) {
g_set_error (&fexp->error,
--
1.7.3.2