Blame SOURCES/kvm-qobject-Use-qobject_to-instead-of-type-cast.patch

357786
From 5dcc5026b76ccfe45ed4a4ed56c8c949ead76e98 Mon Sep 17 00:00:00 2001
357786
From: Markus Armbruster <armbru@redhat.com>
357786
Date: Mon, 18 Jun 2018 08:43:08 +0200
357786
Subject: [PATCH 01/54] qobject: Use qobject_to() instead of type cast
357786
MIME-Version: 1.0
357786
Content-Type: text/plain; charset=UTF-8
357786
Content-Transfer-Encoding: 8bit
357786
357786
RH-Author: Markus Armbruster <armbru@redhat.com>
357786
Message-id: <20180618084330.30009-2-armbru@redhat.com>
357786
Patchwork-id: 80732
357786
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 01/23] qobject: Use qobject_to() instead of type cast
357786
Bugzilla: 1557995
357786
RH-Acked-by: Max Reitz <mreitz@redhat.com>
357786
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
357786
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
357786
357786
The proper way to convert from (abstract) QObject to a (concrete)
357786
subtype is qobject_to().  Look for offenders that type cast instead:
357786
357786
    $ git-grep '(Q[A-Z][a-z]* \*)'
357786
    hmp.c:    qmp_device_add((QDict *)qdict, NULL, &err;;
357786
    include/qapi/qmp/qobject.h:        return (QObject *)obj;
357786
    qobject/qobject.c:static void (*qdestroy[QTYPE__MAX])(QObject *) = {
357786
    tests/check-qdict.c:    dst = (QDict *)qdict_crumple(src, &error_abort);
357786
357786
The first two cast away const, the third isn't a type cast.  Fix the
357786
fourth.
357786
357786
Signed-off-by: Markus Armbruster <armbru@redhat.com>
357786
Message-Id: <20180426152805.8469-1-armbru@redhat.com>
357786
Reviewed-by: Eric Blake <eblake@redhat.com>
357786
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
357786
(cherry picked from commit 46cfbf13b06d551072ed17fbfca67c103edf814f)
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 tests/check-qdict.c | 2 +-
357786
 1 file changed, 1 insertion(+), 1 deletion(-)
357786
357786
diff --git a/tests/check-qdict.c b/tests/check-qdict.c
357786
index 2e73c2f..08d4303 100644
357786
--- a/tests/check-qdict.c
357786
+++ b/tests/check-qdict.c
357786
@@ -657,7 +657,7 @@ static void qdict_crumple_test_empty(void)
357786
 
357786
     src = qdict_new();
357786
 
357786
-    dst = (QDict *)qdict_crumple(src, &error_abort);
357786
+    dst = qobject_to(QDict, qdict_crumple(src, &error_abort));
357786
 
357786
     g_assert_cmpint(qdict_size(dst), ==, 0);
357786
 
357786
-- 
357786
1.8.3.1
357786