Commit 54506032 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Don't ignore the passed-in len parameter. (#430049, Yevgen Muntyan)

2007-07-09  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkselection.c (normalize_to_crlf): Don't ignore
        the passed-in len parameter.  (#430049, Yevgen Muntyan)



svn path=/trunk/; revision=18423
parent 4689dc3f
2007-07-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkselection.c (normalize_to_crlf): Don't ignore
the passed-in len parameter. (#430049, Yevgen Muntyan)
2007-07-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkframe.c (gtk_frame_size_allocate): Improve the
......
......@@ -1197,8 +1197,9 @@ normalize_to_crlf (const gchar *str,
{
GString *result = g_string_sized_new (len);
const gchar *p = str;
const gchar *end = str + len;
while (1)
while (p < end)
{
if (*p == '\n')
g_string_append_c (result, '\r');
......@@ -1207,13 +1208,12 @@ normalize_to_crlf (const gchar *str,
{
g_string_append_c (result, *p);
p++;
if (*p != '\n')
if (p == end || *p != '\n')
g_string_append_c (result, '\n');
if (p == end)
break;
}
if (*p == '\0')
break;
g_string_append_c (result, *p);
p++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment