From patchwork Thu Oct 1 17:32:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 11812121 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ECEF892C for ; Thu, 1 Oct 2020 17:55:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93B7B21707 for ; Thu, 1 Oct 2020 17:55:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lMQzmh67" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93B7B21707 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:50472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kO2no-0006P6-Ly for patchwork-qemu-devel@patchwork.kernel.org; Thu, 01 Oct 2020 13:55:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kO2Rv-0004ic-3q; Thu, 01 Oct 2020 13:32:59 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:46366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kO2Rs-0005Df-N7; Thu, 01 Oct 2020 13:32:58 -0400 Received: by mail-pf1-x441.google.com with SMTP id b124so5190339pfg.13; Thu, 01 Oct 2020 10:32:55 -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=38P1i5JkQS7ofb/RLUKRo29Ks91Vqq7zgVYwAGpHkHw=; b=lMQzmh67JMvOY+1NHCOZ+gV9iKaz83cqeGY4LxAfoaX6VrBTyYeCQqURxtaCNMJ30S XDVK5nyLE9huVIUmYVMgWtLQC6BCqbInNTzcLcyY4uBd38Ft7HXCswWKzO4riPKTzAHc iDRQeKvaC/Df50aMUMg9XkWALGL3+c+T8t9EbHTr3qxgh2n5dJEeUH7+CZj5qMDN9CmR HEFXY3qjFQ5vGSdP6+nFk19UKG5XuxQiMS0txhgpmrJFRMrOSITgwVQGujdZqMZZbJ40 cSXX7Y20VY3DSl07tgXITeS68WIugnb+O0E9LNw7HTjRS93pISn7rY/SIQe+yr/9FQMb xjLQ== 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=38P1i5JkQS7ofb/RLUKRo29Ks91Vqq7zgVYwAGpHkHw=; b=Ed7X6oMuFjfsWwc6Ks3bLBBJoDP/FI5tcT0nH0GNW5/Uzy/bgnZnOlfnrOxk29mGN0 lZkHq7AVaATpSQxTAmxh5a4AIoMxJZkCHgFZO1UPfIvrDe3UojmPujxWiAhRdEcCvS1C 4Sl459Dz6/Ng0IuJg0mlaijj3CF1WmYwe8TFXb28yPcu/XtPDKVE7lk8q+/fAUBIKkgX M+Uqq+aEkJFE/CydZ2mUi8oK3snDSHA2Hb/XXq5GIMaTwQSZVC4p7tA/9XJeMCO/U+za /zU05hkenHV406m1ORqBu8Be5g1O3gHK+9S/ucIRfVnM//YpkE4venVDdcLJRjQa1AdM Jvhg== X-Gm-Message-State: AOAM533h/eKo91YXlBMfzV5G0lhYLbPdk6p2oO2yvEUU6auJcPPJYsv+ pJ3LqighISnUAvq3ZrtB0KUjurOZnOnJBw== X-Google-Smtp-Source: ABdhPJyih6h3zqzIPgZyn4H2VOmauvHJ/HkC+Kp4cwoXY9Moba4Ikmr9XpSmSYYhU6ZJJBaioC2xCQ== X-Received: by 2002:a63:1863:: with SMTP id 35mr6999333pgy.413.1601573574454; Thu, 01 Oct 2020 10:32:54 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id b20sm7253767pfb.198.2020.10.01.10.32.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:32:53 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Subject: [PATCH v6 2/4] curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw Date: Fri, 2 Oct 2020 01:32:28 +0800 Message-Id: <20201001173230.829-3-luoyonggang@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20201001173230.829-1-luoyonggang@gmail.com> References: <20201001173230.829-1-luoyonggang@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::441; envelope-from=luoyonggang@gmail.com; helo=mail-pf1-x441.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_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , Yonggang Luo , Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 --- ui/curses.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 #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 = g_get_codeset(); /* * Control characters are normally non-printable, but VGA does have @@ -566,14 +566,14 @@ static void font_setup(void) 0x25bc }; - ucs2_to_nativecharset = iconv_open(nl_langinfo(CODESET), "UCS-2"); + ucs2_to_nativecharset = iconv_open(local_codeset, "UCS-2"); if (ucs2_to_nativecharset == (iconv_t) -1) { fprintf(stderr, "Could not convert font glyphs from UCS-2: '%s'\n", strerror(errno)); exit(1); } - nativecharset_to_ucs2 = iconv_open("UCS-2", nl_langinfo(CODESET)); + nativecharset_to_ucs2 = iconv_open("UCS-2", local_codeset); if (nativecharset_to_ucs2 == (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); } - font_conv = iconv_open(nl_langinfo(CODESET), font_charset); + font_conv = iconv_open(local_codeset, font_charset); if (font_conv == (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); - if (strcmp(nl_langinfo(CODESET), "UTF-8")) { + if (strcmp(local_codeset, "UTF-8")) { /* Non-Unicode capable, use termcap equivalents for those available */ for (i = 0; i <= 0xFF; i++) { wchar_t wch[CCHARW_MAX];