From patchwork Tue Apr 26 14:52:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 8939611 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 016B0BF29F for ; Tue, 26 Apr 2016 14:55:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 198C920125 for ; Tue, 26 Apr 2016 14:55:15 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C4F8720219 for ; Tue, 26 Apr 2016 14:55:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1av4MZ-0007lE-UR; Tue, 26 Apr 2016 14:53:19 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1av4MY-0007j7-Va for xen-devel@lists.xenproject.org; Tue, 26 Apr 2016 14:53:19 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id CF/D0-07120-ED08F175; Tue, 26 Apr 2016 14:53:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRWlGSWpSXmKPExsXitHRDpO7dBvl wg+7blhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aRfSUFS6QrVj94wNLAuEuki5GTQ0LAX2LJ mYOsIDabgI7Exbk72boYOThEBFQkbu81AAkzCxRLfF3VB1YiLBAvsX3dLBYQm0VAVeLCl/1gc V4BV4m5i3vZIEbqSpzcvYkdxOYEim9e8IoJxBYScJFYsukxO0S9oMTJmU9YIOZrSrRu/80OYc tLNG+dzQxRryjRP+8B2DkSAtwSf7vtJzDyz0LSPQtJ9ywk3QsYmVcxqhenFpWlFuka6SUVZaZ nlOQmZuboGhqY6eWmFhcnpqfmJCYV6yXn525iBAYfAxDsYFz21+kQoyQHk5Io7708+XAhvqT8 lMqMxOKM+KLSnNTiQ4wyHBxKErxb6oFygkWp6akVaZk5wDiASUtw8CiJ8O4DSfMWFyTmFmemQ 6ROMSpKifNOAUkIgCQySvPg2mCxd4lRVkqYlxHoECGegtSi3MwSVPlXjOIcjErCvOdApvBk5p XATX8FtJgJaPHlQ7Igi0sSEVJSDYwMExJWVH2dqTr1YHGQVtrSM6wzm2rdWafvE8yc5nv5m59 Ixw6+z1xHo/+rcfKynHlx6Op25mOGWbw1zQL7Dl8rDpbX1ZH3WNT/qufY+003bc7myNosFYjf f9HBce3sXXtaX/8R+Ss1y+F92als6cNf1+Qvn/rdT2v12RBWjblRu19XuGhdClmgxFKckWiox VxUnAgAojpPm7gCAAA= X-Env-Sender: prvs=917dd492e=roger.pau@citrix.com X-Msg-Ref: server-16.tower-21.messagelabs.com!1461682396!6950733!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 39642 invoked from network); 26 Apr 2016 14:53:17 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-16.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 26 Apr 2016 14:53:17 -0000 X-IronPort-AV: E=Sophos;i="5.24,537,1454976000"; d="scan'208";a="349876719" From: Roger Pau Monne To: Date: Tue, 26 Apr 2016 16:52:20 +0200 Message-ID: <1461682343-20597-12-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.6.4 (Apple Git-63) In-Reply-To: <1461682343-20597-1-git-send-email-roger.pau@citrix.com> References: <1461682343-20597-1-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Wei Liu , Ian Jackson , Roger Pau Monne Subject: [Xen-devel] [PATCH v2 for-4.7 11/14] libxl: add explicit casts from yajl_gen_status to yajl_status X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Or else clang complains with: implicit conversion from enumeration type 'yajl_gen_status' to different enumeration type 'yajl_status' [-Werror,-Wenum-conversion] Signed-off-by: Roger Pau Monné Acked-by: Wei Liu --- Cc: Ian Jackson Cc: Wei Liu --- tools/libxl/libxl_json.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c index 3b695dd..6bb0695 100644 --- a/tools/libxl/libxl_json.c +++ b/tools/libxl/libxl_json.c @@ -617,42 +617,48 @@ yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc, int idx = 0; yajl_status rc; +#define CONVERT_YAJL_GEN_TO_STATUS(gen) \ + ((gen) == yajl_gen_status_ok ? yajl_status_ok : yajl_status_error); + switch (obj->type) { case JSON_NULL: - return yajl_gen_null(hand); + return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_null(hand)); case JSON_BOOL: - return yajl_gen_bool(hand, obj->u.b); + return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_bool(hand, obj->u.b)); case JSON_INTEGER: - return yajl_gen_integer(hand, obj->u.i); + return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_integer(hand, obj->u.i)); case JSON_DOUBLE: - return yajl_gen_double(hand, obj->u.d); + return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_double(hand, obj->u.d)); case JSON_NUMBER: - return yajl_gen_number(hand, obj->u.string, strlen(obj->u.string)); + return CONVERT_YAJL_GEN_TO_STATUS( + yajl_gen_number(hand, obj->u.string, strlen(obj->u.string))); case JSON_STRING: - return libxl__yajl_gen_asciiz(hand, obj->u.string); + return CONVERT_YAJL_GEN_TO_STATUS( + libxl__yajl_gen_asciiz(hand, obj->u.string)); case JSON_MAP: { libxl__json_map_node *node = NULL; - rc = yajl_gen_map_open(hand); + rc = CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_map_open(hand)); if (rc != yajl_status_ok) return rc; for (idx = 0; idx < obj->u.map->count; idx++) { if (flexarray_get(obj->u.map, idx, (void**)&node) != 0) break; - rc = libxl__yajl_gen_asciiz(hand, node->map_key); + rc = CONVERT_YAJL_GEN_TO_STATUS( + libxl__yajl_gen_asciiz(hand, node->map_key)); if (rc != yajl_status_ok) return rc; rc = libxl__json_object_to_yajl_gen(gc, hand, node->obj); if (rc != yajl_status_ok) return rc; } - return yajl_gen_map_close(hand); + return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_map_close(hand)); } case JSON_ARRAY: { libxl__json_object *node = NULL; - rc = yajl_gen_array_open(hand); + rc = CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_array_open(hand)); if (rc != yajl_status_ok) return rc; for (idx = 0; idx < obj->u.array->count; idx++) { @@ -662,13 +668,14 @@ yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc, if (rc != yajl_status_ok) return rc; } - return yajl_gen_array_close(hand); + return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_array_close(hand)); } case JSON_ANY: /* JSON_ANY is not a valid value for obj->type. */ ; } abort(); +#undef CONVERT_YAJL_GEN_TO_STATUS }