From patchwork Mon May 22 14:47:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 69805 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 03F173858D35 for ; Mon, 22 May 2023 14:48:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 03F173858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684766892; bh=RmwJivqiABViXUrU11Jf0zuh1qPuF9n8gWhbePKfRYg=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=U1Khx4Vh0x/1gEcF9wlppm1kbvbbRRSgF3oBkmPNpTt+Am3I0B8gXoEcUU7T/KWm0 Eq4RU9Vp8Lp68/XRtgsGqFW0uYYPBkV7IX2xLVmm+/79gROFmOoMhi4ZDjZgEwZahq M21T9t8AizYZzwVdIWPwKtebynQKJSGLWWLEEULI= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id C6ECF3858430 for ; Mon, 22 May 2023 14:47:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C6ECF3858430 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 053A41FF7C; Mon, 22 May 2023 14:47:48 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E418B13776; Mon, 22 May 2023 14:47:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id HLeVNpOAa2TkKgAAMHmgww (envelope-from ); Mon, 22 May 2023 14:47:47 +0000 Message-ID: Date: Mon, 22 May 2023 16:47:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: [pushed] [gdb/tui] Fix buglet in tui_update_variables Content-Language: en-US To: gdb-patches@sourceware.org Cc: Tom Tromey References: <20230508141036.22723-1-tdevries@suse.de> <20230508141036.22723-3-tdevries@suse.de> In-Reply-To: <20230508141036.22723-3-tdevries@suse.de> X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" [ was: Re: [PATCH 2/3] [gdb/tui] Fix buglet in set_border_kind_item ] On 5/8/23 16:10, Tom de Vries via Gdb-patches wrote: > While factoring out set_border_kind_item I noticed a buglet: > ... > struct tui_translate *entry = translate (key, dict); > > if (*lval != (chtype) entry->value) > { > *lval = (entry->value < 0) ? acs : entry->value; > ... > > When assigning the new value to *lval, an entry->value of -1 is taken into > account, but not when comparing to the current value of *lval. > > Fix this by introducing: > ... > int val = (entry->value < 0) ? acs : entry->value; > ... > and using this in both comparison and assignment. > I'm not sure if the enhancement "border-kind active-ascii" will make it, so I've ported this fix to trunk and committed. Thanks, - Tom From cd1ed1fd2e8ccec34008d03a9b25132f4eb3bf64 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 8 May 2023 13:24:08 +0200 Subject: [pushed] [gdb/tui] Fix buglet in tui_update_variables I noticed a buglet in tui_update_variables: ... entry = translate (tui_border_kind, tui_border_kind_translate_lrcorner); if (tui_border_lrcorner != (chtype) entry->value) { tui_border_lrcorner = (entry->value < 0) ? ACS_LRCORNER : entry->value; ... When assigning the new value to tui_border_lrcorner, an entry->value of -1 is taken into account, but not when comparing to the current value of tui_border_lrcorner. Fix this by introducing: ... int val = (entry->value < 0) ? ACS_LRCORNER : entry->value; ... and using this in both comparison and assignment. Tested on x86_64-linux. --- gdb/tui/tui-win.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 6710b3e17e5..7abd1e225b9 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -300,9 +300,10 @@ tui_update_variables () Only check the first one. The ACS characters are determined at run time by curses terminal management. */ entry = translate (tui_border_kind, tui_border_kind_translate_lrcorner); - if (tui_border_lrcorner != (chtype) entry->value) + int val = (entry->value < 0) ? ACS_LRCORNER : entry->value; + if (tui_border_lrcorner != (chtype) val) { - tui_border_lrcorner = (entry->value < 0) ? ACS_LRCORNER : entry->value; + tui_border_lrcorner = val; need_redraw = true; } entry = translate (tui_border_kind, tui_border_kind_translate_llcorner); base-commit: 7a8a6f57eced9a8c27a93cb5c5977a33be7b1f72 -- 2.35.3