From: <dat...@us...> - 2006-04-17 00:17:17
|
Revision: 16043 Author: datallah Date: 2006-04-16 17:17:00 -0700 (Sun, 16 Apr 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16043&view=rev Log Message: ----------- crashes inform me that g_utf8_strdown and/or g_utf8_normalize can return NULL when the input string is not NULL Modified Paths: -------------- trunk/src/util.c Modified: trunk/src/util.c =================================================================== --- trunk/src/util.c 2006-04-16 20:18:17 UTC (rev 16042) +++ trunk/src/util.c 2006-04-17 00:17:00 UTC (rev 16043) @@ -2667,7 +2667,7 @@ tmp1 = g_utf8_strdown(str, -1); tmp2 = g_utf8_normalize(tmp1, -1, G_NORMALIZE_DEFAULT); - g_snprintf(buf, sizeof(buf), "%s", tmp2); + g_snprintf(buf, sizeof(buf), "%s", tmp2 ? tmp2 : ""); g_free(tmp2); g_free(tmp1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rl...@us...> - 2006-05-12 21:50:27
|
Revision: 16182 Author: rlaager Date: 2006-05-12 14:50:19 -0700 (Fri, 12 May 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16182&view=rev Log Message: ----------- SF Patch #1460287 from J?\195?\169r?\195?\180me Poulin (ticpu), with a bug fix by Sadrul Currently, with a string like "vnc://ticpu.myftp.org:1/", the "ftp.org:1/" portion will be linkified as an FTP URL. This patch corrects that. Modified Paths: -------------- trunk/src/util.c Modified: trunk/src/util.c =================================================================== --- trunk/src/util.c 2006-05-12 20:21:35 UTC (rev 16181) +++ trunk/src/util.c 2006-05-12 21:50:19 UTC (rev 16182) @@ -1837,7 +1837,7 @@ t++; } - } else if (!g_ascii_strncasecmp(c, "www.", 4)) { + } else if (!g_ascii_strncasecmp(c, "www.", 4) && (c == text || badchar(c[-1]) || badentity(c-1))) { if (c[4] != '.') { t = c; while (1) { @@ -1892,7 +1892,7 @@ t++; } - } else if (!g_ascii_strncasecmp(c, "ftp.", 4)) { + } else if (!g_ascii_strncasecmp(c, "ftp.", 4) && (c == text || badchar(c[-1]) || badentity(c-1))) { if (c[4] != '.') { t = c; while (1) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-07-08 07:27:01
|
Revision: 16459 Author: thekingant Date: 2006-07-08 00:26:57 -0700 (Sat, 08 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16459&view=rev Log 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. Modified Paths: -------------- trunk/src/util.c Modified: trunk/src/util.c =================================================================== --- trunk/src/util.c 2006-07-08 07:13:29 UTC (rev 16458) +++ trunk/src/util.c 2006-07-08 07:26:57 UTC (rev 16459) @@ -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. |
From: <the...@us...> - 2006-07-10 06:59:30
|
Revision: 16475 Author: thekingant Date: 2006-07-09 23:59:27 -0700 (Sun, 09 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16475&view=rev Log Message: ----------- Fix a bug where the last character of the value returned by gaim_strdup_withhtml would be cut off. I accidentally introduced this bug in my change a day or two ago. My bad! Modified Paths: -------------- trunk/src/util.c Modified: trunk/src/util.c =================================================================== --- trunk/src/util.c 2006-07-09 21:40:17 UTC (rev 16474) +++ trunk/src/util.c 2006-07-10 06:59:27 UTC (rev 16475) @@ -2684,8 +2684,8 @@ g_return_val_if_fail(src != NULL, NULL); /* 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++) + destsize = 1; + for (i = 0; src[i] != '\0'; i++) { if (src[i] == '\n') destsize += 4; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-11 07:15:41
|
Revision: 16703 Author: thekingant Date: 2006-08-11 00:15:39 -0700 (Fri, 11 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16703&view=rev Log Message: ----------- Don't use the same callback for both gaim_proxy_connect() and gaim_input_add(). Aside from being a little confusing, it's hindering some changes I want to make to gaim_proxy_connect(). Modified Paths: -------------- trunk/src/util.c Modified: trunk/src/util.c =================================================================== --- trunk/src/util.c 2006-08-11 06:38:37 UTC (rev 16702) +++ trunk/src/util.c 2006-08-11 07:15:39 UTC (rev 16703) @@ -3202,7 +3202,7 @@ static void -url_fetched_cb(gpointer url_data, gint sock, GaimInputCondition cond) +url_fetch_recv_cb(gpointer url_data, gint source, GaimInputCondition cond) { GaimFetchUrlData *gfud = url_data; int len; @@ -3210,7 +3210,7 @@ char *data_cursor; gboolean got_eof = FALSE; - while((len = read(sock, buf, sizeof(buf))) > 0) { + while((len = read(source, buf, sizeof(buf))) > 0) { /* If we've filled up our butfer, make it bigger */ if((gfud->len + len) >= gfud->data_len) { while((gfud->len + len) >= gfud->data_len) @@ -3240,7 +3240,7 @@ header_len, gfud->webdata); /* See if we can find a redirect. */ - if(parse_redirect(gfud->webdata, header_len, sock, gfud)) + if(parse_redirect(gfud->webdata, header_len, source, gfud)) return; gfud->got_headers = TRUE; @@ -3273,7 +3273,7 @@ gaim_debug_error("gaim_url_fetch", "Failed to allocate %u bytes: %s\n", content_len, strerror(errno)); gaim_input_remove(gfud->inpa); - close(sock); + close(source); gfud->callback(gfud->user_data, NULL, 0); destroy_fetch_url_data(gfud); @@ -3310,7 +3310,7 @@ got_eof = TRUE; } else { gaim_input_remove(gfud->inpa); - close(sock); + close(source); gfud->callback(gfud->user_data, NULL, 0); @@ -3326,7 +3326,7 @@ /* gaim_debug_misc("gaim_url_fetch", "Received: '%s'\n", gfud->webdata); */ gaim_input_remove(gfud->inpa); - close(sock); + close(source); gfud->callback(gfud->user_data, gfud->webdata, gfud->len); destroy_fetch_url_data(gfud); @@ -3334,17 +3334,54 @@ } static void -url_fetch_connect_cb(gpointer url_data, gint sock, GaimInputCondition cond) { - GaimFetchUrlData *gfud = url_data; +url_fetch_send_cb(gpointer data, gint source, GaimInputCondition cond) +{ + GaimFetchUrlData *gfud; int len, total_len; - if(sock == -1) { + gfud = data; + + total_len = strlen(gfud->request); + + len = write(source, gfud->request + gfud->request_written, + total_len - gfud->request_written); + + if(len < 0 && errno == EAGAIN) + return; + else if(len < 0) { + gaim_input_remove(gfud->inpa); + close(source); gfud->callback(gfud->user_data, NULL, 0); destroy_fetch_url_data(gfud); return; } + gfud->request_written += len; - if (!gfud->request) { + if(gfud->request_written != total_len) + return; + + /* We're done writing, now start reading */ + gaim_input_remove(gfud->inpa); + gfud->inpa = gaim_input_add(source, GAIM_INPUT_READ, url_fetch_recv_cb, + gfud); +} + +static void +url_fetch_connect_cb(gpointer url_data, gint source, GaimInputCondition cond) +{ + GaimFetchUrlData *gfud; + + gfud = url_data; + + if (source == -1) + { + gfud->callback(gfud->user_data, NULL, 0); + destroy_fetch_url_data(gfud); + return; + } + + if (!gfud->request) + { if (gfud->user_agent) { /* Host header is not forbidden in HTTP/1.0 requests, and HTTP/1.1 * clients must know how to handle the "chunked" transfer encoding. @@ -3376,33 +3413,9 @@ gaim_debug_misc("gaim_url_fetch", "Request: '%s'\n", gfud->request); - if(!gfud->inpa) - gfud->inpa = gaim_input_add(sock, GAIM_INPUT_WRITE, - url_fetch_connect_cb, gfud); - - total_len = strlen(gfud->request); - - len = write(sock, gfud->request + gfud->request_written, - total_len - gfud->request_written); - - if(len < 0 && errno == EAGAIN) - return; - else if(len < 0) { - gaim_input_remove(gfud->inpa); - close(sock); - gfud->callback(gfud->user_data, NULL, 0); - destroy_fetch_url_data(gfud); - return; - } - gfud->request_written += len; - - if(gfud->request_written != total_len) - return; - - gaim_input_remove(gfud->inpa); - - gfud->inpa = gaim_input_add(sock, GAIM_INPUT_READ, url_fetched_cb, - gfud); + gfud->inpa = gaim_input_add(source, GAIM_INPUT_WRITE, + url_fetch_send_cb, gfud); + url_fetch_send_cb(gfud, source, GAIM_INPUT_WRITE); } void This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-18 01:55:35
|
Revision: 16824 Author: sadrul Date: 2006-08-17 18:55:26 -0700 (Thu, 17 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16824&view=rev Log Message: ----------- This is better. Modified Paths: -------------- trunk/src/util.c Modified: trunk/src/util.c =================================================================== --- trunk/src/util.c 2006-08-18 00:23:39 UTC (rev 16823) +++ trunk/src/util.c 2006-08-18 01:55:26 UTC (rev 16824) @@ -877,11 +877,11 @@ else if(IS_ENTITY(" ")) pln = " "; else if(IS_ENTITY("©")) - pln = "\251"; + pln = "\302\251"; /* or use g_unichar_to_utf8(0xa9); */ else if(IS_ENTITY(""")) pln = "\""; else if(IS_ENTITY("®")) - pln = "\256"; + pln = "\302\256"; /* or use g_unichar_to_utf8(0xae); */ else if(IS_ENTITY("'")) pln = "\'"; else if(*(text+1) == '#' && (sscanf(text, "&#%u;", £) == 1) && This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |