From: <the...@us...> - 2006-07-08 07:27:20
|
Revision: 16460 Author: thekingant Date: 2006-07-08 00:27:16 -0700 (Sat, 08 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16460&view=rev Log Message: ----------- Backport SVN revision #16459 from HEAD to v2_0_0 Original commit message: 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. ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16459&view=rev Modified Paths: -------------- branches/v2_0_0/src/util.c Modified: branches/v2_0_0/src/util.c =================================================================== --- branches/v2_0_0/src/util.c 2006-07-08 07:26:57 UTC (rev 16459) +++ branches/v2_0_0/src/util.c 2006-07-08 07:27:16 UTC (rev 16460) @@ -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 += 4; + else if (src[i] != '\r') + destsize++; + } - destsize = i + (j * 3) + 1; dest = g_malloc(destsize); /* Copy stuff, ignoring \r's, because they are dumb */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |