Mercurial > pidgin
diff src/core.c @ 4793:677d3cb193a1
[gaim-migrate @ 5113]
this removes all the remaining deprecated glib, gdk, gdk-pixbuf, and gtk
function calls. Hopefully I didn't break anything.
Most of this is due to the deprecation of g_strcasecmp and g_strncasecmp.
Two functions I never thought would be deprecated, but apparently they're
no good at comparing utf8 text. g_ascii_str{,n}casecmp is OK when you're
sure that it's ASCII. Otherwise, we're supposed to use g_utf8_collate(),
except that it is case sensitive. Since glib doesn't currently have a
case-insensitive one, I wrote one. If you need to compare utf8 text, you
can use gaim_utf8_strcasecmp().
I have to go do dishes now.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 16 Mar 2003 00:01:49 +0000 |
parents | c4c28874ecd3 |
children | 4af15fbcb00a |
line wrap: on
line diff
--- a/src/core.c Sat Mar 15 22:22:39 2003 +0000 +++ b/src/core.c Sun Mar 16 00:01:49 2003 +0000 @@ -96,9 +96,11 @@ gint UI_write(struct UI *ui, guchar *data, gint len) { + GError *error; gint sent; /* we'll let the write silently fail because the read will pick it up as dead */ - g_io_channel_write(ui->channel, data, len, &sent); + g_io_channel_write_chars(ui->channel, data, len, &sent, &error); + g_free(error); return sent; } @@ -149,6 +151,7 @@ static void meta_handler(struct UI *ui, guchar subtype, guchar *data) { struct gaim_cui_packet *p; + GError *error = NULL; switch (subtype) { case CUI_META_LIST: break; @@ -156,7 +159,7 @@ while (uis) { ui = uis->data; uis = g_slist_remove(uis, ui); - g_io_channel_close(ui->channel); + g_io_channel_shutdown(ui->channel, TRUE, &error); g_source_remove(ui->inpa); g_free(ui); } @@ -164,7 +167,7 @@ break; case CUI_META_DETACH: uis = g_slist_remove(uis, ui); - g_io_channel_close(ui->channel); + g_io_channel_shutdown(ui->channel, TRUE, &error); g_source_remove(ui->inpa); g_free(ui); break; @@ -177,6 +180,9 @@ debug_printf("unhandled meta subtype %d\n", subtype); break; } + + if(error) + g_free(error); } static void plugin_handler(struct UI *ui, guchar subtype, guchar *data) @@ -292,9 +298,13 @@ gint total = 0; gint cur; + GError *error; + while (total < len) { - if (g_io_channel_read(source, buf + total, len - total, &cur) != G_IO_ERROR_NONE) + if (g_io_channel_read_chars(source, buf + total, len - total, &cur, &error) != G_IO_STATUS_NORMAL) { + g_free(error); return -1; + } if (cur == 0) return total; total += cur; @@ -332,13 +342,17 @@ guchar subtype; guint32 len; + GError *error; + guchar *in; /* no byte order worries! this'll change if we go to TCP */ if (gaim_recv(source, &type, sizeof(type)) != sizeof(type)) { debug_printf("UI has abandoned us!\n"); uis = g_slist_remove(uis, ui); - g_io_channel_close(ui->channel); + g_io_channel_shutdown(ui->channel, TRUE, &error); + if(error) + g_free(error); g_source_remove(ui->inpa); g_free(ui); return FALSE; @@ -347,7 +361,9 @@ if (gaim_recv(source, &subtype, sizeof(subtype)) != sizeof(subtype)) { debug_printf("UI has abandoned us!\n"); uis = g_slist_remove(uis, ui); - g_io_channel_close(ui->channel); + g_io_channel_shutdown(ui->channel, TRUE, &error); + if(error) + g_free(error); g_source_remove(ui->inpa); g_free(ui); return FALSE; @@ -356,7 +372,9 @@ if (gaim_recv(source, (guchar *)&len, sizeof(len)) != sizeof(len)) { debug_printf("UI has abandoned us!\n"); uis = g_slist_remove(uis, ui); - g_io_channel_close(ui->channel); + g_io_channel_shutdown(ui->channel, TRUE, &error); + if(error) + g_free(error); g_source_remove(ui->inpa); g_free(ui); return FALSE; @@ -367,7 +385,9 @@ if (gaim_recv(source, in, len) != len) { debug_printf("UI has abandoned us!\n"); uis = g_slist_remove(uis, ui); - g_io_channel_close(ui->channel); + g_io_channel_shutdown(ui->channel, TRUE, &error); + if(error) + g_free(error); g_source_remove(ui->inpa); g_free(ui); return FALSE;