From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alex Gramiak Newsgroups: gmane.emacs.devel Subject: Re: Replace XChar2b with unsigned in all font backends Date: Tue, 21 May 2019 15:32:09 -0600 Message-ID: <8736l7v6hy.fsf@gmail.com> References: <87zhnhuhhh.fsf@gmail.com> <58ecf97c-5191-f5d6-022d-6870b9a9f9cf@gmx.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="157628"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: Andy Moreton , emacs-devel To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 21 23:33:01 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hTCNY-000ep5-8y for ged-emacs-devel@m.gmane.org; Tue, 21 May 2019 23:33:00 +0200 Original-Received: from localhost ([127.0.0.1]:59767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTCNW-0002dO-PD for ged-emacs-devel@m.gmane.org; Tue, 21 May 2019 17:32:58 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43010) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTCMs-0002d8-An for emacs-devel@gnu.org; Tue, 21 May 2019 17:32:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTCMq-0000BI-MV for emacs-devel@gnu.org; Tue, 21 May 2019 17:32:17 -0400 Original-Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:32813) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTCMm-0008WS-Vb for emacs-devel@gnu.org; Tue, 21 May 2019 17:32:15 -0400 Original-Received: by mail-pl1-x634.google.com with SMTP id g21so974079plq.0 for ; Tue, 21 May 2019 14:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=iNLJ20Hx8g/J/LUNqpuuTgh8DjJzrpyUChviyDC1Pdg=; b=ET/ftri9r2OIeZXlGLLBopl+vf0lQgz/EdKKaSnPV+5dhSb4QnCfkV0AShFNg5FNrO KAy6uRJWOpIWQeFsrPu9EWlQw/jp6Ovv34PTm81+MN1cwQ9VqKwp55zJ6shm0vigJs0c sN8S0PBZYWWRStQf2EPh0jS/Tm8j2ZZb9nnzjThAzFo3ufqS3QDatY/GLW9JyVOD76Lp T+7adSdbKk/nH61Os7ETJTi6Ep+NtKMiIQzEXumBGyWah0cdgV7g3/U33to64GANNtgd AwBYfyiGRxOx/GazYJ2Lbi8WLxUs/kBFFt7fd+mresM8B9OQGLOyr7ildZAPjs8NydG/ ZmEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=iNLJ20Hx8g/J/LUNqpuuTgh8DjJzrpyUChviyDC1Pdg=; b=X4tMxSgDtge3BvZoJ92QanPIF+ggIzb1+p3NJzzNgBDnZn6RYITtADpvAzKQ0SEtQ4 3cf4Omz4ZuKP4qz4HHh2Bx2CNhJ9ues9tCdGTUzCbsJvDxuhUBKz5GoBJD9y1hbXcnZc 4d6qqoureu5xPsAMCWlEjcF3Vb+BQU6BN2qOaKShVXE9h5wbqxH5CjdhLgr+5KgFcZuP loqFw77h3PsKuZdB908xN2tY5x9pzI8Gx++FlLX/XNG/M6KsdKYwi0n6JF27Am5MWeX/ ViXxYzKzRxPp2zHlr4dw6BsyrJcc/UIyUAtdD0wN2dFX1jNWHxssWhPKf51g94l4Drn2 jdww== X-Gm-Message-State: APjAAAWzIMc9Bosfyhxal04EVypVQjtRGkMHh8kMXQPngMzMIEzqdYT6 kQxOF1hTMjeUc1cbg3IX8fk= X-Google-Smtp-Source: APXvYqy6CTQpbKTpXFKz43YB1YyG/oF4XjQsDftAyxgwwGjjoSdZxrfDS3miSqemvuTmJ3GMrj4s7w== X-Received: by 2002:a17:902:9007:: with SMTP id a7mr230834plp.221.1558474326651; Tue, 21 May 2019 14:32:06 -0700 (PDT) Original-Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id q142sm25160769pfc.27.2019.05.21.14.32.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 May 2019 14:32:05 -0700 (PDT) In-Reply-To: <58ecf97c-5191-f5d6-022d-6870b9a9f9cf@gmx.at> (martin rudalics's message of "Tue, 21 May 2019 09:33:04 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::634 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236869 Archived-At: --=-=-= Content-Type: text/plain martin rudalics writes: >> Does the following diff work for you? > > The warnings go away but characters are still displayed as empty > boxes. Right, that's not unexpected since I made a flub on that patch and didn't multiply by sizeof (wchar_t) (I posted a version that fixed that in another message but didn't CC you, sorry). Here's a third version that uses SAFE_NALLOCA instead: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=w32font.diff Content-Description: w32font v3 diff --git a/src/w32font.c b/src/w32font.c index bd68e22cc9..08d0f370bf 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -704,11 +704,21 @@ w32font_draw (struct glyph_string *s, int from, int to, int i; for (i = 0; i < len; i++) - ExtTextOutW (s->hdc, x + i, y, options, NULL, - s->char2b + from + i, 1, NULL); + { + const wchar_t ch = s->char2b[from + i]; + ExtTextOutW (s->hdc, x + i, y, options, NULL, &ch, 1, NULL); + } } else - ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, len, NULL); + { + USE_SAFE_ALLOCA; + wchar_t *str; + SAFE_NALLOCA (str, 1, len); + for (int i = 0; i < len; ++i) + str[i] = s->char2b[from + i]; + ExtTextOutW (s->hdc, x, y, options, NULL, str, len, NULL); + SAFE_FREE (); + } /* Restore clip region. */ if (s->num_clips > 0) --=-=-=--