From patchwork Fri Jul 12 15:26:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Eggers X-Patchwork-Id: 1959941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=avokHRyI; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2001:4860:4864:20::3c; helo=mail-oa1-x3c.google.com; envelope-from=swupdate+bncbdk7hq7yrekrbpewyw2amgqewvziezi@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-oa1-x3c.google.com (mail-oa1-x3c.google.com [IPv6:2001:4860:4864:20::3c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WLFnX2H0cz1xqx for ; Sat, 13 Jul 2024 01:26:56 +1000 (AEST) Received: by mail-oa1-x3c.google.com with SMTP id 586e51a60fabf-25e3350651esf1977232fac.3 for ; Fri, 12 Jul 2024 08:26:56 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1720798013; cv=pass; d=google.com; s=arc-20160816; b=UdpmDvCc54P6TlSNFs2Kl9+AzWoFqKvF2lnbmVBp1nCckkQIbQjHE79dNwg/KEJaE2 csu4b27PF7CkbLtBcL3tElPdODSTSQNVtrQo0EYa83dHFpvtlDzvxcocDZH/wkKcOIbX VOLqpj8SxGigb+20PfStWSid82R+J+IrPrvZTSh4TYN+Tq78DcFp8MYCJ9lXIKPxpJW6 vfCe2AjPZYRsTRSpUwdtVy6nXacwgetMH+AwOHxQF8uGb+MKPLmRS1+Pj7b82WgOPVjD baNzCiRkko1t1u/nI781Y0hWvVH744kOUJXG0Ym7FDZR47GSUFYF20Ye+/F3mPPXrk+L hD3g== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=W1M/5l+BE7wHKyGAzyJgrb7UR7d5Dn1zj0TTcvQTd2g=; fh=hXDhTOFEZp4HDepFWMGQzmdDYxVDrby2J5EiDoa6aqE=; b=jttoJvAQJ67Yaz+C1algW9uaq0haqjsMPN7SQHxYAWopm3AM4wz7A9q9VCAvHDurRc t4btzlsjS2Qms8IP3NYAANKJNqsYO9KiSKlvv1ssA0+62jeZdG4lOEKwiSj3vyf2HjU4 t0UyKZ96CYAAn22khitHKBBcTLCtcG7YfgOCQ5mqk4ZyX+KNm7ani4TlBvNyQ9vytdKj JZOZDLVJgX2hf82dxx34gys8EHFRws4J8DsHsKm6rTOXt1j36CSuWWWwfHDBAFkww8OQ kUJtncOJcAbOdjnyPNfe6CmZK+YJhxhyz9S/lNBUNPT07QIKDHxmSYz9UC07nLOOPxuZ SBvA==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@arri.de header.s=selector1 header.b=rdF8J28f; arc=pass (i=1); spf=pass (google.com: domain of ceggers@arri.de designates 2a01:111:f403:2613::601 as permitted sender) smtp.mailfrom=CEggers@arri.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arri.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1720798013; x=1721402813; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=W1M/5l+BE7wHKyGAzyJgrb7UR7d5Dn1zj0TTcvQTd2g=; b=avokHRyIyK/01LDILyuer/3VGkr5L5zJkW7HboWmF294qRXlhL8hC4VaYWF44Fx0ON idyQDjRAUvfO8ctr8Uzh7DNxh4DY8tv/MhNctaF7o8tMpgjeoOVTjwwfsRZJh4nEhNlW WyAfW3IQR23xDY/u8SEjp37ZMZcXCFa+rTCK51PKGIxuVtqQOosAKtxYn3rBPOxX6Nle Exexcm8o0dXGLe4OB1vOQUm1VhbkOiO6BtmTSqhFNlmnBIv9IBGiuoxqW5U/9Xbtj5Q0 UJAzb9Utvj5sHasATUMBGZufWhRF8AjAcHcitCXC90fe6QYk9dxq+KIx29SYaVDAV8Nc 2T/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720798013; x=1721402813; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=W1M/5l+BE7wHKyGAzyJgrb7UR7d5Dn1zj0TTcvQTd2g=; b=YZq7/EfpxRdF5pwVZ28d0fx+iiCuwBR8RWSM39r4eSuD21hkAyYAjNJLzIHAqKn+XY 6Kr5QEek+9v84uXVZVOH9xTK5wPdKC8T0gzPibDUqUKm3h6m7LwXtHJzGRVhqaVl4mzT ShQMClnvKP8UXHJZWCfqohfMt5CZ2ayau804Ibg2b7ytnVNTte37P9cZAYAJgEScMwAF mQ3DUGx3rleFYDr8XMp5JSDwYbfFGx/8yYD9VzqM9rz2cqBrfk8Y3jRLTx8Sik9dJ9Ec 3xYE4QPEsw6z3WvJ0cxxAkHhhJx8hIhxlOOvROFw66z7vIDrAOqP/Hkd4GitovruW/91 pUjg== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=3; AJvYcCXdgRYVh/IMPuNqfWqkCkNgoOeKhPgMb7DpCml1zh10JNucQAszWuC9obcn/IB93gvvxUoklOsJfo8PZ1+B0g7rwqpm0xawLUoPNVI6xQ== X-Gm-Message-State: AOJu0YypxZoWOCMZQC1hDHaf8SsbJf0j+fU+pN7J2xYj6Xr4x3+mFEop f3MmgVbEO9lfBKb0+HCSRY4xobc7kYkdlBYKkkWIFBnJXt36bheL X-Google-Smtp-Source: AGHT+IGHf/EABB5jEnPjHSTkTYowfA9ba2gcnWRPRahIi45ldQgexJAugHY//O7P3MUAwNW/8K/DDA== X-Received: by 2002:a05:6870:40c3:b0:254:826f:a9d6 with SMTP id 586e51a60fabf-25eae7bb6d4mr9832062fac.15.1720798012837; Fri, 12 Jul 2024 08:26:52 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6870:208:b0:23d:21b7:fd9 with SMTP id 586e51a60fabf-2603ad88781ls2088258fac.2.-pod-prod-03-us; Fri, 12 Jul 2024 08:26:51 -0700 (PDT) X-Received: by 2002:a05:6808:159e:b0:3d9:2e63:8313 with SMTP id 5614622812f47-3d93bedb47bmr13895068b6e.11.1720798011634; Fri, 12 Jul 2024 08:26:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720798011; cv=pass; d=google.com; s=arc-20160816; b=R+ZtpnnAOa7Ty35aNmRtkhQrt7CkUapb9rvqvgyNF62y6AdDVZJerOiMnRUmlQr8xM Y+yNW29NQNKQzfn9xdNCYjSGUEAxPJAArpbdEAaPLDik/JITROuFJ1ZABWjSi6o3jnVq 339ZBlj9FCx0zrHoNBfqwHV+/8RDpOMbTUMlaTdbgrvXqOZ09VFh4RuGu1X4HzHz9iZA 2Xswyb1WWFbR5J0IBLnLK6+pokJoNGJDVCGAEjL5OKhO96cUnra5X/p1D9f/bX8kw51g 5vgAm/Uyhm/bCw/aQ8HZRQizizo608Dl8iqLQrX2n89lZU3Itb1/zxZaDhqJ9DSF9LXo q2Dw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=0XMylsbBKMefxyxS5S4e9kOpF5uoAf8O1lCWFN+lEO0=; fh=Zaas7zo9QAZR51NXyZEDKjGEOyAL/jH6m/nrwgSdorI=; b=T25Za0G0tPTsmwX445ZvtDvyLlKipveRuIsSlJmDVoLtUrhrW4snePa+y9mQDPK8h1 /ofHDMuJ81jqoxXfWVUPk5ITgbucKxVi/2hkOYwIZ2w4vWTQ/9y9TSw6HrnmXZp9znZG fgx8Y04KKjnmTr3RguHjWdkhIm387rfOIwKFAVYR4tEBa/Ab7XESaNNr512qy2JQ4F+y HCpi7jpN3GKOlxp9QerMIvOSfLp1K+mD3wJRZEx0SAJ2qnyTMAqSytyOvOASnjI9RGX4 oOQ3cXss3ylNUm0ycwQYhlI9LyFFMUUfD1ToCY0qDtbc3/UBWgQmbKTsqz6kRugyDGFk ncKw==; dara=google.com ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@arri.de header.s=selector1 header.b=rdF8J28f; arc=pass (i=1); spf=pass (google.com: domain of ceggers@arri.de designates 2a01:111:f403:2613::601 as permitted sender) smtp.mailfrom=CEggers@arri.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arri.de Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20601.outbound.protection.outlook.com. [2a01:111:f403:2613::601]) by gmr-mx.google.com with ESMTPS id 5614622812f47-3d94d7b2ffdsi296901b6e.1.2024.07.12.08.26.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jul 2024 08:26:51 -0700 (PDT) Received-SPF: pass (google.com: domain of ceggers@arri.de designates 2a01:111:f403:2613::601 as permitted sender) client-ip=2a01:111:f403:2613::601; ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nUuUtzmDcce8+ZeSzr2dZ6a9egnfPLonkR4dAlDZDTntNuLKaLqzN1C9wFq9Cju/E6/XxmCXEtGn3sXYUCmF4e19TB4NgS6kGJPEZ3SldOf14V0+E79IuS7D/TwdaZksK9A0sCq73URig4FUOcM3UIfNoq9AENjkUgJ9eJomJ14VISDSFbZFHWteCDz5vUHWnDIkAqsDGVoO2uK/xeZrGatX1SFO+w2bQbT3OdAVtuf9kC1porddnM8RWBT9cXsOe8Yt9m06wqp4H08USaP2KbU+AkrutZd2cw1nyTLwe9EaTwPdvTUCcoVlwP7vQsz/ec3MsEcFeADvkNVa1lo8fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0XMylsbBKMefxyxS5S4e9kOpF5uoAf8O1lCWFN+lEO0=; b=LdQho4Ygce8Tqo+yZITOmJhHkiQSW22IeKLus9iXmukCh1HprOXQK8OvJGoT3dM6CMiCOpqzythZyFVb5Lc9imuVdd7POFakXTwLSNJbmwwq9W9XcvrMQhSg3OX8n5n27nZQNYoji9JRU3bDqeHXgXecNLuWaMFK+am5p8zB22a/6dK3nX9CW76MhKvmdoaBwd6iFKyTUMqhNhMWBH8VjKOFBe15PZzfXauppyER5gAxYvBJVTiNNBQKbXlP1ifCPDS2eGMRgJmUGWwIlPK2UoTFUo3TchrM0CLmsQdgefR3kOnmi3Jv/A7aglOesiV06+B3ZFp4KmpzO44H9Qr61g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 217.111.95.7) smtp.rcpttodomain=googlegroups.com smtp.mailfrom=arri.de; dmarc=fail (p=none sp=none pct=100) action=none header.from=arri.de; dkim=none (message not signed); arc=none (0) Received: from DB8P191CA0006.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:130::16) by PR3PR07MB6954.eurprd07.prod.outlook.com (2603:10a6:102:76::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.5; Fri, 12 Jul 2024 15:26:48 +0000 Received: from DB5PEPF00014B96.eurprd02.prod.outlook.com (2603:10a6:10:130:cafe::d9) by DB8P191CA0006.outlook.office365.com (2603:10a6:10:130::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23 via Frontend Transport; Fri, 12 Jul 2024 15:26:47 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 217.111.95.7) smtp.mailfrom=arri.de; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=arri.de; Received-SPF: Fail (protection.outlook.com: domain of arri.de does not designate 217.111.95.7 as permitted sender) receiver=protection.outlook.com; client-ip=217.111.95.7; helo=mta.arri.de; Received: from mta.arri.de (217.111.95.7) by DB5PEPF00014B96.mail.protection.outlook.com (10.167.8.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Fri, 12 Jul 2024 15:26:47 +0000 Received: from N9W6SW14.arri.de (192.168.54.130) by mta.arri.de (10.10.18.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Fri, 12 Jul 2024 17:26:47 +0200 From: Christian Eggers To: CC: Christian Eggers Subject: [swupdate] [PATCH v2 09/10] parser: print warning in case of type mismatch in sw-description Date: Fri, 12 Jul 2024 17:26:39 +0200 Message-ID: <20240712152639.4685-1-ceggers@arri.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240712152253.3702-1-ceggers@arri.de> References: <20240712152253.3702-1-ceggers@arri.de> MIME-Version: 1.0 X-Originating-IP: [192.168.54.130] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B96:EE_|PR3PR07MB6954:EE_ X-MS-Office365-Filtering-Correlation-Id: 98f2f0c7-8c07-448f-3e9e-08dca2870b9c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: eakj0/uGkJhPATJ47eA8gYvHJ5pr/JNTZpTZXV7Nh0cLUk16YVUdfd0wyXX9KUz/+fhpV7FgJ32elhSr4MAfi/zihHnDTtVLhawkEZdOyO/70hlLYPx17SGjlDtaZi3IVQFTZKIHzb6Smn2mdy9CV9364iBPd6WCR17HoBwTFFmOcYeB0MLFsJL5nfFwByjGbEO/cFdzWrJUdaYsJ1TG6Pdgyxlp5XN90r/7ZPecUFuYoh+aAlWR24uH2JMVRcGnjvodlG2pAA/8iJpPYlUE81exUj3pD4LnRGDTRx9oP6/f281ybWxiJCRPh55nt4yYO722uWNxIT4RyU1F7yNfD/l/vjZgPAYVxC8NcsAZlPJpNol92rlm/eWfJNAxgwYuk5C49ZK7/I4GdfZOzCYhiLYwlfz2YvDRO7vsTNejoC04gZcXRsKbWKgoIokihWMucQjC69hY5Z8ok0wWNiwWZZBOFuWw42ZGagm6S7JXD3iFUIrDKSX59+tujFLpaNqF6s9sh1NoxYf2p+o3ZBtCgmyJGmWNbtF7esIugtThjusFXNPTY+PGYu1WK6eblWQmbZz8wHW3UFRfBYeqo4447EgHjLWkrCF6J7HYynVPiTuKdi2inxY1MlyJ3jslbiNhbz0Db8HaSuMuCyDkSqr8HWD1coa3+YgwsG7lIepWSXyEdaPzG/ZiB19YghofKw37DHM4pI3Fnt/csiTszQrg7fwlxm5cBmaqDZJDa68YEtk/74sUnZDZKtGc5sZV7jskS9bV7uxP6dQYWIncKytpbIoEC6RD1JM4Z0CkyCYRNILpPMMVFOs6XKSKN0HwNLW/7AkPwlVKsGI6uL/n3bwA7k1ENYEvknC05oX9fnp34mkncbeVWsPij8VXLCfyZgrI4IbVqIi1KlS5PZkyw4X8F9hAQ/QfNM2OK+8aQaLwdlm4WdcUWu8ez64KNZfB66+uyEnXy9wD/AsjR+hHn2NKe+Wi88TiGlxjrnx2pN0kkLC6TNke9Nkz2+RIqCGqgMYNZu+jsPUyOUBiyyKJUcafSyspM/jFcKcZky0Oyr7Dh11+CUOs1jOTtl3R9FK+4jOyvx4CKzG2+3/wDwjf7g4PKfzQkF7aeAaNS5Jd9rHhYanm+6ZUXEvslLn2vIBChf/cfVEElh53KLagtt/Qfh2AlNYKld83pxBr6FBAf1u4KzERBQskxBUYuXCOEdrXTaZ2EaNESIGJl5yt6gu/eT2ybxwRoHYv2XoFKEzXr/ps4uB07zAMlPXELO1CLN9/xOmmcENu+4IefvXKf37TMuuEE+LuF+EQfnNj36iZ+kuxEJnBSq3eTGZ7JXzjC+CqOwuqS5f07noJc57qYz4CghxYwBHbVDir7LlGNyxzpbk5hpw11Ru2dnKGCkcYH5Mm5pcpDEaDXV+n5Tsn5+WM7aJdWPSxgBmv0KDfkik6UspTmXabbmQ/ZXSazPuPcFSIHodI X-Forefront-Antispam-Report: CIP:217.111.95.7;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mta.arri.de;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: arri.de X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2024 15:26:47.8060 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 98f2f0c7-8c07-448f-3e9e-08dca2870b9c X-MS-Exchange-CrossTenant-Id: e6a73a5a-614d-4c51-b3e3-53b660a9433a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=e6a73a5a-614d-4c51-b3e3-53b660a9433a;Ip=[217.111.95.7];Helo=[mta.arri.de] X-MS-Exchange-CrossTenant-AuthSource: DB5PEPF00014B96.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR07MB6954 X-Original-Sender: ceggers@arri.de X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@arri.de header.s=selector1 header.b=rdF8J28f; arc=pass (i=1); spf=pass (google.com: domain of ceggers@arri.de designates 2a01:111:f403:2613::601 as permitted sender) smtp.mailfrom=CEggers@arri.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arri.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Print a warning if a value in sw-description doesn't match the expected type. No assignment will happen in this case. Signed-off-by: Christian Eggers --- corelib/parsing_library_libconfig.c | 9 ++++++--- corelib/parsing_library_libjson.c | 11 +++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/corelib/parsing_library_libconfig.c b/corelib/parsing_library_libconfig.c index 4442cefd3c07..e99fbe9dfe9a 100644 --- a/corelib/parsing_library_libconfig.c +++ b/corelib/parsing_library_libconfig.c @@ -17,6 +17,7 @@ #include "generated/autoconf.h" #include "bsdqueue.h" #include "util.h" +#include "parsers.h" #include "parselib.h" #include "parselib-private.h" @@ -37,11 +38,13 @@ static unsigned int map_field_type(field_type_t type) } -static void get_value_libconfig(const config_setting_t *e, void *dest, field_type_t expected_type) +static void get_value_libconfig(const config_setting_t *e, const char *path, void *dest, field_type_t expected_type) { int parsed_type = config_setting_type(e); - if (parsed_type != map_field_type(expected_type)) + if (parsed_type != map_field_type(expected_type)) { + WARN("Type mismatch for %s field \"%s\"", SW_DESCRIPTION_FILENAME, path); return; + } switch (expected_type) { case TYPE_INT: *(int *)dest = config_setting_get_int(e); @@ -120,7 +123,7 @@ void get_field_cfg(config_setting_t *e, const char *path, void *dest, field_type if (!elem) return; - get_value_libconfig(elem, dest, type); + get_value_libconfig(elem, path, dest, type); } const char *get_field_string_libconfig(config_setting_t *e, const char *path) diff --git a/corelib/parsing_library_libjson.c b/corelib/parsing_library_libjson.c index 74db22fc63f1..9635ac2a0c2d 100644 --- a/corelib/parsing_library_libjson.c +++ b/corelib/parsing_library_libjson.c @@ -17,6 +17,7 @@ #include "generated/autoconf.h" #include "bsdqueue.h" #include "util.h" +#include "parsers.h" #include "parselib.h" #include "parselib-private.h" @@ -118,12 +119,14 @@ const char *get_field_string_json(json_object *e, const char *path) return NULL; } -static void get_value_json(json_object *e, void *dest, field_type_t expected_type) +static void get_value_json(json_object *e, const char *path, void *dest, field_type_t expected_type) { enum json_type parsed_type; parsed_type = json_object_get_type(e); - if (parsed_type != map_field_type(expected_type)) + if (parsed_type != map_field_type(expected_type)) { + WARN("Type mismatch for %s field \"%s\"", SW_DESCRIPTION_FILENAME, path); return; + } switch (expected_type) { case TYPE_BOOL: *(bool *)dest = json_object_get_boolean(e); @@ -164,9 +167,9 @@ void get_field_json(json_object *e, const char *path, void *dest, field_type_t t if (path) { if (json_object_object_get_ex(e, path, &fld)) - get_value_json(fld, dest, type); + get_value_json(fld, path, dest, type); } else { - get_value_json(e, dest, type); + get_value_json(e, path, dest, type); } }