summaryrefslogtreecommitdiff
path: root/eglib
diff options
context:
space:
mode:
authorJo Shields <directhex@apebox.org>2010-11-23 16:32:50 +0000
committerJo Shields <directhex@apebox.org>2010-11-23 16:32:50 +0000
commitf85b0b1a56036469a3217c34b1090f68b118972e (patch)
treeaa991b3b133c653e6d8e3299cb6930fe617f2a0c /eglib
parent5c6aba561a13a666267e90e0109e9d82e7a7d59d (diff)
downloadmono-f85b0b1a56036469a3217c34b1090f68b118972e.tar.gz
Imported Upstream version 2.8.1
Diffstat (limited to 'eglib')
-rw-r--r--eglib/ChangeLog23
-rw-r--r--eglib/config.h.in3
-rwxr-xr-xeglib/configure6
-rw-r--r--eglib/configure.ac5
-rw-r--r--eglib/src/eglib-config.h2
-rw-r--r--eglib/src/gunicode.c13
-rw-r--r--eglib/src/gutf8.c9
7 files changed, 50 insertions, 11 deletions
diff --git a/eglib/ChangeLog b/eglib/ChangeLog
index 89b624fbd8..3a4e1e5773 100644
--- a/eglib/ChangeLog
+++ b/eglib/ChangeLog
@@ -1,3 +1,26 @@
+2010-10-23 Zoltan Varga <vargaz@gmail.com>
+
+ Use int 3 as G_BREAKPOINT on x86-64 too. Hopefully fixes #648838.
+
+2010-10-22 Zoltan Varga <vargaz@gmail.com>
+
+ Use locale_charset() from iconv which will use nl_langinfo
+ (CODESET) anyways but it will do canonicalization so we will get
+ the correct charset name, because nl_langinfo (CODESET) can return
+ different things on different systems. This at least fixes
+ OpenBSD.
+
+2010-09-04 Gonzalo Paniagua Javier <gonzalo.mono@gmail.com>
+
+ Fix return value of items_read
+
+ items_read was not being initialized and it was not being set in
+ the fast common case of g_utf8_to_utf16().
+
+2010-10-14 Zoltan Varga <vargaz@gmail.com>
+
+ Avoid a crash in g_convert () if iconv_open () fails.
+
2010-09-10 Miguel de Icaza <miguel@gnome.org>
[Fix] Correct fix for the g_shell_parse_argv bug
diff --git a/eglib/config.h.in b/eglib/config.h.in
index 1cd57fb706..10b4188102 100644
--- a/eglib/config.h.in
+++ b/eglib/config.h.in
@@ -21,6 +21,9 @@
/* Define to 1 if you have the <langinfo.h> header file. */
#undef HAVE_LANGINFO_H
+/* Define to 1 if you have the <localcharset.h> header file. */
+#undef HAVE_LOCALCHARSET_H
+
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
diff --git a/eglib/configure b/eglib/configure
index 1f45ba500d..8cdeaa324e 100755
--- a/eglib/configure
+++ b/eglib/configure
@@ -11103,9 +11103,8 @@ BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
if test x$GCC = xyes; then
GNUC_UNUSED='__attribute__((__unused__))'
GNUC_NORETURN='__attribute__((__noreturn__))'
- echo target_cpu=$target_cpu
case $target_cpu in
- i*86) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
+ i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
esac
fi
@@ -12939,7 +12938,8 @@ fi
-for ac_header in getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h
+
+for ac_header in getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h
do
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
diff --git a/eglib/configure.ac b/eglib/configure.ac
index 51e448d89a..5b614b1fa7 100644
--- a/eglib/configure.ac
+++ b/eglib/configure.ac
@@ -14,9 +14,8 @@ BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
if test x$GCC = xyes; then
GNUC_UNUSED='__attribute__((__unused__))'
GNUC_NORETURN='__attribute__((__noreturn__))'
- echo target_cpu=$target_cpu
case $target_cpu in
- i*86) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
+ i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
esac
fi
AC_SUBST(GNUC_PRETTY)
@@ -110,7 +109,7 @@ if test "x$have_iso_varargs" = "xyes"; then
fi
AC_SUBST(G_HAVE_ISO_VARARGS)
-AC_CHECK_HEADERS(getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h)
+AC_CHECK_HEADERS(getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h)
if test $ac_cv_sizeof_void_p != $ac_cv_sizeof_int; then
GPOINTER_TO_INT="((gint)(long) (ptr))"
diff --git a/eglib/src/eglib-config.h b/eglib/src/eglib-config.h
index 9b7d9b0d71..589185facc 100644
--- a/eglib/src/eglib-config.h
+++ b/eglib/src/eglib-config.h
@@ -12,7 +12,7 @@
#define G_SEARCHPATH_SEPARATOR ':'
#define G_DIR_SEPARATOR '/'
#define G_DIR_SEPARATOR_S "/"
-#define G_BREAKPOINT() G_STMT_START { raise (SIGTRAP); } G_STMT_END
+#define G_BREAKPOINT() G_STMT_START { __asm__ ("int $03"); } G_STMT_END
#define G_OS_UNIX
#define GPOINTER_TO_INT(ptr) ((gint)(long) (ptr))
#define GPOINTER_TO_UINT(ptr) ((guint)(long) (ptr))
diff --git a/eglib/src/gunicode.c b/eglib/src/gunicode.c
index af11774446..2c1d424083 100644
--- a/eglib/src/gunicode.c
+++ b/eglib/src/gunicode.c
@@ -53,6 +53,9 @@
# ifdef HAVE_ICONV_H
# include <iconv.h>
# endif
+# ifdef HAVE_LOCALCHARSET_H
+# include <localcharset.h>
+# endif
#endif
static char *my_charset;
@@ -217,8 +220,10 @@ g_convert (const gchar *str, gssize len,
convertor = iconv_open (to_codeset, from_codeset);
if (convertor == (iconv_t) -1){
- *bytes_written = 0;
- *bytes_read = 0;
+ if (bytes_written)
+ *bytes_written = 0;
+ if (bytes_read)
+ *bytes_read = 0;
return NULL;
}
@@ -303,7 +308,9 @@ g_get_charset (G_CONST_RETURN char **charset)
#else
if (my_charset == NULL){
/* These shouldn't be heap allocated */
-#if HAVE_LANGINFO_H
+#if HAVE_LOCALCHARSET_H
+ my_charset = locale_charset ();
+#elif defined(HAVE_LANGINFO_H)
my_charset = nl_langinfo (CODESET);
#else
my_charset = "UTF-8";
diff --git a/eglib/src/gutf8.c b/eglib/src/gutf8.c
index 3f1fab4729..6abd703dee 100644
--- a/eglib/src/gutf8.c
+++ b/eglib/src/gutf8.c
@@ -74,8 +74,11 @@ utf8_to_utf16_len (const gchar *str, glong len, glong *items_read, GError **erro
for (in_pos = 0; in_pos < len && str [in_pos] < 0x80; in_pos++)
ret ++;
- if (in_pos == len)
+ if (in_pos == len) {
+ if (items_read)
+ *items_read = in_pos;
return ret;
+ }
mb_size = 0;
mb_remain = 0;
@@ -214,6 +217,8 @@ g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_wr
if (len < 0)
len = strlen (str);
+ if (items_read)
+ *items_read = 0;
if (items_written)
*items_written = 0;
utf16_len = utf8_to_utf16_len (str, len, items_read, error);
@@ -311,6 +316,8 @@ g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *item
out_pos = 0;
surrogate = FALSE;
+ if (items_read)
+ *items_read = 0;
if (items_written)
*items_written = 0;
utf8_len = utf16_to_utf8_len (str, len, items_read, error);