Mercurial > pidgin.yaz
changeset 13932:e18155a11d1c
[gaim-migrate @ 16459]
Two changes here:
1. When auto-linkifying a URL, if \r\n immediately follows the address,
don't include the \r as a part of the URL.
2. When replacing \n with <br> in a given string, if the string
contained any \r's then the end of the string would have a number
of unintialized characters at the end equal to the number of \r's
that were removed.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 08 Jul 2006 07:26:57 +0000 |
parents | 917a71dd02eb |
children | ad171112d52c |
files | src/util.c |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/util.c Sat Jul 08 07:13:29 2006 +0000 +++ b/src/util.c Sat Jul 08 07:26:57 2006 +0000 @@ -1744,6 +1744,7 @@ case ',': case '\0': case '\n': + case '\r': case '<': case '>': case '"': @@ -2682,12 +2683,16 @@ g_return_val_if_fail(src != NULL, NULL); - /* New length is (length of src) + (number of \n's * 3) + 1 */ + /* New length is (length of src) + (number of \n's * 3) - (number of \r's) + 1 */ + destsize = 0; for (i = 0, j = 0; src[i] != '\0'; i++) + { if (src[i] == '\n') - j++; - - destsize = i + (j * 3) + 1; + destsize += 4; + else if (src[i] != '\r') + destsize++; + } + dest = g_malloc(destsize); /* Copy stuff, ignoring \r's, because they are dumb */