# HG changeset patch # User Mark Doliner # Date 1152343617 0 # Node ID e18155a11d1cccac5d2c4fe153a6da72c14d8475 # Parent 917a71dd02eb8bdd3fbc15a5d82b9aaf51f5465c [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
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 diff -r 917a71dd02eb -r e18155a11d1c src/util.c --- 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 */