pidgin: 427fa9d0: ft: Apply QuLogic's fix from d6b03d30f4 ...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Fri Mar 5 17:25:51 EST 2010


-----------------------------------------------------------------
Revision: 427fa9d0c4e00a787926407db7c1aba85eb3a479
Ancestor: ca3daabfbe02e853b3cc37b80ebe1746df97932a
Author: darkrain42 at pidgin.im
Date: 2010-03-05T22:20:00
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/427fa9d0c4e00a787926407db7c1aba85eb3a479

Modified files:
        libpurple/ft.c

ChangeLog: 

ft: Apply QuLogic's fix from d6b03d30f4 to the UI side too.

-------------- next part --------------
============================================================
--- libpurple/ft.c	1f62ea837f1ebc131e374e58724854e0e643883c
+++ libpurple/ft.c	5fd08d69c6b570a2b591a11313b4035036ef834f
@@ -1088,6 +1088,7 @@ do_transfer(PurpleXfer *xfer)
 		size_t result = 0;
 		size_t s = MIN(purple_xfer_get_bytes_remaining(xfer), xfer->current_buffer_size);
 		PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer);
+		gboolean read = TRUE;
 
 		/* this is so the prpl can keep the connection open
 		   if it needs to for some odd reason. */
@@ -1099,41 +1100,41 @@ do_transfer(PurpleXfer *xfer)
 			return;
 		}
 
-		if (ui_ops && ui_ops->ui_read) {
-			gssize tmp = ui_ops->ui_read(xfer, &buffer, s);
-			if (tmp == 0) {
-				/*
-				 * The UI claimed it was ready, but didn't have any data for
-				 * us...  It will call purple_xfer_ui_ready when ready, which
-				 * sets back up this watcher.
-				 */
-				if (xfer->watcher != 0) {
-					purple_input_remove(xfer->watcher);
-					xfer->watcher = 0;
-				}
+		if (priv->buffer) {
+			if (priv->buffer->len < s) {
+				s -= priv->buffer->len;
+				read = TRUE;
+			} else {
+				read = FALSE;
+			}
+		}
 
-				/* Need to indicate the prpl is still ready... */
-				priv->ready |= PURPLE_XFER_READY_PRPL;
+		if (read) {
+			if (ui_ops && ui_ops->ui_read) {
+				gssize tmp = ui_ops->ui_read(xfer, &buffer, s);
+				if (tmp == 0) {
+					/*
+					 * The UI claimed it was ready, but didn't have any data for
+					 * us...  It will call purple_xfer_ui_ready when ready, which
+					 * sets back up this watcher.
+					 */
+					if (xfer->watcher != 0) {
+						purple_input_remove(xfer->watcher);
+						xfer->watcher = 0;
+					}
 
-				g_return_if_reached();
-			} else if (tmp < 0) {
-				purple_debug_error("filetransfer", "Unable to read whole buffer.\n");
-				purple_xfer_cancel_local(xfer);
-				return;
-			}
+					/* Need to indicate the prpl is still ready... */
+					priv->ready |= PURPLE_XFER_READY_PRPL;
 
-			result = tmp;
-		} else {
-			gboolean read = TRUE;
-			if (priv->buffer) {
-				if (priv->buffer->len < s) {
-					s -= priv->buffer->len;
-					read = TRUE;
-				} else {
-					read = FALSE;
+					g_return_if_reached();
+				} else if (tmp < 0) {
+					purple_debug_error("filetransfer", "Unable to read whole buffer.\n");
+					purple_xfer_cancel_local(xfer);
+					return;
 				}
-			}
-			if (read) {
+
+				result = tmp;
+			} else {
 				buffer = g_malloc(s);
 				result = fread(buffer, 1, s, xfer->dest_fp);
 				if (result != s) {


More information about the Commits mailing list