Revision: 1514
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1514&view=rev
Author:   jcsjcs
Date:     2007-06-01 06:56:32 -0700 (Fri, 01 Jun 2007)

Log Message:
-----------
        * src/db-artwork-parser.c (parse_mhba): non-zero terminated
          string was copied using g_strdup() instead of g_strndup(). This
          affected album names of the Photo Database.

          src/db-artwork-writer.c (write_mhod_type_1): convert 'type' as
          16 bit integer, not 32 bit integer. Potential problem on
          non-standard endian system (iPod side).

          src/db-itunes-parser.h: '#if 0' unused structure to avoid
          confusion.

Modified Paths:
--------------
    libgpod/trunk/ChangeLog
    libgpod/trunk/src/db-artwork-parser.c
    libgpod/trunk/src/db-artwork-writer.c
    libgpod/trunk/src/db-itunes-parser.h

Modified: libgpod/trunk/ChangeLog
===================================================================
--- libgpod/trunk/ChangeLog     2007-05-31 14:43:57 UTC (rev 1513)
+++ libgpod/trunk/ChangeLog     2007-06-01 13:56:32 UTC (rev 1514)
@@ -1,3 +1,16 @@
+2007-05-27  Jorg Schuler <jcsjcs at users.sourceforge.net>
+
+        * src/db-artwork-parser.c (parse_mhba): non-zero terminated
+         string was copied using g_strdup() instead of g_strndup(). This
+         affected album names of the Photo Database.
+
+         src/db-artwork-writer.c (write_mhod_type_1): convert 'type' as
+         16 bit integer, not 32 bit integer. Potential problem on
+         non-standard endian system (iPod side).
+
+         src/db-itunes-parser.h: '#if 0' unused structure to avoid
+         confusion.
+
 2007-05-30  Todd Zullinger <tmzullinger at users.sourceforge.net>
 
         * bindings/python/tests/resources/iTunes/iTunesDB.ext

Modified: libgpod/trunk/src/db-artwork-parser.c
===================================================================
--- libgpod/trunk/src/db-artwork-parser.c       2007-05-31 14:43:57 UTC (rev 
1513)
+++ libgpod/trunk/src/db-artwork-parser.c       2007-06-01 13:56:32 UTC (rev 
1514)
@@ -355,15 +355,17 @@
        mhod_ctx = db_parse_context_get_sub_context (ctx, cur_offset);
        num_children = get_gint32 (mhba->num_mhods, ctx->byte_order);
        while ((num_children > 0) && (mhod_ctx != NULL)) {
+               MhodHeaderArtworkType1 *mhod1;
                /* FIXME: First mhod is album name, whats the others for? */
                mhod = db_parse_context_get_m_header (mhod_ctx, 
ArtworkDB_MhodHeader, "mhod");
                if (mhod == NULL) {
                        return -1;
                }
                db_parse_context_set_total_len (mhod_ctx,  
get_gint32(mhod->total_len, ctx->byte_order));
-               album->name = g_strdup( (char 
*)((MhodHeaderArtworkType1*)mhod)->string );
+               mhod1 = (MhodHeaderArtworkType1*)mhod;
+               album->name = g_strndup ((gchar *)mhod1->string, 
mhod1->string_len);
                cur_offset += mhod_ctx->total_len;
-               dump_mhod_type_1 ((MhodHeaderArtworkType1*)mhod);
+               dump_mhod_type_1 (mhod1);
                g_free (mhod_ctx);
                num_children--;
        }

Modified: libgpod/trunk/src/db-artwork-writer.c
===================================================================
--- libgpod/trunk/src/db-artwork-writer.c       2007-05-31 14:43:57 UTC (rev 
1513)
+++ libgpod/trunk/src/db-artwork-writer.c       2007-06-01 13:56:32 UTC (rev 
1514)
@@ -330,7 +330,7 @@
 
        padding = 4 - ( (total_bytes + len) % 4 );
        mhod->padding = padding;
-       mhod->type = get_gint32 (0x0001, buffer->byte_order);
+       mhod->type = get_gint16 (0x01, buffer->byte_order);
 
        /* Make sure we have enough free space to write the string */
        if (ipod_buffer_maybe_grow (buffer, total_bytes + len + padding ) != 0) 
{
@@ -384,7 +384,7 @@
            /* number of bytes of the string encoded in UTF-16 */
            mhod->string_len = get_gint32 (2*len, buffer->byte_order);
            padding = 4 - ( (total_bytes + 2*len) % 4 );
-           mhod->padding = padding; /* high byte is padding length (0-3) */
+           mhod->padding = padding;
 
            /* Make sure we have enough free space to write the string */
            if (ipod_buffer_maybe_grow (buffer, total_bytes + 2*len+padding) != 
0) {
@@ -410,7 +410,7 @@
            /* e.g. len = 7 bytes, len%4 = 3, 4-3=1 -> requires 1 byte
               padding */
            padding = 4 - ( (total_bytes + len) % 4 );
-           mhod->padding = padding; /* high byte is padding length (0-3) */
+           mhod->padding = padding;
            /* Make sure we have enough free space to write the string */
            if (ipod_buffer_maybe_grow (buffer, total_bytes + 2*len+padding) != 
0) {
                return  -1;

Modified: libgpod/trunk/src/db-itunes-parser.h
===================================================================
--- libgpod/trunk/src/db-itunes-parser.h        2007-05-31 14:43:57 UTC (rev 
1513)
+++ libgpod/trunk/src/db-itunes-parser.h        2007-06-01 13:56:32 UTC (rev 
1514)
@@ -377,6 +377,8 @@
        unsigned char string[];
 };
 
+#if 0
+/* not used at all */
 struct _MhodHeaderArtworkType3 {
        unsigned char header_id[4];
        gint32 header_len;
@@ -390,6 +392,7 @@
        gint32 unknown4;
        gunichar2 string[];
 };
+#endif
 
 struct _ArtworkDB_MhodHeaderArtworkType3 {
        unsigned char header_id[4];


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to