qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 00/16] Block patches


From: Peter Wu
Subject: Re: [Qemu-devel] [PULL 00/16] Block patches
Date: Sat, 17 Jan 2015 11:41:59 +0100
User-agent: KMail/4.14.4 (Linux/3.18.1-1-ARCH; KDE/4.14.4; x86_64; ; )

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/).
-- 
Kind regards,
Peter
https://lekensteyn.nl
--

>From 462454e820d2fa5f8eefe7b039d6ea32e4a88d41 Mon Sep 17 00:00:00 2001
From: Peter Wu <address@hidden>
Date: Sat, 17 Jan 2015 11:34:32 +0100
Subject: [PATCH] block/dmg: fix compatibility with glib 2.12

For compatibility with glib 2.12, use g_base64_decode (which
additionally requires an extra buffer allocation) instead of
g_base64_decode_inplace (which is only available since glib 2.20).

Signed-off-by: Peter Wu <address@hidden>
---
 block/dmg.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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;
         }
-- 
2.2.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]