Bug 501651 – Update glib/libcharset

2008-05-20  Behdad Esfahbod  <behdad@gnome.org>

        Bug 501651 – Update glib/libcharset

        * configure.in:
        * glib/libcharset/Makefile.am:
        * glib/libcharset/README:
        * glib/libcharset/codeset.m4:
        * glib/libcharset/config.charset:
        * glib/libcharset/glibc21.m4:
        * glib/libcharset/libcharset-glib.patch:
        * glib/libcharset/libcharset.h:
        * glib/libcharset/localcharset.c (_g_locale_get_charset_aliases),
        (_g_locale_charset_raw):
        * glib/libcharset/localcharset.h:
        * glib/libcharset/make-patch.sh:
        * glib/libcharset/ref-add.sin:
        * glib/libcharset/ref-del.sin:
        * glib/libcharset/update.sh:
        Update libcharset to the one shipped with libiconv-0.12.


svn path=/trunk/; revision=6921
This commit is contained in:
Behdad Esfahbod
2008-05-20 22:49:16 +00:00
committed by Behdad Esfahbod
parent 123dfdc5c2
commit 64e1b6d84f
15 changed files with 512 additions and 199 deletions

View File

@@ -1,3 +1,24 @@
2008-05-20 Behdad Esfahbod <behdad@gnome.org>
Bug 501651 Update glib/libcharset
* configure.in:
* glib/libcharset/Makefile.am:
* glib/libcharset/README:
* glib/libcharset/codeset.m4:
* glib/libcharset/config.charset:
* glib/libcharset/glibc21.m4:
* glib/libcharset/libcharset-glib.patch:
* glib/libcharset/libcharset.h:
* glib/libcharset/localcharset.c (_g_locale_get_charset_aliases),
(_g_locale_charset_raw):
* glib/libcharset/localcharset.h:
* glib/libcharset/make-patch.sh:
* glib/libcharset/ref-add.sin:
* glib/libcharset/ref-del.sin:
* glib/libcharset/update.sh:
Update libcharset to the one shipped with libiconv-0.12.
2008-05-20 Behdad Esfahbod <behdad@gnome.org> 2008-05-20 Behdad Esfahbod <behdad@gnome.org>
Bug 459905 Bug in wcwidth data Bug 459905 Bug in wcwidth data

View File

@@ -401,7 +401,7 @@ else
fi fi
fi fi
jm_GLIBC21 gl_GLIBC21
AC_ARG_ENABLE(iconv-cache, AC_ARG_ENABLE(iconv-cache,
[AC_HELP_STRING([--enable-iconv-cache=@<:@yes/no/auto@:>@], [AC_HELP_STRING([--enable-iconv-cache=@<:@yes/no/auto@:>@],
[cache iconv descriptors [default=auto]])],, [cache iconv descriptors [default=auto]])],,
@@ -839,8 +839,8 @@ AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct statfs.f
#endif]) #endif])
# Checks for libcharset # Checks for libcharset
jm_LANGINFO_CODESET AM_LANGINFO_CODESET
jm_GLIBC21 gl_GLIBC21
AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
AC_CHECK_FUNCS(setlocale) AC_CHECK_FUNCS(setlocale)

View File

@@ -8,6 +8,7 @@ noinst_LTLIBRARIES = libcharset.la
libcharset_la_SOURCES = \ libcharset_la_SOURCES = \
libcharset.h \ libcharset.h \
localcharset.h \
localcharset.c localcharset.c
EXTRA_DIST += \ EXTRA_DIST += \

View File

@@ -17,6 +17,11 @@ below.
Owen Taylor Owen Taylor
26 September 2001 26 September 2001
Updated to libiconv-1.12.
Behdad Esfahbod
20 May 2008
==== ====
/* Determine a canonical name for the current locale's character encoding. /* Determine a canonical name for the current locale's character encoding.

View File

@@ -1,19 +1,20 @@
#serial 2 # codeset.m4 serial AM1 (gettext-0.10.40)
dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible. dnl From Bruno Haible.
AC_DEFUN([jm_LANGINFO_CODESET], AC_DEFUN([AM_LANGINFO_CODESET],
[ [
AC_CHECK_HEADERS(langinfo.h) AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
AC_CHECK_FUNCS(nl_langinfo)
AC_CACHE_CHECK([for nl_langinfo and CODESET], jm_cv_langinfo_codeset,
[AC_TRY_LINK([#include <langinfo.h>], [AC_TRY_LINK([#include <langinfo.h>],
[char* cs = nl_langinfo(CODESET);], [char* cs = nl_langinfo(CODESET);],
jm_cv_langinfo_codeset=yes, am_cv_langinfo_codeset=yes,
jm_cv_langinfo_codeset=no) am_cv_langinfo_codeset=no)
]) ])
if test $jm_cv_langinfo_codeset = yes; then if test $am_cv_langinfo_codeset = yes; then
AC_DEFINE(HAVE_LANGINFO_CODESET, 1, AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
[Define if you have <langinfo.h> and nl_langinfo(CODESET).]) [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
fi fi

View File

@@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# Output a system dependent table of character encoding aliases. # Output a system dependent table of character encoding aliases.
# #
# Copyright (C) 2000-2002 Free Software Foundation, Inc. # Copyright (C) 2000-2004, 2006 Free Software Foundation, Inc.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published # under the terms of the GNU Library General Public License as published
@@ -15,7 +15,7 @@
# #
# You should have received a copy of the GNU Library General Public # You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software # License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA. # USA.
# #
# The table consists of lines of the form # The table consists of lines of the form
@@ -30,22 +30,22 @@
# MIME charset name is preferred. # MIME charset name is preferred.
# The current list of GNU canonical charset names is as follows. # The current list of GNU canonical charset names is as follows.
# #
# name used by which systems a MIME name? # name MIME? used by which systems
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd # ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin
# ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes # ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd darwin
# ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes # ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd darwin
# ISO-8859-3 glibc solaris yes # ISO-8859-3 Y glibc solaris
# ISO-8859-4 osf solaris freebsd yes # ISO-8859-4 Y osf solaris freebsd netbsd darwin
# ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes # ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd darwin
# ISO-8859-6 glibc aix hpux solaris yes # ISO-8859-6 Y glibc aix hpux solaris
# ISO-8859-7 glibc aix hpux irix osf solaris yes # ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd darwin
# ISO-8859-8 glibc aix hpux osf solaris yes # ISO-8859-8 Y glibc aix hpux osf solaris
# ISO-8859-9 glibc aix hpux irix osf solaris yes # ISO-8859-9 Y glibc aix hpux irix osf solaris darwin
# ISO-8859-13 glibc # ISO-8859-13 glibc netbsd darwin
# ISO-8859-14 glibc # ISO-8859-14 glibc
# ISO-8859-15 glibc aix osf solaris freebsd # ISO-8859-15 glibc aix osf solaris freebsd darwin
# KOI8-R glibc solaris freebsd yes # KOI8-R Y glibc solaris freebsd netbsd darwin
# KOI8-U glibc freebsd yes # KOI8-U Y glibc freebsd netbsd darwin
# KOI8-T glibc # KOI8-T glibc
# CP437 dos # CP437 dos
# CP775 dos # CP775 dos
@@ -58,7 +58,7 @@
# CP862 dos # CP862 dos
# CP864 dos # CP864 dos
# CP865 dos # CP865 dos
# CP866 freebsd dos # CP866 freebsd netbsd darwin dos
# CP869 dos # CP869 dos
# CP874 woe32 dos # CP874 woe32 dos
# CP922 aix # CP922 aix
@@ -71,25 +71,25 @@
# CP1125 dos # CP1125 dos
# CP1129 aix # CP1129 aix
# CP1250 woe32 # CP1250 woe32
# CP1251 glibc woe32 solaris # CP1251 glibc solaris netbsd darwin woe32
# CP1252 aix woe32 # CP1252 aix woe32
# CP1253 woe32 # CP1253 woe32
# CP1254 woe32 # CP1254 woe32
# CP1255 glibc woe32 # CP1255 glibc woe32
# CP1256 woe32 # CP1256 woe32
# CP1257 woe32 # CP1257 woe32
# GB2312 glibc aix hpux irix solaris freebsd yes # GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin
# EUC-JP glibc aix hpux irix osf solaris freebsd yes # EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin
# EUC-KR glibc aix hpux irix osf solaris freebsd yes # EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin
# EUC-TW glibc aix hpux irix osf solaris # EUC-TW glibc aix hpux irix osf solaris netbsd
# BIG5 glibc aix hpux osf solaris freebsd yes # BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin
# BIG5-HKSCS glibc solaris # BIG5-HKSCS glibc solaris
# GBK glibc aix osf solaris woe32 dos # GBK glibc aix osf solaris woe32 dos
# GB18030 glibc solaris # GB18030 glibc solaris netbsd
# SHIFT_JIS hpux osf solaris freebsd yes # SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin
# JOHAB glibc solaris woe32 # JOHAB glibc solaris woe32
# TIS-620 glibc aix hpux osf solaris # TIS-620 glibc aix hpux osf solaris
# VISCII glibc yes # VISCII Y glibc
# TCVN5712-1 glibc # TCVN5712-1 glibc
# GEORGIAN-PS glibc # GEORGIAN-PS glibc
# HP-ROMAN8 hpux # HP-ROMAN8 hpux
@@ -100,7 +100,7 @@
# HP-KANA8 hpux # HP-KANA8 hpux
# DEC-KANJI osf # DEC-KANJI osf
# DEC-HANYU osf # DEC-HANYU osf
# UTF-8 glibc aix hpux osf solaris yes # UTF-8 Y glibc aix hpux osf solaris netbsd darwin
# #
# Note: Names which are not marked as being a MIME name should not be used in # Note: Names which are not marked as being a MIME name should not be used in
# Internet protocols for information interchange (mail, news, etc.). # Internet protocols for information interchange (mail, news, etc.).
@@ -121,6 +121,105 @@ echo "# It was automatically generated from config.charset."
# List of references, updated during installation: # List of references, updated during installation:
echo "# Packages using this file: " echo "# Packages using this file: "
case "$os" in case "$os" in
linux-gnulibc1*)
# Linux libc5 doesn't have nl_langinfo(CODESET); therefore
# localcharset.c falls back to using the full locale name
# from the environment variables.
echo "C ASCII"
echo "POSIX ASCII"
for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
sv_FI sv_SE; do
echo "$l ISO-8859-1"
echo "$l.iso-8859-1 ISO-8859-1"
echo "$l.iso-8859-15 ISO-8859-15"
echo "$l.iso-8859-15@euro ISO-8859-15"
echo "$l@euro ISO-8859-15"
echo "$l.cp-437 CP437"
echo "$l.cp-850 CP850"
echo "$l.cp-1252 CP1252"
echo "$l.cp-1252@euro CP1252"
#echo "$l.atari-st ATARI-ST" # not a commonly used encoding
echo "$l.utf-8 UTF-8"
echo "$l.utf-8@euro UTF-8"
done
for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
sl_SI sr sr_CS sr_YU; do
echo "$l ISO-8859-2"
echo "$l.iso-8859-2 ISO-8859-2"
echo "$l.cp-852 CP852"
echo "$l.cp-1250 CP1250"
echo "$l.utf-8 UTF-8"
done
for l in mk mk_MK ru ru_RU; do
echo "$l ISO-8859-5"
echo "$l.iso-8859-5 ISO-8859-5"
echo "$l.koi8-r KOI8-R"
echo "$l.cp-866 CP866"
echo "$l.cp-1251 CP1251"
echo "$l.utf-8 UTF-8"
done
for l in ar ar_SA; do
echo "$l ISO-8859-6"
echo "$l.iso-8859-6 ISO-8859-6"
echo "$l.cp-864 CP864"
#echo "$l.cp-868 CP868" # not a commonly used encoding
echo "$l.cp-1256 CP1256"
echo "$l.utf-8 UTF-8"
done
for l in el el_GR gr gr_GR; do
echo "$l ISO-8859-7"
echo "$l.iso-8859-7 ISO-8859-7"
echo "$l.cp-869 CP869"
echo "$l.cp-1253 CP1253"
echo "$l.cp-1253@euro CP1253"
echo "$l.utf-8 UTF-8"
echo "$l.utf-8@euro UTF-8"
done
for l in he he_IL iw iw_IL; do
echo "$l ISO-8859-8"
echo "$l.iso-8859-8 ISO-8859-8"
echo "$l.cp-862 CP862"
echo "$l.cp-1255 CP1255"
echo "$l.utf-8 UTF-8"
done
for l in tr tr_TR; do
echo "$l ISO-8859-9"
echo "$l.iso-8859-9 ISO-8859-9"
echo "$l.cp-857 CP857"
echo "$l.cp-1254 CP1254"
echo "$l.utf-8 UTF-8"
done
for l in lt lt_LT lv lv_LV; do
#echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
echo "$l ISO-8859-13"
done
for l in ru_UA uk uk_UA; do
echo "$l KOI8-U"
done
for l in zh zh_CN; do
#echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name
echo "$l GB2312"
done
for l in ja ja_JP ja_JP.EUC; do
echo "$l EUC-JP"
done
for l in ko ko_KR; do
echo "$l EUC-KR"
done
for l in th th_TH; do
echo "$l TIS-620"
done
for l in fa fa_IR; do
#echo "$l ISIRI-3342" # a broken encoding
echo "$l.utf-8 UTF-8"
done
;;
linux* | *-gnu*) linux* | *-gnu*)
# With glibc-2.1 or newer, we don't need any canonicalization, # With glibc-2.1 or newer, we don't need any canonicalization,
# because glibc has iconv and both glibc and libiconv support all # because glibc has iconv and both glibc and libiconv support all
@@ -289,6 +388,8 @@ case "$os" in
echo "ISO8859-2 ISO-8859-2" echo "ISO8859-2 ISO-8859-2"
echo "ISO8859-4 ISO-8859-4" echo "ISO8859-4 ISO-8859-4"
echo "ISO8859-5 ISO-8859-5" echo "ISO8859-5 ISO-8859-5"
echo "ISO8859-7 ISO-8859-7"
echo "ISO8859-13 ISO-8859-13"
echo "ISO8859-15 ISO-8859-15" echo "ISO8859-15 ISO-8859-15"
echo "eucCN GB2312" echo "eucCN GB2312"
echo "eucJP EUC-JP" echo "eucJP EUC-JP"
@@ -297,6 +398,77 @@ case "$os" in
echo "BIG5 BIG5" echo "BIG5 BIG5"
echo "SJIS SHIFT_JIS" echo "SJIS SHIFT_JIS"
;; ;;
darwin[56]*)
# Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
# localcharset.c falls back to using the full locale name
# from the environment variables.
echo "C ASCII"
for l in en_AU en_CA en_GB en_US la_LN; do
echo "$l.US-ASCII ASCII"
done
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
nl_NL no_NO pt_PT sv_SE; do
echo "$l ISO-8859-1"
echo "$l.ISO8859-1 ISO-8859-1"
echo "$l.ISO8859-15 ISO-8859-15"
done
for l in la_LN; do
echo "$l.ISO8859-1 ISO-8859-1"
echo "$l.ISO8859-15 ISO-8859-15"
done
for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
echo "$l.ISO8859-2 ISO-8859-2"
done
for l in la_LN lt_LT; do
echo "$l.ISO8859-4 ISO-8859-4"
done
for l in ru_RU; do
echo "$l.KOI8-R KOI8-R"
echo "$l.ISO8859-5 ISO-8859-5"
echo "$l.CP866 CP866"
done
for l in bg_BG; do
echo "$l.CP1251 CP1251"
done
echo "uk_UA.KOI8-U KOI8-U"
echo "zh_TW.BIG5 BIG5"
echo "zh_TW.Big5 BIG5"
echo "zh_CN.EUC GB2312"
echo "ja_JP.EUC EUC-JP"
echo "ja_JP.SJIS SHIFT_JIS"
echo "ko_KR.EUC EUC-KR"
;;
darwin*)
# Darwin 7.5 has nl_langinfo(CODESET), but it is useless:
# - It returns the empty string when LANG is set to a locale of the
# form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8
# LC_CTYPE file.
# - The environment variables LANG, LC_CTYPE, LC_ALL are not set by
# the system; nl_langinfo(CODESET) returns "US-ASCII" in this case.
# - The documentation says:
# "... all code that calls BSD system routines should ensure
# that the const *char parameters of these routines are in UTF-8
# encoding. All BSD system functions expect their string
# parameters to be in UTF-8 encoding and nothing else."
# It also says
# "An additional caveat is that string parameters for files,
# paths, and other file-system entities must be in canonical
# UTF-8. In a canonical UTF-8 Unicode string, all decomposable
# characters are decomposed ..."
# but this is not true: You can pass non-decomposed UTF-8 strings
# to file system functions, and it is the OS which will convert
# them to decomposed UTF-8 before accessing the file system.
# - The Apple Terminal application displays UTF-8 by default.
# - However, other applications are free to use different encodings:
# - xterm uses ISO-8859-1 by default.
# - TextEdit uses MacRoman by default.
# We prefer UTF-8 over decomposed UTF-8-MAC because one should
# minimize the use of decomposed Unicode. Unfortunately, through the
# Darwin file system, decomposed UTF-8 strings are leaked into user
# space nevertheless.
echo "* UTF-8"
;;
beos*) beos*)
# BeOS has a single locale, and it has UTF-8 encoding. # BeOS has a single locale, and it has UTF-8 encoding.
echo "* UTF-8" echo "* UTF-8"
@@ -310,7 +482,7 @@ case "$os" in
echo "# If you find that the encoding given for your language and" echo "# If you find that the encoding given for your language and"
echo "# country is not the one your DOS machine actually uses, just" echo "# country is not the one your DOS machine actually uses, just"
echo "# correct it in this file, and send a mail to" echo "# correct it in this file, and send a mail to"
echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>" echo "# Juan Manuel Guerrero <juan.guerrero@gmx.de>"
echo "# and Bruno Haible <bruno@clisp.org>." echo "# and Bruno Haible <bruno@clisp.org>."
echo "#" echo "#"
echo "C ASCII" echo "C ASCII"
@@ -410,6 +582,7 @@ case "$os" in
echo "sq CP852" echo "sq CP852"
echo "sq_AL CP852" echo "sq_AL CP852"
echo "sr CP852" # CP852 or CP866 or CP855 ?? echo "sr CP852" # CP852 or CP866 or CP855 ??
echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
echo "sr_YU CP852" # CP852 or CP866 or CP855 ?? echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
# ISO-8859-3 languages # ISO-8859-3 languages
echo "mt CP850" echo "mt CP850"

View File

@@ -1,9 +1,13 @@
#serial 2 # glibc21.m4 serial 3
dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# Test for the GNU C Library, version 2.1 or newer. # Test for the GNU C Library, version 2.1 or newer.
# From Bruno Haible. # From Bruno Haible.
AC_DEFUN([jm_GLIBC21], AC_DEFUN([gl_GLIBC21],
[ [
AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
ac_cv_gnu_library_2_1, ac_cv_gnu_library_2_1,

View File

@@ -1,18 +1,18 @@
diff -ur libcharset/localcharset.c /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/localcharset.c # Patch against libcharset version 1.4
--- libcharset/localcharset.c Sat Dec 14 20:04:44 2002 --- libiconv-1.12/libcharset//lib/localcharset.c 2006-10-18 07:55:49.000000000 -0400
+++ /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/localcharset.c Sat Dec 14 20:09:45 2002 +++ localcharset.c 2008-05-20 18:36:24.000000000 -0400
@@ -102,8 +102,8 @@ @@ -103,8 +103,8 @@
static const char * volatile charset_aliases; static const char * volatile charset_aliases;
/* Return a pointer to the contents of the charset.alias file. */ /* Return a pointer to the contents of the charset.alias file. */
-static const char * -static const char *
-get_charset_aliases () -get_charset_aliases (void)
+const char * +const char *
+_g_locale_get_charset_aliases () +_g_locale_get_charset_aliases (void)
{ {
const char *cp; const char *cp;
@@ -235,14 +235,10 @@ @@ -280,14 +280,10 @@
If the canonical name cannot be determined, the result is a non-canonical If the canonical name cannot be determined, the result is a non-canonical
name. */ name. */
@@ -20,24 +20,21 @@ diff -ur libcharset/localcharset.c /home/otaylor/cvs/gnome2/glib-head/glib/libch
-STATIC -STATIC
-#endif -#endif
const char * const char *
-locale_charset () -locale_charset (void)
+_g_locale_charset_raw () +_g_locale_charset_raw (void)
{ {
const char *codeset; const char *codeset;
- const char *aliases; - const char *aliases;
#if !(defined WIN32 || defined OS2) #if !(defined WIN32_NATIVE || defined OS2)
@@ -344,12 +340,23 @@ @@ -436,12 +432,20 @@
#endif #endif
+ return codeset; + return codeset;
+} +}
+ +
+#ifdef STATIC
+STATIC
+#endif
+const char * +const char *
+_g_locale_charset_unalias (const char *codeset) +_g_locale_charset_unalias (const char *codeset)
+{ +{
@@ -53,34 +50,20 @@ diff -ur libcharset/localcharset.c /home/otaylor/cvs/gnome2/glib-head/glib/libch
*aliases != '\0'; *aliases != '\0';
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1) aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
if (strcmp (codeset, aliases) == 0 if (strcmp (codeset, aliases) == 0
diff -ur libcharset/glibc21.m4 /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/glibc21.m4 --- libiconv-1.12/libcharset//include/libcharset.h.in 2005-05-19 13:14:56.000000000 -0400
--- libcharset/glibc21.m4 Sat Dec 14 20:04:44 2002 +++ libcharset.h 2008-05-20 18:39:44.000000000 -0400
+++ /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/glibc21.m4 Fri Sep 28 19:44:46 2001 @@ -19,7 +19,7 @@
@@ -3,7 +3,7 @@ #ifndef _LIBCHARSET_H
# Test for the GNU C Library, version 2.1 or newer. #define _LIBCHARSET_H
# From Bruno Haible.
-AC_DEFUN(jm_GLIBC21, -#include <localcharset.h>
+AC_DEFUN([jm_GLIBC21], +#include "localcharset.h"
[
AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
ac_cv_gnu_library_2_1,
diff -ur libcharset/codeset.m4 /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/codeset.m4
--- libcharset/codeset.m4 Sat Dec 14 20:04:44 2002
+++ /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/codeset.m4 Fri Sep 28 19:44:46 2001
@@ -2,7 +2,7 @@
dnl From Bruno Haible.
-AC_DEFUN(jm_LANGINFO_CODESET, #ifdef __cplusplus
+AC_DEFUN([jm_LANGINFO_CODESET], --- libiconv-1.12/libcharset//include/localcharset.h.in 2005-05-19 13:14:57.000000000 -0400
[ +++ localcharset.h 2008-05-20 18:36:24.000000000 -0400
AC_CHECK_HEADERS(langinfo.h) @@ -31,8 +31,9 @@
AC_CHECK_FUNCS(nl_langinfo)
diff -ur libcharset/libcharset.h /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/libcharset.h
--- libcharset/libcharset.h Sat Dec 14 20:04:44 2002
+++ /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/libcharset.h Sat Dec 14 19:03:11 2002
@@ -30,8 +30,9 @@
The result must not be freed; it is statically allocated. The result must not be freed; it is statically allocated.
If the canonical name cannot be determined, the result is a non-canonical If the canonical name cannot be determined, the result is a non-canonical
name. */ name. */

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2000-2001 Free Software Foundation, Inc. /* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU CHARSET Library. This file is part of the GNU CHARSET Library.
The GNU CHARSET Library is free software; you can redistribute it and/or The GNU CHARSET Library is free software; you can redistribute it and/or
@@ -13,26 +13,30 @@
You should have received a copy of the GNU Library General Public License You should have received a copy of the GNU Library General Public License
along with the GNU CHARSET Library; see the file COPYING.LIB. If not, along with the GNU CHARSET Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 51 Franklin Street,
Boston, MA 02111-1307, USA. */ Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _LIBCHARSET_H #ifndef _LIBCHARSET_H
#define _LIBCHARSET_H #define _LIBCHARSET_H
#include "localcharset.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Determine the current locale's character encoding, and canonicalize it /* Support for relocatable packages. */
into one of the canonical names listed in config.charset.
The result must not be freed; it is statically allocated. /* Sets the original and the current installation prefix of the package.
If the canonical name cannot be determined, the result is a non-canonical Relocation simply replaces a pathname starting with the original prefix
name. */ by the corresponding pathname with the current prefix instead. Both
extern const char * _g_locale_charset_raw (void); prefixes should be directory names without trailing slash (i.e. use ""
extern const char * _g_locale_charset_unalias (const char *codeset); instead of "/"). */
extern const char * _g_locale_get_charset_aliases (void); extern void libcharset_set_relocation_prefix (const char *orig_prefix,
const char *curr_prefix);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -1,6 +1,6 @@
/* Determine a canonical name for the current locale's character encoding. /* Determine a canonical name for the current locale's character encoding.
Copyright (C) 2000-2002 Free Software Foundation, Inc. Copyright (C) 2000-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published under the terms of the GNU Library General Public License as published
@@ -14,39 +14,23 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the Free Software License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */ USA. */
/* Written by Bruno Haible <bruno@clisp.org>. */ /* Written by Bruno Haible <bruno@clisp.org>. */
#ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif
#include <glibconfig.h> /* Specification. */
#include "localcharset.h"
#if defined G_PLATFORM_WIN32
/* Want to use Win32-specific code in this file also on Cygwin */
# define _WIN32 1
#endif
#if HAVE_STDDEF_H
#include <stddef.h> #include <stddef.h>
#endif
#include <stdio.h> #include <stdio.h>
#if HAVE_STRING_H
#include <string.h> #include <string.h>
#else
# include <strings.h>
#endif
#if HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif
#if defined _WIN32 || defined __WIN32__ #if defined _WIN32 || defined __WIN32__
# undef WIN32 /* avoid warning on mingw32 */ # define WIN32_NATIVE
# define WIN32
#endif #endif
#if defined __EMX__ #if defined __EMX__
@@ -54,15 +38,19 @@
# define OS2 # define OS2
#endif #endif
#if !defined WIN32 #if !defined WIN32_NATIVE
# if HAVE_LANGINFO_CODESET # if HAVE_LANGINFO_CODESET
# include <langinfo.h> # include <langinfo.h>
# else # else
# if HAVE_SETLOCALE # if 0 /* see comment below */
# include <locale.h> # include <locale.h>
# endif # endif
# endif # endif
#elif defined WIN32 # ifdef __CYGWIN__
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# endif
#elif defined WIN32_NATIVE
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# include <windows.h> # include <windows.h>
#endif #endif
@@ -71,8 +59,19 @@
# include <os2.h> # include <os2.h>
#endif #endif
#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__ #if ENABLE_RELOCATABLE
/* Win32, OS/2, DOS */ # include "relocatable.h"
#else
# define relocate(pathname) (pathname)
#endif
/* Get LIBDIR. */
#ifndef LIBDIR
# include "configmake.h"
#endif
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
/* Win32, Cygwin, OS/2, DOS */
# define ISSLASH(C) ((C) == '/' || (C) == '\\') # define ISSLASH(C) ((C) == '/' || (C) == '\\')
#endif #endif
@@ -84,16 +83,11 @@
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) # define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
#endif #endif
#ifdef HAVE_GETC_UNLOCKED #if HAVE_DECL_GETC_UNLOCKED
# undef getc # undef getc
# define getc getc_unlocked # define getc getc_unlocked
#endif #endif
#ifdef __cplusplus
/* When compiling with "gcc -x c++", produce a function with C linkage. */
extern "C" const char * locale_charset (void);
#endif
/* The following static variable is declared 'volatile' to avoid a /* The following static variable is declared 'volatile' to avoid a
possible multithread problem in the function get_charset_aliases. If we possible multithread problem in the function get_charset_aliases. If we
are running in a threaded environment, and if two threads initialize are running in a threaded environment, and if two threads initialize
@@ -117,14 +111,17 @@ _g_locale_get_charset_aliases (void)
cp = charset_aliases; cp = charset_aliases;
if (cp == NULL) if (cp == NULL)
{ {
#if !defined WIN32 #if !(defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
FILE *fp; FILE *fp;
const char *dir = getenv ("LIBCHARSET_ALIAS_DIR"); const char *dir;
const char *base = "charset.alias"; const char *base = "charset.alias";
char *file_name; char *file_name;
if (dir == NULL) /* Make it possible to override the charset.alias location. This is
dir = LIBDIR; necessary for running the testsuite before "make install". */
dir = getenv ("CHARSETALIASDIR");
if (dir == NULL || dir[0] == '\0')
dir = relocate (LIBDIR);
/* Concatenate dir and base into freshly allocated file_name. */ /* Concatenate dir and base into freshly allocated file_name. */
{ {
@@ -147,15 +144,17 @@ _g_locale_get_charset_aliases (void)
else else
{ {
/* Parse the file's contents. */ /* Parse the file's contents. */
int c;
char buf1[50+1];
char buf2[50+1];
char *res_ptr = NULL; char *res_ptr = NULL;
size_t res_size = 0; size_t res_size = 0;
size_t l1, l2;
for (;;) for (;;)
{ {
int c;
char buf1[50+1];
char buf2[50+1];
size_t l1, l2;
char *old_res_ptr;
c = getc (fp); c = getc (fp);
if (c == EOF) if (c == EOF)
break; break;
@@ -176,6 +175,7 @@ _g_locale_get_charset_aliases (void)
break; break;
l1 = strlen (buf1); l1 = strlen (buf1);
l2 = strlen (buf2); l2 = strlen (buf2);
old_res_ptr = res_ptr;
if (res_size == 0) if (res_size == 0)
{ {
res_size = l1 + 1 + l2 + 1; res_size = l1 + 1 + l2 + 1;
@@ -183,17 +183,15 @@ _g_locale_get_charset_aliases (void)
} }
else else
{ {
char * p = res_ptr;
res_size += l1 + 1 + l2 + 1; res_size += l1 + 1 + l2 + 1;
res_ptr = (char *) realloc (res_ptr, res_size + 1); res_ptr = (char *) realloc (res_ptr, res_size + 1);
if (res_ptr == NULL) {
free(p);
}
} }
if (res_ptr == NULL) if (res_ptr == NULL)
{ {
/* Out of memory. */ /* Out of memory. */
res_size = 0; res_size = 0;
if (old_res_ptr != NULL)
free (old_res_ptr);
break; break;
} }
strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1); strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
@@ -214,15 +212,41 @@ _g_locale_get_charset_aliases (void)
#else #else
# if defined VMS
/* To avoid the troubles of an extra file charset.alias_vms in the
sources of many GNU packages, simply inline the aliases here. */
/* The list of encodings is taken from the OpenVMS 7.3-1 documentation
"Compaq C Run-Time Library Reference Manual for OpenVMS systems"
section 10.7 "Handling Different Character Sets". */
cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
"ISO8859-2" "\0" "ISO-8859-2" "\0"
"ISO8859-5" "\0" "ISO-8859-5" "\0"
"ISO8859-7" "\0" "ISO-8859-7" "\0"
"ISO8859-8" "\0" "ISO-8859-8" "\0"
"ISO8859-9" "\0" "ISO-8859-9" "\0"
/* Japanese */
"eucJP" "\0" "EUC-JP" "\0"
"SJIS" "\0" "SHIFT_JIS" "\0"
"DECKANJI" "\0" "DEC-KANJI" "\0"
"SDECKANJI" "\0" "EUC-JP" "\0"
/* Chinese */
"eucTW" "\0" "EUC-TW" "\0"
"DECHANYU" "\0" "DEC-HANYU" "\0"
"DECHANZI" "\0" "GB2312" "\0"
/* Korean */
"DECKOREAN" "\0" "EUC-KR" "\0";
# endif
# if defined WIN32_NATIVE || defined __CYGWIN__
/* To avoid the troubles of installing a separate file in the same /* To avoid the troubles of installing a separate file in the same
directory as the DLL and of retrieving the DLL's directory at directory as the DLL and of retrieving the DLL's directory at
runtime, simply inline the aliases here. */ runtime, simply inline the aliases here. */
# if defined WIN32
cp = "CP936" "\0" "GBK" "\0" cp = "CP936" "\0" "GBK" "\0"
"CP1361" "\0" "JOHAB" "\0" "CP1361" "\0" "JOHAB" "\0"
"CP20127" "\0" "ASCII" "\0" "CP20127" "\0" "ASCII" "\0"
"CP20866" "\0" "KOI8-R" "\0" "CP20866" "\0" "KOI8-R" "\0"
"CP20936" "\0" "GB2312" "\0"
"CP21866" "\0" "KOI8-RU" "\0" "CP21866" "\0" "KOI8-RU" "\0"
"CP28591" "\0" "ISO-8859-1" "\0" "CP28591" "\0" "ISO-8859-1" "\0"
"CP28592" "\0" "ISO-8859-2" "\0" "CP28592" "\0" "ISO-8859-2" "\0"
@@ -233,7 +257,14 @@ _g_locale_get_charset_aliases (void)
"CP28597" "\0" "ISO-8859-7" "\0" "CP28597" "\0" "ISO-8859-7" "\0"
"CP28598" "\0" "ISO-8859-8" "\0" "CP28598" "\0" "ISO-8859-8" "\0"
"CP28599" "\0" "ISO-8859-9" "\0" "CP28599" "\0" "ISO-8859-9" "\0"
"CP28605" "\0" "ISO-8859-15" "\0"; "CP28605" "\0" "ISO-8859-15" "\0"
"CP38598" "\0" "ISO-8859-8" "\0"
"CP51932" "\0" "EUC-JP" "\0"
"CP51936" "\0" "GB2312" "\0"
"CP51949" "\0" "EUC-KR" "\0"
"CP51950" "\0" "EUC-TW" "\0"
"CP54936" "\0" "GB18030" "\0"
"CP65001" "\0" "UTF-8" "\0";
# endif # endif
#endif #endif
@@ -254,13 +285,60 @@ _g_locale_charset_raw (void)
{ {
const char *codeset; const char *codeset;
#if !(defined WIN32 || defined OS2) #if !(defined WIN32_NATIVE || defined OS2)
# if HAVE_LANGINFO_CODESET # if HAVE_LANGINFO_CODESET
/* Most systems support nl_langinfo (CODESET) nowadays. */ /* Most systems support nl_langinfo (CODESET) nowadays. */
codeset = nl_langinfo (CODESET); codeset = nl_langinfo (CODESET);
# ifdef __CYGWIN__
/* Cygwin 2006 does not have locales. nl_langinfo (CODESET) always
returns "US-ASCII". As long as this is not fixed, return the suffix
of the locale name from the environment variables (if present) or
the codepage as a number. */
if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
{
const char *locale;
static char buf[2 + 10 + 1];
locale = getenv ("LC_ALL");
if (locale == NULL || locale[0] == '\0')
{
locale = getenv ("LC_CTYPE");
if (locale == NULL || locale[0] == '\0')
locale = getenv ("LANG");
}
if (locale != NULL && locale[0] != '\0')
{
/* If the locale name contains an encoding after the dot, return
it. */
const char *dot = strchr (locale, '.');
if (dot != NULL)
{
const char *modifier;
dot++;
/* Look for the possible @... trailer and remove it, if any. */
modifier = strchr (dot, '@');
if (modifier == NULL)
return dot;
if (modifier - dot < sizeof (buf))
{
memcpy (buf, dot, modifier - dot);
buf [modifier - dot] = '\0';
return buf;
}
}
}
/* Woe32 has a function returning the locale's codepage as a number. */
sprintf (buf, "CP%u", GetACP ());
codeset = buf;
}
# endif
# else # else
/* On old systems which lack it, use setlocale or getenv. */ /* On old systems which lack it, use setlocale or getenv. */
@@ -270,7 +348,7 @@ _g_locale_charset_raw (void)
(like SunOS 4 or DJGPP) have only the C locale. Therefore we don't (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
use setlocale here; it would return "C" when it doesn't support the use setlocale here; it would return "C" when it doesn't support the
locale name the user has set. */ locale name the user has set. */
# if HAVE_SETLOCALE && 0 # if 0
locale = setlocale (LC_CTYPE, NULL); locale = setlocale (LC_CTYPE, NULL);
# endif # endif
if (locale == NULL || locale[0] == '\0') if (locale == NULL || locale[0] == '\0')
@@ -291,7 +369,7 @@ _g_locale_charset_raw (void)
# endif # endif
#elif defined WIN32 #elif defined WIN32_NATIVE
static char buf[2 + 10 + 1]; static char buf[2 + 10 + 1];
@@ -357,9 +435,6 @@ _g_locale_charset_raw (void)
return codeset; return codeset;
} }
#ifdef STATIC
STATIC
#endif
const char * const char *
_g_locale_charset_unalias (const char *codeset) _g_locale_charset_unalias (const char *codeset)
{ {

View File

@@ -0,0 +1,43 @@
/* Determine a canonical name for the current locale's character encoding.
Copyright (C) 2000-2003 Free Software Foundation, Inc.
This file is part of the GNU CHARSET Library.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
#ifndef _LOCALCHARSET_H
#define _LOCALCHARSET_H
#ifdef __cplusplus
extern "C" {
#endif
/* Determine the current locale's character encoding, and canonicalize it
into one of the canonical names listed in config.charset.
The result must not be freed; it is statically allocated.
If the canonical name cannot be determined, the result is a non-canonical
name. */
extern const char * _g_locale_charset_raw (void);
extern const char * _g_locale_charset_unalias (const char *codeset);
extern const char * _g_locale_get_charset_aliases (void);
#ifdef __cplusplus
}
#endif
#endif /* _LOCALCHARSET_H */

View File

@@ -12,7 +12,7 @@ if test -f $ORIGINAL/lib/localcharset.c ; then : ; else
exit 1 exit 1
fi fi
VERSION=`grep VERSION= $ORIGINAL/configure.in | sed s/VERSION=//` VERSION=`grep VERSION= $ORIGINAL/configure.ac | sed s/VERSION=//`
echo "# Patch against libcharset version $VERSION" > libcharset-glib.patch echo "# Patch against libcharset version $VERSION" > libcharset-glib.patch
@@ -25,3 +25,4 @@ for i in glibc21.m4 codeset.m4 ; do
done done
diff -u $ORIGINAL/include/libcharset.h.in libcharset.h >> libcharset-glib.patch diff -u $ORIGINAL/include/libcharset.h.in libcharset.h >> libcharset-glib.patch
diff -u $ORIGINAL/include/localcharset.h.in localcharset.h >> libcharset-glib.patch

View File

@@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU Library General Public # You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software # License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA. # USA.
# #
# Written by Bruno Haible <bruno@clisp.org>. # Written by Bruno Haible <bruno@clisp.org>.

View File

@@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU Library General Public # You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software # License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA. # USA.
# #
# Written by Bruno Haible <bruno@clisp.org>. # Written by Bruno Haible <bruno@clisp.org>.

View File

@@ -12,13 +12,15 @@ if test -f $ORIGINAL/lib/localcharset.c ; then : ; else
exit 1 exit 1
fi fi
VERSION=`grep VERSION= $ORIGINAL/configure.in | sed s/VERSION=//` VERSION=`grep VERSION= $ORIGINAL/configure.ac | sed s/VERSION=//`
for i in localcharset.c ref-add.sin ref-del.sin config.charset ; do for i in localcharset.c ref-add.sin ref-del.sin config.charset ; do
cp $ORIGINAL/lib/$i . cp $ORIGINAL/lib/$i .
done done
cp $ORIGINAL/include/libcharset.h.in ./libcharset.h for i in libcharset.h localcharset.h ; do
cp $ORIGINAL/include/$i.in ./$i
done
for i in codeset.m4 glibc21.m4 ; do for i in codeset.m4 glibc21.m4 ; do
cp $ORIGINAL/m4/$i . cp $ORIGINAL/m4/$i .