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: Mon, 20 May 2019 12:07:54 -0600 Message-ID: <87zhnhuhhh.fsf@gmail.com> References: 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="117599"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: emacs-devel To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 20 20:08:38 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 1hSmiD-000UQX-Jz for ged-emacs-devel@m.gmane.org; Mon, 20 May 2019 20:08:37 +0200 Original-Received: from localhost ([127.0.0.1]:39937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSmiC-0002Rm-4t for ged-emacs-devel@m.gmane.org; Mon, 20 May 2019 14:08:36 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSmha-0002NC-DQ for emacs-devel@gnu.org; Mon, 20 May 2019 14:07:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSmhZ-00027i-E2 for emacs-devel@gnu.org; Mon, 20 May 2019 14:07:58 -0400 Original-Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:36240) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSmhZ-000277-7N for emacs-devel@gnu.org; Mon, 20 May 2019 14:07:57 -0400 Original-Received: by mail-pl1-x62e.google.com with SMTP id d21so7082413plr.3 for ; Mon, 20 May 2019 11:07:56 -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=0otTnBx6n5PTKUGbQnNt4JTeHEpI1bwAQqdwzsu/zoI=; b=j9yqmpjJVvKv2+eXhr6W4hPErSRm6rvd/4sK/cyb3ssje6iaTsdY+9NtWRwM6e0p4K q6frYr+OCuJBUbEvhzxtu0d4+BSHcfyfJwprf1gZCRLUQJ3VMAGhAUh+YE9AyAMDTKi3 Lb0wS3J13pLWwpGB7AmZUpQG0IGjRiIkQ184nK77Oa4t3EsC7IKbTO63AbxxxJhRDgsn 3fVCYoeNBNMBw4vJ+q7hcrMwge2PuO3avVBwaQ8NsvO/UdwsRc9pTNV2z674g+3y7DtM WF1PZN8Fn0IqaTaJcqOiAYSn9gUHpAjWYbd77gmn8imioMz4ygSm/B0xKCMjXxJJV6oW C3NQ== 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=0otTnBx6n5PTKUGbQnNt4JTeHEpI1bwAQqdwzsu/zoI=; b=TfSGeH6+7vlaTUy1q00CmTol16OwkCHUS+PT8uTYFchkKp73adoGgZDZ8sOwyGIdS+ uiTi6wX7gE9AB8YPSIzTybF5TjxIIQZaIDWBlvEojX5Hm8jx2IpgEaVIfaCEVVXQrLEg /gCLJZ91H/1PFuYyaEeiXxdrONxwL42Uhh3pCAl7An29exznZg4kg3jFWZ72XeZhxsjl Tz4wuL3H+RRzAgAiTWivknyKxQuEL0yQ0KRpilGFdh7Wf6CA4jhsaPaiv5HRSQH+rdOP bEZiii0PBRSUzXyB6kCSTBdRhArsvPpoh8Aj0OzTCok6d6wovOO5tJbsg5AhHCwcqBlk wGSg== X-Gm-Message-State: APjAAAVE+N/HRFzS5yg5Os+jTuyXlgc9QXQYWi46aUbSrhE5Mr75ZPvR EqYHxVkY16sk1mflFrvCI3iDCW+i X-Google-Smtp-Source: APXvYqxm4wgAL86vnlHIQtvT6pgxXSz/iJfW5bl60uEmWQT28Qx4gYA99SPHGZmWy6Et00kGwkRtbg== X-Received: by 2002:a17:902:2a2b:: with SMTP id i40mr77131626plb.170.1558375675135; Mon, 20 May 2019 11:07:55 -0700 (PDT) Original-Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id o7sm27222837pfp.168.2019.05.20.11.07.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 May 2019 11:07:54 -0700 (PDT) In-Reply-To: (martin rudalics's message of "Mon, 20 May 2019 10:26:05 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::62e 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:236809 Archived-At: --=-=-= Content-Type: text/plain martin rudalics writes: > After this commit, building master on Windows here produces > > > > CC w32term.o > ../../src/w32font.c: In function 'w32font_draw': > ../../src/w32font.c:708:25: warning: passing argument 6 of 'ExtTextOutW' from incompatible pointer type [-Wincompatible-pointer-types] > s->char2b + from + i, 1, NULL); > ~~~~~~~~~~~~~~~~~^~~ > In file included from C:/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:71, > from ../../src/w32font.c:20: > C:/msys64/mingw64/x86_64-w64-mingw32/include/wingdi.h:3347:100: note: expected 'LPCWSTR' {aka 'const short unsigned int *'} but argument is of type 'unsigned int *' > WINGDIAPI WINBOOL WINAPI ExtTextOutW(HDC hdc,int x,int y,UINT options,CONST RECT *lprect,LPCWSTR lpString,UINT c,CONST INT *lpDx); > ~~~~~~~~^~~~~~~~ > ../../src/w32font.c:711:57: warning: passing argument 6 of 'ExtTextOutW' from incompatible pointer type [-Wincompatible-pointer-types] > ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, len, NULL); > ~~~~~~~~~~^~~~~~ > In file included from C:/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:71, > from ../../src/w32font.c:20: > C:/msys64/mingw64/x86_64-w64-mingw32/include/wingdi.h:3347:100: note: expected 'LPCWSTR' {aka 'const short unsigned int *'} but argument is of type 'unsigned int *' > WINGDIAPI WINBOOL WINAPI ExtTextOutW(HDC hdc,int x,int y,UINT options,CONST RECT *lprect,LPCWSTR lpString,UINT c,CONST INT *lpDx); > ~~~~~~~~^~~~~~~~ > CC w32xfns.o > > > > and the resulting build is not usable. > > martin Does the following diff work for you? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=w32font.diff Content-Description: w32font diff --git a/src/w32font.c b/src/w32font.c index bd68e22cc9..fe85601380 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -704,11 +704,20 @@ 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_ALLOCA (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) --=-=-=--