From bedbbabba7153eac99e60d4ff7f60c6f5cc698c9 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 25 Jul 2002 23:58:00 +0000 Subject: [PATCH] Handle the end of the string properly when max_len is set. (#88545, Morten Thu Jul 25 19:52:41 2002 Owen Taylor * glib/guniprop.c (real_tolower): Handle the end of the string properly when max_len is set. (#88545, Morten Welinder.) Rename the next_t variable to next_type to make cc-mode happy. * glib/gconvert.c (g_iconv_open): Fix missing label from previous commit. --- ChangeLog | 10 ++++++++++ ChangeLog.pre-2-10 | 10 ++++++++++ ChangeLog.pre-2-12 | 10 ++++++++++ ChangeLog.pre-2-2 | 10 ++++++++++ ChangeLog.pre-2-4 | 10 ++++++++++ ChangeLog.pre-2-6 | 10 ++++++++++ ChangeLog.pre-2-8 | 10 ++++++++++ glib/gconvert.c | 1 + glib/guniprop.c | 27 ++++++++++++++++----------- 9 files changed, 87 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2634ce..2094ba7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Thu Jul 25 19:52:41 2002 Owen Taylor + + * glib/guniprop.c (real_tolower): Handle the + end of the string properly when max_len is set. + (#88545, Morten Welinder.) Rename the next_t + variable to next_type to make cc-mode happy. + + * glib/gconvert.c (g_iconv_open): Fix missing + label from previous commit. + Thu Jul 25 19:41:03 2002 Owen Taylor * glib/giochannel.c (g_io_channel_get_flags): Fix diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b2634ce..2094ba7 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +Thu Jul 25 19:52:41 2002 Owen Taylor + + * glib/guniprop.c (real_tolower): Handle the + end of the string properly when max_len is set. + (#88545, Morten Welinder.) Rename the next_t + variable to next_type to make cc-mode happy. + + * glib/gconvert.c (g_iconv_open): Fix missing + label from previous commit. + Thu Jul 25 19:41:03 2002 Owen Taylor * glib/giochannel.c (g_io_channel_get_flags): Fix diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index b2634ce..2094ba7 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,13 @@ +Thu Jul 25 19:52:41 2002 Owen Taylor + + * glib/guniprop.c (real_tolower): Handle the + end of the string properly when max_len is set. + (#88545, Morten Welinder.) Rename the next_t + variable to next_type to make cc-mode happy. + + * glib/gconvert.c (g_iconv_open): Fix missing + label from previous commit. + Thu Jul 25 19:41:03 2002 Owen Taylor * glib/giochannel.c (g_io_channel_get_flags): Fix diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index b2634ce..2094ba7 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,13 @@ +Thu Jul 25 19:52:41 2002 Owen Taylor + + * glib/guniprop.c (real_tolower): Handle the + end of the string properly when max_len is set. + (#88545, Morten Welinder.) Rename the next_t + variable to next_type to make cc-mode happy. + + * glib/gconvert.c (g_iconv_open): Fix missing + label from previous commit. + Thu Jul 25 19:41:03 2002 Owen Taylor * glib/giochannel.c (g_io_channel_get_flags): Fix diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b2634ce..2094ba7 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,13 @@ +Thu Jul 25 19:52:41 2002 Owen Taylor + + * glib/guniprop.c (real_tolower): Handle the + end of the string properly when max_len is set. + (#88545, Morten Welinder.) Rename the next_t + variable to next_type to make cc-mode happy. + + * glib/gconvert.c (g_iconv_open): Fix missing + label from previous commit. + Thu Jul 25 19:41:03 2002 Owen Taylor * glib/giochannel.c (g_io_channel_get_flags): Fix diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b2634ce..2094ba7 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +Thu Jul 25 19:52:41 2002 Owen Taylor + + * glib/guniprop.c (real_tolower): Handle the + end of the string properly when max_len is set. + (#88545, Morten Welinder.) Rename the next_t + variable to next_type to make cc-mode happy. + + * glib/gconvert.c (g_iconv_open): Fix missing + label from previous commit. + Thu Jul 25 19:41:03 2002 Owen Taylor * glib/giochannel.c (g_io_channel_get_flags): Fix diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b2634ce..2094ba7 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +Thu Jul 25 19:52:41 2002 Owen Taylor + + * glib/guniprop.c (real_tolower): Handle the + end of the string properly when max_len is set. + (#88545, Morten Welinder.) Rename the next_t + variable to next_type to make cc-mode happy. + + * glib/gconvert.c (g_iconv_open): Fix missing + label from previous commit. + Thu Jul 25 19:41:03 2002 Owen Taylor * glib/giochannel.c (g_io_channel_get_flags): Fix diff --git a/glib/gconvert.c b/glib/gconvert.c index 939a417..8371fb5 100644 --- a/glib/gconvert.c +++ b/glib/gconvert.c @@ -135,6 +135,7 @@ g_iconv_open (const gchar *to_codeset, goto out; } + out: return (cd == (iconv_t)-1) ? (GIConv)-1 : (GIConv)cd; } diff --git a/glib/guniprop.c b/glib/guniprop.c index 46d2cec..bb420c3 100644 --- a/glib/guniprop.c +++ b/glib/guniprop.c @@ -758,17 +758,22 @@ real_tolower (const gchar *str, } else if (c == 0x03A3) /* GREEK CAPITAL LETTER SIGMA */ { - gunichar next_c = g_utf8_get_char (p); - int next_t = TYPE(next_c); - - /* SIGMA mapps differently depending on whether it is - * final or not. The following simplified test would - * fail in the case of combining marks following the - * sigma, but I don't think that occurs in real text. - * The test here matches that in ICU. - */ - if (ISALPHA(next_t)) /* Lu,Ll,Lt,Lm,Lo */ - val = 0x3c3; /* GREEK SMALL SIGMA */ + if ((max_len < 0 || p < str + max_len) && *p) + { + gunichar next_c = g_utf8_get_char (p); + int next_type = TYPE(next_c); + + /* SIGMA mapps differently depending on whether it is + * final or not. The following simplified test would + * fail in the case of combining marks following the + * sigma, but I don't think that occurs in real text. + * The test here matches that in ICU. + */ + if (ISALPHA(next_type)) /* Lu,Ll,Lt,Lm,Lo */ + val = 0x3c3; /* GREEK SMALL SIGMA */ + else + val = 0x3c2; /* GREEK SMALL FINAL SIGMA */ + } else val = 0x3c2; /* GREEK SMALL FINAL SIGMA */ -- 2.7.4