libsoup r1098 - in trunk: . libsoup



Author: otte
Date: Wed Feb 27 21:39:27 2008
New Revision: 1098
URL: http://svn.gnome.org/viewvc/libsoup?rev=1098&view=rev

Log:
2008-02-27  Benjamin Otte  <otte gnome org>

	* libsoup/soup-socket.c: (read_from_network), (soup_socket_read),
	(soup_socket_read_until), (soup_socket_write):
	ensure that nread/nwrote parameters aren't NULL. They are also
	properly set on error paths now.



Modified:
   trunk/ChangeLog
   trunk/libsoup/soup-socket.c

Modified: trunk/libsoup/soup-socket.c
==============================================================================
--- trunk/libsoup/soup-socket.c	(original)
+++ trunk/libsoup/soup-socket.c	Wed Feb 27 21:39:27 2008
@@ -1040,7 +1040,9 @@
 	GIOCondition cond = G_IO_IN;
 	GError *my_err = NULL;
 
-	if (!priv->iochannel) 
+	*nread = 0;
+
+	if (!priv->iochannel)
 		return SOUP_SOCKET_EOF;
 
 	status = g_io_channel_read_chars (priv->iochannel,
@@ -1151,6 +1153,8 @@
 	SoupSocketIOStatus status;
 
 	g_return_val_if_fail (SOUP_IS_SOCKET (sock), SOUP_SOCKET_ERROR);
+	g_return_val_if_fail (nread != NULL, SOUP_SOCKET_ERROR);
+
 	priv = SOUP_SOCKET_GET_PRIVATE (sock);
 
 	g_mutex_lock (priv->iolock);
@@ -1196,9 +1200,11 @@
 	guint8 *p, *end;
 
 	g_return_val_if_fail (SOUP_IS_SOCKET (sock), SOUP_SOCKET_ERROR);
-	priv = SOUP_SOCKET_GET_PRIVATE (sock);
+	g_return_val_if_fail (nread != NULL, SOUP_SOCKET_ERROR);
 	g_return_val_if_fail (len >= boundary_len, SOUP_SOCKET_ERROR);
 
+	priv = SOUP_SOCKET_GET_PRIVATE (sock);
+
 	g_mutex_lock (priv->iolock);
 
 	*got_boundary = FALSE;
@@ -1296,6 +1302,8 @@
 	GError *my_err = NULL;
 
 	g_return_val_if_fail (SOUP_IS_SOCKET (sock), SOUP_SOCKET_ERROR);
+	g_return_val_if_fail (nwrote != NULL, SOUP_SOCKET_ERROR);
+
 	priv = SOUP_SOCKET_GET_PRIVATE (sock);
 
 	g_mutex_lock (priv->iolock);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]