pidgin: 99bc79c8: Upgrade PurpleXfer for a 64-bit world.

qulogic at pidgin.im qulogic at pidgin.im
Sun Oct 16 04:26:10 EDT 2011


----------------------------------------------------------------------
Revision: 99bc79c8229d3feccd5211b2263e4ea5215b3f62
Parent:   39a315ca0bc392c66b472809cfd14e2ee087e74a
Author:   qulogic at pidgin.im
Date:     10/16/11 00:38:12
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/99bc79c8229d3feccd5211b2263e4ea5215b3f62

Changelog: 

Upgrade PurpleXfer for a 64-bit world.

Prpls and UIs still need to handle this properly though.

Refs #1185.
Refs #8477.

Changes against parent 39a315ca0bc392c66b472809cfd14e2ee087e74a

  patched  ChangeLog.API
  patched  libpurple/ft.c
  patched  libpurple/ft.h
  patched  libpurple/util.c
  patched  libpurple/util.h

-------------- next part --------------
============================================================
--- libpurple/util.c	1de2c9c42fa904f18c6a404f954477ca22866ca5
+++ libpurple/util.c	9c097cca626e0ac88400a951e255522cb40481be
@@ -3331,9 +3331,9 @@ char *
 }
 
 char *
-purple_str_size_to_units(size_t size)
+purple_str_size_to_units(goffset size)
 {
-	static const char * const size_str[] = { "bytes", "KiB", "MiB", "GiB" };
+	static const char * const size_str[] = { "bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB" };
 	float size_mag;
 	int size_index = 0;
 
@@ -3346,7 +3346,7 @@ purple_str_size_to_units(size_t size)
 	else {
 		size_mag = (float)size;
 
-		while ((size_index < 3) && (size_mag > 1024)) {
+		while ((size_index < G_N_ELEMENTS(size_str) - 1) && (size_mag > 1024)) {
 			size_mag /= 1024;
 			size_index++;
 		}
============================================================
--- libpurple/ft.c	568cb5f69e610604455a12b5c1f97581dc35b11b
+++ libpurple/ft.c	84f8ec34b8984ee4362a89a68d32d439b73d318c
@@ -490,7 +490,7 @@ purple_xfer_ask_recv(PurpleXfer *xfer)
 purple_xfer_ask_recv(PurpleXfer *xfer)
 {
 	char *buf, *size_buf;
-	size_t size;
+	goffset size;
 	gconstpointer thumb;
 	gsize thumb_size;
 
@@ -801,7 +801,7 @@ purple_xfer_get_local_filename(const Pur
 	return xfer->local_filename;
 }
 
-size_t
+goffset
 purple_xfer_get_bytes_sent(const PurpleXfer *xfer)
 {
 	g_return_val_if_fail(xfer != NULL, 0);
@@ -809,7 +809,7 @@ purple_xfer_get_bytes_sent(const PurpleX
 	return xfer->bytes_sent;
 }
 
-size_t
+goffset
 purple_xfer_get_bytes_remaining(const PurpleXfer *xfer)
 {
 	g_return_val_if_fail(xfer != NULL, 0);
@@ -817,7 +817,7 @@ purple_xfer_get_bytes_remaining(const Pu
 	return xfer->bytes_remaining;
 }
 
-size_t
+goffset
 purple_xfer_get_size(const PurpleXfer *xfer)
 {
 	g_return_val_if_fail(xfer != NULL, 0);
@@ -965,7 +965,7 @@ void
 }
 
 void
-purple_xfer_set_size(PurpleXfer *xfer, size_t size)
+purple_xfer_set_size(PurpleXfer *xfer, goffset size)
 {
 	g_return_if_fail(xfer != NULL);
 
@@ -982,7 +982,7 @@ void
 }
 
 void
-purple_xfer_set_bytes_sent(PurpleXfer *xfer, size_t bytes_sent)
+purple_xfer_set_bytes_sent(PurpleXfer *xfer, goffset bytes_sent)
 {
 	g_return_if_fail(xfer != NULL);
 
============================================================
--- libpurple/ft.h	ac574db4985013de3bd46c46ce337a88e694d8fe
+++ libpurple/ft.h	dd906b053187da009f745186df5b8c5671198056
@@ -140,7 +140,7 @@ struct _PurpleXfer
 	char *message;                /**< A message sent with the request     */
 	char *filename;               /**< The name sent over the network.     */
 	char *local_filename;         /**< The name on the local hard drive.   */
-	size_t size;                  /**< The size of the file.               */
+	goffset size;                 /**< The size of the file.               */
 
 	FILE *dest_fp;                /**< The destination file pointer.       */
 
@@ -151,8 +151,8 @@ struct _PurpleXfer
 	int fd;                       /**< The socket file descriptor.         */
 	int watcher;                  /**< Watcher.                            */
 
-	size_t bytes_sent;            /**< The number of bytes sent.           */
-	size_t bytes_remaining;       /**< The number of bytes remaining.      */
+	goffset bytes_sent;           /**< The number of bytes sent.           */
+	goffset bytes_remaining;      /**< The number of bytes remaining.      */
 	time_t start_time;            /**< When the transfer of data began.    */
 	time_t end_time;              /**< When the transfer of data ended.    */
 
@@ -358,7 +358,7 @@ const char *purple_xfer_get_local_filena
  *
  * @return The number of bytes sent.
  */
-size_t purple_xfer_get_bytes_sent(const PurpleXfer *xfer);
+goffset purple_xfer_get_bytes_sent(const PurpleXfer *xfer);
 
 /**
  * Returns the number of bytes remaining to send or receive.
@@ -367,7 +367,7 @@ size_t purple_xfer_get_bytes_sent(const 
  *
  * @return The number of bytes remaining.
  */
-size_t purple_xfer_get_bytes_remaining(const PurpleXfer *xfer);
+goffset purple_xfer_get_bytes_remaining(const PurpleXfer *xfer);
 
 /**
  * Returns the size of the file being sent or received.
@@ -376,7 +376,7 @@ size_t purple_xfer_get_bytes_remaining(c
  *
  * @return The total size of the file.
  */
-size_t purple_xfer_get_size(const PurpleXfer *xfer);
+goffset purple_xfer_get_size(const PurpleXfer *xfer);
 
 /**
  * Returns the current percentage of progress of the transfer.
@@ -496,7 +496,7 @@ void purple_xfer_set_local_filename(Purp
  * @param xfer The file transfer.
  * @param size The size of the file.
  */
-void purple_xfer_set_size(PurpleXfer *xfer, size_t size);
+void purple_xfer_set_size(PurpleXfer *xfer, goffset size);
 
 /**
  * Sets the local port of the file transfer.
@@ -519,7 +519,7 @@ void purple_xfer_set_local_port(PurpleXf
  *                   send.  If we're receiving a file, this is the
  *                   next byte that we expect to receive.
  */
-void purple_xfer_set_bytes_sent(PurpleXfer *xfer, size_t bytes_sent);
+void purple_xfer_set_bytes_sent(PurpleXfer *xfer, goffset bytes_sent);
 
 /**
  * Returns the UI operations structure for a file transfer.
@@ -848,3 +848,4 @@ PurpleXferUiOps *purple_xfers_get_ui_ops
 #endif
 
 #endif /* _PURPLE_FT_H_ */
+
============================================================
--- libpurple/util.h	a2bb858b20ba759805dd749a687b7aac5d626a73
+++ libpurple/util.h	d791963c8a0f547b414cf0665d68c42ce3ef43d2
@@ -1091,7 +1091,7 @@ const char *purple_strcasestr(const char
  *
  * @return The string in units form. This must be freed.
  */
-char *purple_str_size_to_units(size_t size);
+char *purple_str_size_to_units(goffset size);
 
 /**
  * Converts seconds into a human-readable form.
============================================================
--- ChangeLog.API	a6cbbb057dbdf4865817cc9030eee01fcef40bfd
+++ ChangeLog.API	dae8829c0531207174568e78a0d4d79e4bde08f5
@@ -84,15 +84,25 @@ version 3.0.0 (??/??/????):
 		* purple_notify_user_info_prepend_pair renamed to
 		  purple_notify_user_info_prepend_pair_html
 		* purple_srv_resolve now takes a PurpleAccount as the first parameter
+		* purple_str_size_to_units now takes a goffset as the size parameter
 		* purple_txt_resolve now takes a PurpleAccount as the first parameter
 		* purple_util_fetch_url_request now takes a PurpleAccount as
 		  the first parameter
 		* purple_util_fetch_url_request now takes a length as the eighth
 		  parameter
 		* purple_util_fetch_url_len now takes a length as the fifth parameter
+		* purple_xfer_get_bytes_remaining now returns a goffset
+		* purple_xfer_get_bytes_sent now returns a goffset
+		* purple_xfer_get_size now returns a goffset
 		* purple_xfer_is_canceled renamed to purple_xfer_is_cancelled
+		* purple_xfer_set_bytes_sent now takes a goffset as the bytes_sent
+		  parameter
+		* purple_xfer_set_size now takes a goffset as the size parameter
 		* PurpleConnectionUiOps.report_disconnect now passes a
 		  PurpleConnectionError as the second parameter
+		* PurpleXfer.bytes_remaining is now a goffset
+		* PurpleXfer.bytes_sent is now a goffset
+		* PurpleXfer.size is now a goffset
 
 		Removed:
 		* _GntFileType


More information about the Commits mailing list