diff mbox

[PULL,00/16] Block patches

Message ID 1497100.KaIgobZClN@al
State New
Headers show

Commit Message

Peter Wu Jan. 17, 2015, 10:41 a.m. UTC
On Friday 16 January 2015 16:46:39 Peter Maydell wrote:
> CentOS5:
> 
> ../block/dmg.o: In function `dmg_read_plist_xml':
> /home/petmay01/linaro/qemu-for-merges/block/dmg.c:414: undefined
> reference to `g_base64_decode_inplace'

Should have paid more attention to the API docs. Can you try the
following patch? It still passes 4 dmg tests for me
(https://lekensteyn.nl/files/dmg-tests/).

Comments

Stefan Hajnoczi Jan. 20, 2015, 10:26 a.m. UTC | #1
On Sat, Jan 17, 2015 at 11:41:59AM +0100, Peter Wu wrote:
> On Friday 16 January 2015 16:46:39 Peter Maydell wrote:
> > CentOS5:
> > 
> > ../block/dmg.o: In function `dmg_read_plist_xml':
> > /home/petmay01/linaro/qemu-for-merges/block/dmg.c:414: undefined
> > reference to `g_base64_decode_inplace'
> 
> Should have paid more attention to the API docs. Can you try the
> following patch? It still passes 4 dmg tests for me
> (https://lekensteyn.nl/files/dmg-tests/).

Could you also replace g_assert_false() with g_assert(!...) so it builds
on Mac?

Thanks,
Stefan
diff mbox

Patch

diff --git a/block/dmg.c b/block/dmg.c
index 4e24076..0430f55 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -403,6 +403,7 @@  static int dmg_read_plist_xml(BlockDriverState *bs, DmgHeaderState *ds,
      * and line feeds. */
     data_end = (char *)buffer;
     while ((data_begin = strstr(data_end, "<data>")) != NULL) {
+        guchar *mish;
         gsize out_len = 0;
 
         data_begin += 6;
@@ -413,9 +414,9 @@  static int dmg_read_plist_xml(BlockDriverState *bs, DmgHeaderState *ds,
             goto fail;
         }
         *data_end++ = '\0';
-        g_base64_decode_inplace(data_begin, &out_len);
-        ret = dmg_read_mish_block(s, ds, (uint8_t *)data_begin,
-                                  (uint32_t)out_len);
+        mish = g_base64_decode(data_begin, &out_len);
+        ret = dmg_read_mish_block(s, ds, mish, (uint32_t)out_len);
+        g_free(mish);
         if (ret < 0) {
             goto fail;
         }