Revision: 1742
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1742&view=rev
Author:   teuf
Date:     2007-10-29 14:21:11 -0700 (Mon, 29 Oct 2007)

Log Message:
-----------
* src/db-artwork-writer.c: reread the pointer for memory mapped
buffers when it may have changed
Artwork writing works by mapping structs to memory and by directly 
accessing/modifying it. This works until we need to move the
mmap base address. This patch makes sure we reset the struct
mapping every time the mmap base pointer may have changed

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

Modified: libgpod/trunk/ChangeLog
===================================================================
--- libgpod/trunk/ChangeLog     2007-10-27 13:11:35 UTC (rev 1741)
+++ libgpod/trunk/ChangeLog     2007-10-29 21:21:11 UTC (rev 1742)
@@ -1,3 +1,13 @@
+2007-10-29  Christophe Fergeau <[EMAIL PROTECTED]>
+
+       * src/db-artwork-writer.c: reread the pointer for memory mapped
+       buffers when it may have changed
+           
+       Artwork writing works by mapping structs to memory and by directly 
+       accessing/modifying it. This works until we need to move the
+       mmap base address. This patch makes sure we reset the struct
+       mapping every time the mmap base pointer may have changed
+
 2007-10-27 Jorg Schuler <jcsjcs at users.sourceforge.net>
 
         * src/itdb_device.c (ipod_classic_1_artwork_info)

Modified: libgpod/trunk/src/db-artwork-writer.c
===================================================================
--- libgpod/trunk/src/db-artwork-writer.c       2007-10-27 13:11:35 UTC (rev 
1741)
+++ libgpod/trunk/src/db-artwork-writer.c       2007-10-29 21:21:11 UTC (rev 
1742)
@@ -330,6 +330,7 @@
        if (ipod_buffer_maybe_grow (buffer, total_bytes + len + padding ) != 0) 
{
                return  -1;
        }
+       mhod = ipod_buffer_get_pointer (buffer);
        memcpy (mhod->string, string, len);
        total_bytes += len + padding;
        mhod->total_len = get_gint32 (total_bytes, buffer->byte_order);
@@ -385,14 +386,14 @@
            if (padding == 4)
                padding = 0;
            mhod->padding = padding;
-           total_bytes += g2l*len + padding;
+           total_bytes += g2l*len + padding;
 
            /* Make sure we have enough free space to write the string */
            if (ipod_buffer_maybe_grow (buffer, total_bytes) != 0) {
                g_free (utf16);
                return  -1;
            }
-
+           mhod = ipod_buffer_get_pointer (buffer);
            strp = (gunichar2 *)mhod->string;
            for (i = 0; i < len; i++) {
                strp[i] = get_gint16 (utf16[i], buffer->byte_order);
@@ -413,6 +414,7 @@
            if (ipod_buffer_maybe_grow (buffer, total_bytes + 2*len+padding) != 
0) {
                return  -1;
            }
+           mhod = ipod_buffer_get_pointer (buffer);
            memcpy (mhod->string, string, len);
            total_bytes += (len+padding);
        }
@@ -470,6 +472,7 @@
                return -1;
        }
        total_bytes += bytes_written;
+       mhni = ipod_buffer_get_pointer (buffer);
        mhni->total_len = get_gint32 (total_bytes, buffer->byte_order);
        /* Only update number of children when all went well to try to get
         * something somewhat consistent when there are errors
@@ -512,6 +515,7 @@
                return -1;
        }
        total_bytes += bytes_written;
+       mhod = ipod_buffer_get_pointer (buffer);
        mhod->total_len = get_gint32 (total_bytes, buffer->byte_order);
 
        dump_mhod (mhod);
@@ -590,6 +594,7 @@
                        return -1;
                }
                total_bytes += bytes_written;
+               mhii = ipod_buffer_get_pointer (buffer);
                num_children++;
                it = it->next;
        }
@@ -651,6 +656,7 @@
                }
                it = it->next;
        }
+       mhli = ipod_buffer_get_pointer (buffer);
        mhli->num_children = get_gint32 (num_thumbs, buffer->byte_order);
        dump_mhl ((MhlHeader *)mhli, "mhli");
 
@@ -725,6 +731,7 @@
            return -1;
        }
        total_bytes += bytes_written;
+       mhba = ipod_buffer_get_pointer (buffer);
 
        for (it = album->members; it != NULL; it = it->next) {
                Itdb_Artwork *photo = it->data;
@@ -741,6 +748,7 @@
                }
                total_bytes += bytes_written;
        }
+       mhba = ipod_buffer_get_pointer (buffer);
        mhba->total_len = get_gint32( total_bytes, buffer->byte_order );
        dump_mhba ( mhba );
        return total_bytes;
@@ -775,6 +783,7 @@
                    return -1;
                }
                total_bytes += bytes_written;
+               mhla = ipod_buffer_get_pointer (buffer);
                num_children++;
                mhla->num_children = get_gint32 (num_children,
                                                  buffer->byte_order);
@@ -872,6 +881,8 @@
                        return -1;
                }
                total_bytes += bytes_written;
+               mhlf = ipod_buffer_get_pointer (buffer);
+
                 num_children++;
                /* Only update number of children when all went well to try 
                  * to get something somewhat consistent when there are errors
@@ -924,6 +935,7 @@
                return -1;
        } else {
                total_bytes += bytes_written;
+               mhsd = ipod_buffer_get_pointer (buffer);
                mhsd->total_len = get_gint32 (total_bytes, buffer->byte_order);
        }
 
@@ -940,6 +952,7 @@
        int bytes_written;
        int i;
 
+       
        mhfd = (MhfdHeader *)init_header (buffer, "mhfd", sizeof (MhfdHeader));
        if (mhfd == NULL) {
                return -1;
@@ -969,6 +982,7 @@
                        return -1;
                }
                total_bytes += bytes_written;
+               mhfd = ipod_buffer_get_pointer (buffer);
                mhfd->total_len = get_gint32 (total_bytes, buffer->byte_order);
                mhfd->num_children = get_gint32 (i, buffer->byte_order);
        }


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