From patchwork Wed Apr 27 11:11:50 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: 8954971 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 4D49FBF29F for ; Wed, 27 Apr 2016 11:14:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C6C5201E4 for ; Wed, 27 Apr 2016 11:14:20 +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 70BEE200DC for ; Wed, 27 Apr 2016 11:14:19 +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 1avNON-0003Qs-A8; Wed, 27 Apr 2016 11:12:27 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avNOM-0003QA-LY for xen-devel@lists.xenproject.org; Wed, 27 Apr 2016 11:12:26 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 2A/74-03814-99E90275; Wed, 27 Apr 2016 11:12:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsXitHRDpO7MeQr hBqcuKVh83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBn9bY/ZCs5IV3zsm8zcwHhPpIuRk0NCwF/i 9YZmRhCbTUBH4uLcnWxdjBwcIgIqErf3GoCEmQWKJb6u6mMFsYUF4iVetU9iB7FZBFQlLk98D NbKK+AqcXr6ZhaIkboSJ3dvAqvhBIq3NU0AiwsJuEg8vX2HFaJeUOLkzCcsEPM1JVq3/2aHsO UlmrfOZoaoV5Ton/cA7BwJAW6Jv932Exj5ZyHpnoWkexaS7gWMzKsY1YtTi8pSi3RN9JKKMtM zSnITM3N0DQ2M9XJTi4sT01NzEpOK9ZLzczcxAsOPAQh2MDZ+cTrEKMnBpCTKu7BdIVyILyk/ pTIjsTgjvqg0J7X4EKMMB4eSBO+xOUA5waLU9NSKtMwcYCTApCU4eJREeOtB0rzFBYm5xZnpE KlTjIpS4rzbQBICIImM0jy4Nlj0XWKUlRLmZQQ6RIinILUoN7MEVf4VozgHo5IwbxfIFJ7MvB K46a+AFjMBLb58SBZkcUkiQkqqgTEqZde5Pxktn9WmBW393vpNrsw2IDl6hTJ7Vcny+f1/3Gp EQryX2pl66EydMV/ARzByxUqm8l6DI1z1S8r8DRYWZ3g7XT6551zKO72rEya/k3ov3LdOwf6k 6iyZfuGpKxN67m3XflEpF9gaYt1+b//h9c8bCleZzWToqnh7Q6jdZ3lAAwPrNiWW4oxEQy3mo uJEANmaJzS5AgAA X-Env-Sender: prvs=918322aae=roger.pau@citrix.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1461755543!34036029!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.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15803 invoked from network); 27 Apr 2016 11:12:25 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-5.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 27 Apr 2016 11:12:25 -0000 X-IronPort-AV: E=Sophos;i="5.24,541,1454976000"; d="scan'208";a="350092214" From: Roger Pau Monne To: Date: Wed, 27 Apr 2016 13:11:50 +0200 Message-ID: <1461755514-23754-13-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.6.4 (Apple Git-63) In-Reply-To: <1461755514-23754-1-git-send-email-roger.pau@citrix.com> References: <1461755514-23754-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 v3 for-4.7 12/16] 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 }