From patchwork Thu Aug 15 11:54:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Sowden X-Patchwork-Id: 13764704 Received: from azazel.net (taras.nevrast.org [35.176.194.208]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C239C7DA9F for ; Thu, 15 Aug 2024 11:54:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.176.194.208 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723722871; cv=none; b=g5ltLPrX7pBn3pcS7nAgW+VYC+osJrAQpxKd2snrx4cJLri6yRzWqLh/dKiTibxZ05wI9Q03c3wEatutyiTrmIdSKCGNhXjQ03T/N1u4y5cGk6OKzuvWLRw5jcyAz23S1iPYlt/yV0d09zvlgq0fGUgGrEnz6dpEKyl8yEjwjnE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723722871; c=relaxed/simple; bh=MOA6KauWo57lSSDDmM60VY7SV4gVdVsAu6JfiRQPuDo=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mWanuzys0Duut4VjTYnaQr/XFsdz1BJ0Aks0ib4vcB2u6NQ8NyhHRDkQNoExTFYmfoiDS6fea1fZyJccNPS9fjeeUU6OXrTYwV6GNDmIDahk/C2d3XtPzqiwgA1g2DeCgif/t2n9uLeSFlUYfETwUqMg5qr2SjXf9unrP0i3Bq8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=azazel.net; spf=pass smtp.mailfrom=azazel.net; dkim=pass (2048-bit key) header.d=azazel.net header.i=@azazel.net header.b=kmcbaxRx; arc=none smtp.client-ip=35.176.194.208 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=azazel.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=azazel.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=azazel.net header.i=@azazel.net header.b="kmcbaxRx" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=azazel.net; s=20220717; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=vN93bRKca0zv/L2pwmGS4rrzVdQ3N7QEPwLt8BVq+qo=; b=kmcbaxRx8ogtkCQhlZGc1THTqL gfgNDT10wzv2iL+ZAkPUmKtPNAChpDPP1yg0Cw/aKzTstjJ+qu1a+cUgr6za5rkHQ56Lo68S9e8T8 UXT71EjfQ1+mN+7J2dxsIYva8Cg1CYJ5m79MRIDxeJdYZ7nfAltDZds4Trr7hGBEjZHLjr+/vSu5I Xeinkzo0y+Rh6g3wD1aT2rPxqQmne+tJNUFd0fYgOJQS3lOVh7jdwmz4eXUQTnF3IF1q8QY2OxpM8 IES9QduqD6x5WNRxVYiRCucDj48ev5lc8jLsXphPp1hr+5C4LfaMBx9yhcXqOgrzYq/fQhOT1MbIT TwTRIedg==; Received: from ulthar.dreamlands.azazel.net ([2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae]) by taras.nevrast.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1seZ3i-00CeCX-05 for linux-media@vger.kernel.org; Thu, 15 Aug 2024 12:54:26 +0100 From: Jeremy Sowden To: Linux Media Subject: [PATCH xawtv3 1/2] Fix gcc-14 compilation failures caused by incompatible pointer types Date: Thu, 15 Aug 2024 12:54:14 +0100 Message-ID: <20240815115415.3371544-2-jeremy@azazel.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240815115415.3371544-1-jeremy@azazel.net> References: <20240815115415.3371544-1-jeremy@azazel.net> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae X-SA-Exim-Mail-From: jeremy@azazel.net X-SA-Exim-Scanned: No (on taras.nevrast.org); SAEximRunCond expanded to false `XawListChange` declares the type of its second parameter as `_Xconst char **`. However, xawtv passes `str_list`, which is declared as `String *`, or `&empty` which is declared as `char *`. With gcc 14, these result in incompatible-pointer errors: x11/propwatch.c: In function 'RebuildList': x11/propwatch.c:319:43: error: passing argument 2 of 'XawListChange' from incompatible pointer type [-Wincompatible-pointer-types] 319 | XawListChange(bl,str_count ? str_list : &empty, | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ | | | char ** In file included from x11/propwatch.c:28: /usr/include/X11/Xaw/List.h:170:27: note: expected 'const char **' but argument is of type 'char **' 170 | _Xconst char **list, | ^ x11/propwatch.c: In function 'ProcessPropertyChange': x11/propwatch.c:498:34: error: passing argument 2 of 'XawListChange' from incompatible pointer type [-Wincompatible-pointer-types] 498 | XawListChange(bl,str_list,str_count,1000,1); | ^~~~~~~~ | | | char ** /usr/include/X11/Xaw/List.h:170:27: note: expected 'const char **' but argument is of type 'char **' 170 | _Xconst char **list, | ^ Both variables are only used as arguments to `XawListChange`, so change their types to match its expectations. Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075650 Signed-off-by: Jeremy Sowden --- x11/propwatch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x11/propwatch.c b/x11/propwatch.c index 465c4ea1546e..f7aac657a4c8 100644 --- a/x11/propwatch.c +++ b/x11/propwatch.c @@ -58,8 +58,8 @@ static char *watch_default[] = { "WM_COMMAND", }; -static String *str_list; -static int str_count; +static const char **str_list; +static int str_count; static void AddWatch(Display *dpy, Window win, int i); static void DeleteWatch(Window win); @@ -306,13 +306,13 @@ cmp(const void *a, const void *b) static void RebuildList(void) { - static char *empty = "empty"; + static const char *empty = "empty"; int i; struct WATCHLIST *this; if (str_list) free(str_list); - str_list = malloc(str_count*sizeof(String)); + str_list = malloc(str_count*sizeof(*str_list)); for (i=0, this=watchlist; this!=NULL; i++, this=this->next) str_list[i] = this->text; qsort(str_list,str_count,sizeof(char*),cmp); From patchwork Thu Aug 15 11:54:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Sowden X-Patchwork-Id: 13764705 Received: from azazel.net (taras.nevrast.org [35.176.194.208]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C242815D5D8 for ; Thu, 15 Aug 2024 11:54:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.176.194.208 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723722871; cv=none; b=Qf5Ch7kpEm0cNL57xLTzwmC/RbJQjlA24UplrzwCr8uk7S57IIBNAW4FXLng34U5lDy/V5e024YA/ub0VDuMFXJwC8+Y3Hfq+DG4y61t87GT42rW5QGFpwx5IlgOE2hxhl4RzcH3k0MeMBvuRRSo7Rg8iHmvVbDfg0S56wQdpR8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723722871; c=relaxed/simple; bh=in0SgKVukHQVY7hSNzsyXaEqTq7VkY9phTEYgRHw+us=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HtIB/34fSy8UC3ZFRGbLDUclL1IzI91z5TOL6l78fUwZtgVwtE3ytddsXbtdsMT03GcbmAp8kPiGIPF1nDzyMjfFJ1eT9m3Z0b9a4YCEjd1KAmWsO/7heGhqTBYcdnQVzn7kTKNQIKlYgbDljXeQdwkWZTAcdLEg3YrjjrS37Dc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=azazel.net; spf=pass smtp.mailfrom=azazel.net; dkim=pass (2048-bit key) header.d=azazel.net header.i=@azazel.net header.b=HKLBHKcE; arc=none smtp.client-ip=35.176.194.208 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=azazel.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=azazel.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=azazel.net header.i=@azazel.net header.b="HKLBHKcE" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=azazel.net; s=20220717; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=GRkjbYMXHTGu0tW3xWL2oeZwgq5QTLtjAllLA/Z9oyU=; b=HKLBHKcEZhK7bzpGUIFnn9XRtC I4bjEY13ypX24PFbpbl0YlLOyz0pUI/dEqQN0k9VJKdvceLtV3BfzLb7z0uhPKrUgoYOxkvwFaFQL R/5O7lCRHJALcUnwVxKyydSWgPc6gqg0+CLxDCcY9W29J75g7vrN4/iD2zfrEb9dBkcRDTAbNwcaH NMEFH+4m0mxkjiydj9lkGP4z7QD5XOHxh1it1M4Ogk9AANKl7SxcgFLdZc6XEredCYmYK530XVshy 8glrYJB995lv6XcFD3EiX4HLnmxjlNBHIMseBrqOI8wsuevqcQGfa4EXgQO3qZqP3MpFe9uGSBdTf NVqozMBA==; Received: from ulthar.dreamlands.azazel.net ([2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae]) by taras.nevrast.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1seZ3i-00CeCX-0D for linux-media@vger.kernel.org; Thu, 15 Aug 2024 12:54:26 +0100 From: Jeremy Sowden To: Linux Media Subject: [PATCH xawtv3 2/2] Use `pclose` to close file-pointer created with `popen` Date: Thu, 15 Aug 2024 12:54:15 +0100 Message-ID: <20240815115415.3371544-3-jeremy@azazel.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240815115415.3371544-1-jeremy@azazel.net> References: <20240815115415.3371544-1-jeremy@azazel.net> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:8b0:fb7d:d6d7:2e4d:54ff:fe4b:a9ae X-SA-Exim-Mail-From: jeremy@azazel.net X-SA-Exim-Scanned: No (on taras.nevrast.org); SAEximRunCond expanded to false gcc reports: x11/man.c: In function 'man': x11/man.c:106:5: warning: 'fclose' called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc] 106 | fclose(fp); | ^~~~~~~~~~ x11/man.c:69:10: note: returned from 'popen' 69 | fp = popen(line,"r"); | ^~~~~~~~~~~~~~~ and the popen(3) man-page states: The return value from popen() is a normal standard I/O stream in all respects save that it must be closed with pclose() rather than fclose(3). Signed-off-by: Jeremy Sowden --- x11/man.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x11/man.c b/x11/man.c index 482980565a63..b71785c31ab4 100644 --- a/x11/man.c +++ b/x11/man.c @@ -103,7 +103,7 @@ man(char *page) } XtVaSetValues(label,XmNlabelString,xmpage,NULL); XmStringFree(xmpage); - fclose(fp); + pclose(fp); } void