From nobody Mon Nov 18 22:32:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1602546435; cv=none; d=zohomail.com; s=zohoarc; b=Xm0o9bx+tshUcL/CkO2o99FG4xU6Nf1/XxDPTvra0XIOTsGsguFJpZJjsa1w/wJt6W/SyS6wLOSxnFBjq484KwuxqtYmAowxjk4d7L1iQ5dToAQFcuA8jaQeCzimGMD1id0piY9JayfOTlENwgT7olzQJLoS3NP98poBdvI5huo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602546435; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=osDuBexc0c2Z/UkkEDC13D1bBBlZceyQBMzfamn0QDg=; b=B/y4k6u+vf0afOUFtu72CTpiIflSSZnd17VXA6fU2mgbYNI2mJPWTusCi8mC7iOElvQuY3a/EfpCNB5bVKJdF9SYvXyvUwNNYM8Z6eAO3WjRmdb62HUmnMkG2ycxHuGwWQZ8WAaNk2lzLAzNymAtCHOg1Cw+CN6ENCm9mD1tcGM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602546435600749.1631755035866; Mon, 12 Oct 2020 16:47:15 -0700 (PDT) Received: from localhost ([::1]:43050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS7X8-0003Rn-Hn for importer@patchew.org; Mon, 12 Oct 2020 19:47:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kS7UM-00005s-Jr; Mon, 12 Oct 2020 19:44:22 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:34142) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kS7UG-0007iB-OE; Mon, 12 Oct 2020 19:44:22 -0400 Received: by mail-pf1-x444.google.com with SMTP id e10so15278204pfj.1; Mon, 12 Oct 2020 16:44:15 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id j3sm9714890pjv.20.2020.10.12.16.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 16:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=osDuBexc0c2Z/UkkEDC13D1bBBlZceyQBMzfamn0QDg=; b=Sssoe6LXH+8+WFEsZyobZupHt3viWiS2Y9FrNSb16J+VCOsmTp+4k1ftCgo3LXiqwU vFOcWSr5oUtyxmCI92lXrpTW8d+oo8bbhTayN3R+lXPJVGhv/YbhoK+k6aBjUHRJr0q5 hNt7Gfibt1YZzjN2erVmzn03QSE3RXVeypCS4IzHURBNRc0RqhrkgQ8F9HprSo6nmzvI jVIYS0LFkubJyBZddHimmRW00KD02d3i+FbRMron0fNEdFZMiOhiEh0FphXaydhIGsHW 6roZTjnT6psjMI/qn1GI+ni0v5951i7HbVz8mSrFUJ3CoxA4kg3Bc6Pg1HILMY5Bj8Vr n1zw== 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:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=osDuBexc0c2Z/UkkEDC13D1bBBlZceyQBMzfamn0QDg=; b=KSahCwRVJCQzY4fAd1wcVLTPl+nU99lVeim+B1lkp+lpHrF5gKa/+s7TkHjmvcyU0G cm0CEL4xNMSd1JE3SmpmNGfTIVwGOk0fAk7w0OH8z7bwSYz8QauCPKw7ZREtNTbCnaey AvEeaJOTgEVW3CLYTly5eQubhWYyTbyJnt8sIP+NBcsHzRe51wZnWa7DB4zs/NxHoTpc Repih3yESU8Sxxb5IgViYelVIyZnsZZCEUygZlxAOImctDxYa9u0+hCd4R3Q+mmOXjVm xcK6vGhdEBOnHvIZGOg1AsvDO/tvijyF0OVJBQrm6GOWfpclMVoaJQmO+xzRJIm3mfb4 1tBg== X-Gm-Message-State: AOAM531J/DO2ePvXFmv1it0pmDqEUT0TiOgTKpsvbhSdWB7m6WzNx9MI 7CSs7SnXXyQzEjICANzWk7rLUn0M0fJ84w== X-Google-Smtp-Source: ABdhPJxnP3VDkwphZIBFJhXbiKYo+T09OENj/hTotH4r9+XS5MVyvnMkgsdaYHZYyQA08aCvj+iQ5Q== X-Received: by 2002:a17:90a:4f0f:: with SMTP id p15mr22772854pjh.10.1602546254414; Mon, 12 Oct 2020 16:44:14 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH v9 2/5] curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw Date: Tue, 13 Oct 2020 07:43:45 +0800 Message-Id: <20201012234348.1427-3-luoyonggang@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20201012234348.1427-1-luoyonggang@gmail.com> References: <20201012234348.1427-1-luoyonggang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::444; envelope-from=luoyonggang@gmail.com; helo=mail-pf1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Trivial , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , Yonggang Luo , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) msys2/mingw lacks the POSIX-required langinfo.h. gcc test.c -DNCURSES_WIDECHAR -I/mingw64/include/ncursesw -pipe -lncursesw = -lgnurx -ltre -lintl -liconv test.c:4:10: fatal error: langinfo.h: No such file or directory 4 | #include | ^~~~~~~~~~~~ compilation terminated. So we using g_get_codeset instead of nl_langinfo(CODESET) Signed-off-by: Yonggang Luo Reviewed-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- configure | 5 +---- ui/curses.c | 10 +++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 1b63488521..71a574f718 100755 --- a/configure +++ b/configure @@ -3530,17 +3530,14 @@ if test "$curses" !=3D "no" ; then #include #include #include -#include int main(void) { - const char *codeset; wchar_t wch =3D L'w'; setlocale(LC_ALL, ""); resize_term(0, 0); addwstr(L"wide chars\n"); addnwstr(&wch, 1); add_wch(WACS_DEGREE); - codeset =3D nl_langinfo(CODESET); - return codeset !=3D 0; + return 0; } EOF IFS=3D: diff --git a/ui/curses.c b/ui/curses.c index a59b23a9cf..12bc682cf9 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -30,7 +30,6 @@ #endif #include #include -#include #include =20 #include "qapi/error.h" @@ -526,6 +525,7 @@ static void font_setup(void) iconv_t nativecharset_to_ucs2; iconv_t font_conv; int i; + g_autofree gchar *local_codeset =3D g_get_codeset(); =20 /* * Control characters are normally non-printable, but VGA does have @@ -566,14 +566,14 @@ static void font_setup(void) 0x25bc }; =20 - ucs2_to_nativecharset =3D iconv_open(nl_langinfo(CODESET), "UCS-2"); + ucs2_to_nativecharset =3D iconv_open(local_codeset, "UCS-2"); if (ucs2_to_nativecharset =3D=3D (iconv_t) -1) { fprintf(stderr, "Could not convert font glyphs from UCS-2: '%s'\n", strerror(errno)); exit(1); } =20 - nativecharset_to_ucs2 =3D iconv_open("UCS-2", nl_langinfo(CODESET)); + nativecharset_to_ucs2 =3D iconv_open("UCS-2", local_codeset); if (nativecharset_to_ucs2 =3D=3D (iconv_t) -1) { iconv_close(ucs2_to_nativecharset); fprintf(stderr, "Could not convert font glyphs to UCS-2: '%s'\n", @@ -581,7 +581,7 @@ static void font_setup(void) exit(1); } =20 - font_conv =3D iconv_open(nl_langinfo(CODESET), font_charset); + font_conv =3D iconv_open(local_codeset, font_charset); if (font_conv =3D=3D (iconv_t) -1) { iconv_close(ucs2_to_nativecharset); iconv_close(nativecharset_to_ucs2); @@ -602,7 +602,7 @@ static void font_setup(void) /* DEL */ convert_ucs(0x7F, 0x2302, ucs2_to_nativecharset); =20 - if (strcmp(nl_langinfo(CODESET), "UTF-8")) { + if (strcmp(local_codeset, "UTF-8")) { /* Non-Unicode capable, use termcap equivalents for those availabl= e */ for (i =3D 0; i <=3D 0xFF; i++) { wchar_t wch[CCHARW_MAX]; --=20 2.28.0.windows.1