diff options
author | teuf <teuf@f01d2545-417e-4e96-918e-98f8d0dbbcb6> | 2008-02-03 18:53:28 +0000 |
---|---|---|
committer | teuf <teuf@f01d2545-417e-4e96-918e-98f8d0dbbcb6> | 2008-02-03 18:53:28 +0000 |
commit | 1ac42a5cd781a2e281b60408d8b7ca5c285c0abe (patch) | |
tree | 527c22eac1060b47e5435ad3e803133912932485 /src | |
parent | 1cb24d2920330218609c86332fa96bc66b726879 (diff) | |
download | libgpod-tmz-1ac42a5cd781a2e281b60408d8b7ca5c285c0abe.tar.gz libgpod-tmz-1ac42a5cd781a2e281b60408d8b7ca5c285c0abe.tar.xz libgpod-tmz-1ac42a5cd781a2e281b60408d8b7ca5c285c0abe.zip |
Add comment about fields that aren't byteswapped, remove hardcoded int
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1946 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src')
-rw-r--r-- | src/db-artwork-parser.c | 2 | ||||
-rw-r--r-- | src/db-artwork-writer.c | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/db-artwork-parser.c b/src/db-artwork-parser.c index 94fc874..cf74777 100644 --- a/src/db-artwork-parser.c +++ b/src/db-artwork-parser.c @@ -375,7 +375,7 @@ parse_mhba (DBParseContext *ctx, GError *error) { /* FIXME: type==1 is album name. type==2 seems to be * the transtition type between photos, * e.g. "Dissolve". Not handled yet. */ - case 1: + case MHOD_ARTWORK_TYPE_ALBUM_NAME: album->name = g_strndup ((gchar *)mhod1->string, get_gint32(mhod1->string_len, ctx->byte_order)); dump_mhod_type_1 (mhod1); diff --git a/src/db-artwork-writer.c b/src/db-artwork-writer.c index 827bcdf..4d4088b 100644 --- a/src/db-artwork-writer.c +++ b/src/db-artwork-writer.c @@ -304,13 +304,15 @@ write_mhod_type_3 (gchar *string, iPodBuffer *buffer) return -1; } - mhod->encoding = 2; + mhod->encoding = 2; /* 8 bit field, no need to byteswap */ + /* number of bytes of the string encoded in UTF-16 */ mhod->string_len = get_gint32 (g2l * len, buffer->byte_order); padding = 4 - ( (total_bytes + g2l*len) % 4 ); if (padding == 4) padding = 0; - mhod->padding_len = padding; + mhod->padding_len = padding; /* 8 bit field, no need to byteswap */ + total_bytes += g2l*len + padding; /* Make sure we have enough free space to write the string */ @@ -327,7 +329,7 @@ write_mhod_type_3 (gchar *string, iPodBuffer *buffer) g_free (utf16); break; case G_BIG_ENDIAN: - mhod->encoding = 1; + mhod->encoding = 1; /* 8 bit field, no need to byteswap */ /* FIXME: len isn't initialized */ mhod->string_len = get_gint32 (len, buffer->byte_order); /* pad string if necessary */ @@ -336,7 +338,8 @@ write_mhod_type_3 (gchar *string, iPodBuffer *buffer) padding = 4 - ( (total_bytes + len) % 4 ); if (padding == 4) padding = 0; - mhod->padding_len = padding; + mhod->padding_len = padding; /* 8 bit field, no need to byteswap */ + /* Make sure we have enough free space to write the string */ ipod_buffer_maybe_grow (buffer, len+padding); mhod = ipod_buffer_get_pointer (buffer); |