summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <teuf@gnome.org>2008-02-03 18:53:28 +0000
committerChristophe Fergeau <teuf@gnome.org>2008-02-03 18:53:28 +0000
commit89d7f3aacc48509db4dbbafe6232615b1bfb8d28 (patch)
tree527c22eac1060b47e5435ad3e803133912932485
parenta65515acf6ee811a1bfd33cf31bfec6dab420e94 (diff)
downloadlibgpod-89d7f3aacc48509db4dbbafe6232615b1bfb8d28.tar.gz
libgpod-89d7f3aacc48509db4dbbafe6232615b1bfb8d28.tar.xz
libgpod-89d7f3aacc48509db4dbbafe6232615b1bfb8d28.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
-rw-r--r--ChangeLog6
-rw-r--r--src/db-artwork-parser.c2
-rw-r--r--src/db-artwork-writer.c11
3 files changed, 14 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d1d197c..4563380 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-02-03 Christophe Fergeau <teuf@gnome.org>
+ * src/db-artwork-parser.c: use enum name instead of hardcoded int
+ * src/db-artwork-writer.c: add comments about values that aren't
+ swapped because they are 8 bit values
+
+2008-02-03 Christophe Fergeau <teuf@gnome.org>
+
* src/db-itunes-parser.h: merge ArtworkDB_MhodHeaderArtworkType3
and MhodHeaderArtworkType1 into a single struct called
ArtworkDB_MhodHeaderString
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);