Revision: 1768
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1768&view=rev
Author:   jcsjcs
Date:     2007-11-09 19:56:11 -0800 (Fri, 09 Nov 2007)

Log Message:
-----------
        * src/db-artwork-parser.c (parse_mhba): fix double g_free on mhba
          chunks with multiple mhods. Currently only mhods of type 1 are
          handled, the rest (type 2: image transition style) are being
          discarded.

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

Modified: libgpod/trunk/ChangeLog
===================================================================
--- libgpod/trunk/ChangeLog     2007-11-09 16:49:39 UTC (rev 1767)
+++ libgpod/trunk/ChangeLog     2007-11-10 03:56:11 UTC (rev 1768)
@@ -1,3 +1,10 @@
+2007-11-10  Jorg Schuler <jcsjcs at users.sourceforge.net>
+
+       * src/db-artwork-parser.c (parse_mhba): fix double g_free on mhba
+         chunks with multiple mhods. Currently only mhods of type 1 are
+         handled, the rest (type 2: image transition style) are being
+         discarded.
+
 2007-11-09  Jorg Schuler <jcsjcs at users.sourceforge.net>
 
        * src/db-parse-context.c (db_parse_context_get_m_header_internal):

Modified: libgpod/trunk/src/db-artwork-parser.c
===================================================================
--- libgpod/trunk/src/db-artwork-parser.c       2007-11-09 16:49:39 UTC (rev 
1767)
+++ libgpod/trunk/src/db-artwork-parser.c       2007-11-10 03:56:11 UTC (rev 
1768)
@@ -26,6 +26,7 @@
 #include <config.h>
 #endif
 
+#include <stdio.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -315,8 +316,6 @@
 parse_mhba (DBParseContext *ctx, GError *error)
 {
        MhbaHeader *mhba;
-       ArtworkDB_MhodHeader *mhod;
-       DBParseContext *mhod_ctx;
        DBParseContext *mhia_ctx;
        Itdb_PhotoAlbum *album;
        Itdb_PhotoDB *photodb;
@@ -352,22 +351,37 @@
                                          ctx->byte_order);
 
        cur_offset = ctx->header_len;
-       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));
-               mhod1 = (MhodHeaderArtworkType1*)mhod;
-               album->name = g_strndup ((gchar *)mhod1->string, 
get_gint32(mhod1->string_len, ctx->byte_order));
-               cur_offset += mhod_ctx->total_len;
+       while (num_children > 0)
+       {
+           MhodHeaderArtworkType1 *mhod1;
+           ArtworkDB_MhodHeader *mhod;
+           DBParseContext *mhod_ctx;
+
+           mhod_ctx = db_parse_context_get_sub_context (ctx, cur_offset);
+           /* 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) {
+               g_free (mhod_ctx);
+               return -1;
+           }
+           db_parse_context_set_total_len (mhod_ctx,
+                                           get_gint32(mhod->total_len, 
ctx->byte_order));
+           mhod1 = (MhodHeaderArtworkType1*)mhod;
+           switch (mhod1->type)
+           {  /* FIXME: type==1 is album name. type==2 seems to be
+               * the transtition type between photos,
+               * e.g. "Dissolve". Not handled yet. */
+           case 1:
+               album->name = g_strndup ((gchar *)mhod1->string,
+                                        get_gint32(mhod1->string_len, 
ctx->byte_order));
                dump_mhod_type_1 (mhod1);
-               g_free (mhod_ctx);
-               num_children--;
+               break;
+           }
+           cur_offset += mhod_ctx->total_len;
+           g_free (mhod_ctx);
+           num_children--;
        }
 
        mhia_ctx = db_parse_context_get_sub_context (ctx, cur_offset);


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to