* [PR PATCH] mcpp: fix set_encoding() to understand C.UTF-8
@ 2020-01-13 15:36 voidlinux-github
2020-01-17 16:15 ` [PR PATCH] [Merged]: " voidlinux-github
0 siblings, 1 reply; 2+ messages in thread
From: voidlinux-github @ 2020-01-13 15:36 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 846 bytes --]
There is a new pull request by gt7-void against master on the void-packages repository
https://github.com/gt7-void/void-packages mcpp
https://github.com/void-linux/void-packages/pull/18288
mcpp: fix set_encoding() to understand C.UTF-8
Function ```set_encoding()``` finds the encoding name by splitting a locale of the form ```en_US.UTF-8``` at the period, but only if the leading part is exactly 5 characters long.
```
$ LC_ALL=C.UTF-8 mcpp /dev/null
/dev/null:0: warning: Unknown encoding: C.UTF-8
#line 1 "/dev/null"
```
This patch changes the behaviour to split at the first period instead.
This will also fix a warning in ```xrdb```:
```
$ LC_ALL=C.UTF-8 xrdb -merge /dev/null
/dev/null:0: warning: Unknown encoding: C.UTF-8
```
A patch file from https://github.com/void-linux/void-packages/pull/18288.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mcpp-18288.patch --]
[-- Type: text/x-diff, Size: 2018 bytes --]
From efb5c93becea5c7b590923cd4b667d91c90b4e36 Mon Sep 17 00:00:00 2001
From: gt7-void <gt7@mail.com>
Date: Mon, 13 Jan 2020 12:03:49 -0300
Subject: [PATCH] mcpp: fix set_encoding() to understand C.UTF-8
---
srcpkgs/mcpp/patches/mbchar.patch | 29 +++++++++++++++++++++++++++++
srcpkgs/mcpp/template | 2 +-
2 files changed, 30 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/mcpp/patches/mbchar.patch
diff --git a/srcpkgs/mcpp/patches/mbchar.patch b/srcpkgs/mcpp/patches/mbchar.patch
new file mode 100644
index 00000000000..1929e3d7f0d
--- /dev/null
+++ b/srcpkgs/mcpp/patches/mbchar.patch
@@ -0,0 +1,29 @@
+Fix set_encoding() to understand C.UTF-8 and other
+locale names with != 5 characters before .
+
+--- src/mbchar.c 2008-03-08 11:06:13.000000000 -0200
++++ src/mbchar.c 2020-01-13 10:02:20.800174591 -0300
+@@ -366,6 +366,7 @@
+ = "Too long encoding name: %s%.0ld%.0s"; /* _E_ */
+ const char * loc = "";
+ int alias;
++ char *dot;
+ char norm[ NAMLEN];
+ /*
+ * Normalized name (removed 'xxxxx.', stripped '_', '-', '.'
+@@ -380,10 +381,11 @@
+ mcpp_fputc( '\n', ERR);
+ }
+ }
+- strcpy( norm, name);
+- if (norm[ 5] == '.')
+- memmove( norm, norm + 5, strlen( norm + 5) + 1);
+- /* Remove initial 'xxxxx.' as 'ja_JP.', 'en_US.' or any other */
++ if ( dot = strchr( name, '.' ) )
++ /* Remove initial 'xxxxx.' as 'ja_JP.', 'en_US.', 'C.' or any other */
++ strcpy( norm, dot+1);
++ else
++ strcpy( norm, name);
+ conv_case( norm, norm + strlen( norm), LOWER);
+ strip_bar( norm);
+
diff --git a/srcpkgs/mcpp/template b/srcpkgs/mcpp/template
index 08eae32e871..7a358883d06 100644
--- a/srcpkgs/mcpp/template
+++ b/srcpkgs/mcpp/template
@@ -1,7 +1,7 @@
# Template file for 'mcpp'
pkgname=mcpp
version=2.7.2
-revision=7
+revision=8
build_style=gnu-configure
configure_args="--enable-mcpplib"
short_desc="Portable C preprocessor"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-17 16:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13 15:36 [PR PATCH] mcpp: fix set_encoding() to understand C.UTF-8 voidlinux-github
2020-01-17 16:15 ` [PR PATCH] [Merged]: " voidlinux-github
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).