From: <the...@us...> - 2006-07-24 04:27:53
|
Revision: 16556 Author: thekingant Date: 2006-07-23 21:27:42 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16556&view=rev Log Message: ----------- Fix a minor case of accessing something that had been free'd in oscar, and some other minor cleanup. FYI "0" is a valid file descriptor, but it will pretty much always be STDOUT, STDERR or STDIN. But I like to check for -1 anyway, because I'm weird. Modified Paths: -------------- trunk/src/protocols/oscar/flap_connection.c trunk/src/protocols/oscar/odc.c trunk/src/protocols/oscar/oscar.h trunk/src/sslconn.c Modified: trunk/src/protocols/oscar/flap_connection.c =================================================================== --- trunk/src/protocols/oscar/flap_connection.c 2006-07-24 01:03:07 UTC (rev 16555) +++ trunk/src/protocols/oscar/flap_connection.c 2006-07-24 04:27:42 UTC (rev 16556) @@ -205,7 +205,6 @@ flap_connection_destroy_rates(conn->rates); od->oscar_connections = g_list_remove(od->oscar_connections, conn); - g_free(conn); account = gaim_connection_get_account(od->gc); @@ -227,12 +226,18 @@ else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) tmp = _("Could not establish a connection with the server."); else + /* + * We shouldn't print a message for some disconnect_reasons. + * Like OSCAR_DISCONNECT_LOCAL_CLOSED. + */ tmp = NULL; if (tmp != NULL) gaim_connection_error(od->gc, tmp); } + g_free(conn); + return FALSE; } Modified: trunk/src/protocols/oscar/odc.c =================================================================== --- trunk/src/protocols/oscar/odc.c 2006-07-24 01:03:07 UTC (rev 16555) +++ trunk/src/protocols/oscar/odc.c 2006-07-24 04:27:42 UTC (rev 16556) @@ -37,25 +37,15 @@ const gchar *tmp; if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) - { tmp = _("The remote user has closed the connection."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_REFUSED) - { tmp = _("The remote user has declined your request."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) - { tmp = _("Lost connection with the remote user for an unknown reason."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_INVALID_DATA) - { tmp = _("Received invalid data on connection with remote user."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) - { tmp = _("Could not establish a connection with the remote user."); - } else /* * We shouldn't print a message for some disconnect_reasons. Modified: trunk/src/protocols/oscar/oscar.h =================================================================== --- trunk/src/protocols/oscar/oscar.h 2006-07-24 01:03:07 UTC (rev 16555) +++ trunk/src/protocols/oscar/oscar.h 2006-07-24 04:27:42 UTC (rev 16556) @@ -287,14 +287,14 @@ typedef enum { - OSCAR_DISCONNECT_DONE, - OSCAR_DISCONNECT_LOCAL_CLOSED, + OSCAR_DISCONNECT_DONE, /* not considered an error */ + OSCAR_DISCONNECT_LOCAL_CLOSED, /* peer connections only, not considered an error */ OSCAR_DISCONNECT_REMOTE_CLOSED, - OSCAR_DISCONNECT_REMOTE_REFUSED, + OSCAR_DISCONNECT_REMOTE_REFUSED, /* peer connections only */ OSCAR_DISCONNECT_LOST_CONNECTION, OSCAR_DISCONNECT_INVALID_DATA, OSCAR_DISCONNECT_COULD_NOT_CONNECT, - OSCAR_DISCONNECT_RETRYING + OSCAR_DISCONNECT_RETRYING /* peer connections only */ } OscarDisconnectReason; typedef enum Modified: trunk/src/sslconn.c =================================================================== --- trunk/src/sslconn.c 2006-07-24 01:03:07 UTC (rev 16555) +++ trunk/src/sslconn.c 2006-07-24 04:27:42 UTC (rev 16556) @@ -137,7 +137,7 @@ GaimSslConnection *gsc; GaimSslOps *ops; - g_return_val_if_fail(fd > 0, NULL); + g_return_val_if_fail(fd != -1, NULL); g_return_val_if_fail(func != NULL, NULL); g_return_val_if_fail(gaim_ssl_is_supported(), NULL); @@ -178,12 +178,10 @@ if (ops != NULL && ops->close != NULL) (ops->close)(gsc); - if (gsc->fd) + if (gsc->fd != -1) close(gsc->fd); - if (gsc->host != NULL) - g_free(gsc->host); - + g_free(gsc->host); g_free(gsc); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |