Mercurial > pidgin.yaz
changeset 10899:1e6bdc7175e9
[gaim-migrate @ 12619]
Bits'n'pieces:
Don't allow gaim-remote "clones" to knock gaim out by specifying a big packet
length.
Correctly bound the point sizes in gtkimhtml & yahoo
Fix up some code in MSN that isn't actually being used, just in case someone
comes along and submits a patch that would use it.
Don't try writing to the server in MSN if you're not actually connected
Fix message flags in SILC
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Thu, 05 May 2005 13:09:28 +0000 |
parents | cfacc0de0d94 |
children | d056acc96b30 |
files | plugins/gaim-remote/remote-socket.c src/gtkimhtml.c src/protocols/msn/directconn.c src/protocols/yahoo/util.c |
diffstat | 4 files changed, 19 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/gaim-remote/remote-socket.c Tue May 03 04:40:53 2005 +0000 +++ b/plugins/gaim-remote/remote-socket.c Thu May 05 13:09:28 2005 +0000 @@ -142,9 +142,9 @@ } if (p->length) { - data = g_malloc(p->length); + data = g_try_malloc(p->length); - if ((read(fd, data, p->length)) != p->length) { + if ((data == NULL) || (read(fd, data, p->length)) != p->length) { g_free(p); return NULL; }
--- a/src/gtkimhtml.c Tue May 03 04:40:53 2005 +0000 +++ b/src/gtkimhtml.c Thu May 05 13:09:28 2005 +0000 @@ -96,10 +96,9 @@ static void paste_received_cb (GtkClipboard *clipboard, GtkSelectionData *selection_data, gpointer data); static void paste_plaintext_received_cb (GtkClipboard *clipboard, const gchar *text, gpointer data); -/* POINT_SIZE converts from AIM font sizes to point sizes. It probably should be redone in such a - * way that it base the sizes off the default font size rather than using arbitrary font sizes. */ +/* POINT_SIZE converts from AIM font sizes to a point size scale factor. */ #define MAX_FONT_SIZE 7 -#define POINT_SIZE(x) (options & GTK_IMHTML_USE_POINTSIZE ? x : _point_sizes [MIN ((x), MAX_FONT_SIZE) - 1]) +#define POINT_SIZE(x) (_point_sizes [MIN ((x > 0 ? x : 1), MAX_FONT_SCALE) - 1]) static gdouble _point_sizes [] = { .69444444, .8333333, 1, 1.2, 1.44, 1.728, 2.0736}; enum { @@ -3453,7 +3452,7 @@ GtkTextAttributes *attr = gtk_text_view_get_default_attributes(GTK_TEXT_VIEW(imhtml)); tag = gtk_text_buffer_create_tag(imhtml->text_buffer, str, "size", (gint) (pango_font_description_get_size(attr->font) * - (double) _point_sizes[size-1]), NULL); + (double) POINT_SIZE(size)), NULL); gtk_text_attributes_unref(attr); }
--- a/src/protocols/msn/directconn.c Tue May 03 04:40:53 2005 +0000 +++ b/src/protocols/msn/directconn.c Thu May 05 13:09:28 2005 +0000 @@ -315,12 +315,20 @@ return; } - body = g_malloc(body_len); + body = g_try_malloc(body_len); + + if (body != NULL) + { + /* Let's read the data. */ + len = read(directconn->fd, body, body_len); - /* Let's read the data. */ - len = read(directconn->fd, body, body_len); - - gaim_debug_info("msn", "len=%d\n", len); + gaim_debug_info("msn", "len=%d\n", len); + } + else + { + gaim_debug_error("msn", "Failed to allocate memory for read\n"); + len = 0; + } if (len > 0) {
--- a/src/protocols/yahoo/util.c Tue May 03 04:40:53 2005 +0000 +++ b/src/protocols/yahoo/util.c Thu May 05 13:09:28 2005 +0000 @@ -349,7 +349,7 @@ /* borrowed from gtkimhtml */ #define MAX_FONT_SIZE 7 -#define POINT_SIZE(x) (_point_sizes [MIN ((x), MAX_FONT_SIZE) - 1]) +#define POINT_SIZE(x) (_point_sizes [MIN ((x > 0 ? x : 1), MAX_FONT_SIZE) - 1]) static gint _point_sizes [] = { 8, 10, 12, 14, 20, 30, 40 }; enum fatype { size, color, face, junk };