libsoup r1190 - in trunk: . libsoup



Author: danw
Date: Mon Oct 27 21:40:40 2008
New Revision: 1190
URL: http://svn.gnome.org/viewvc/libsoup?rev=1190&view=rev

Log:
	* libsoup/soup-cookie.c (soup_cookie_free): free the expires date,
	if set

	* libsoup/soup-auth-domain-basic.h:
	* libsoup/soup-auth-domain-digest.h:
	* libsoup/soup-auth-domain.h:
	* libsoup/soup-cookie-jar.h:
	* libsoup/soup-logger.h:
	* libsoup/soup-multipart.h: add G_BEGIN/END_DECLS

	* libsoup/soup-date.c: add some g_return_if_fails

	Patches from and inspired by Xan Lopez, #522125


Modified:
   trunk/ChangeLog
   trunk/libsoup/soup-auth-domain-basic.h
   trunk/libsoup/soup-auth-domain-digest.h
   trunk/libsoup/soup-auth-domain.h
   trunk/libsoup/soup-cookie-jar.h
   trunk/libsoup/soup-cookie.c
   trunk/libsoup/soup-date.c
   trunk/libsoup/soup-logger.h
   trunk/libsoup/soup-multipart.h

Modified: trunk/libsoup/soup-auth-domain-basic.h
==============================================================================
--- trunk/libsoup/soup-auth-domain-basic.h	(original)
+++ trunk/libsoup/soup-auth-domain-basic.h	Mon Oct 27 21:40:40 2008
@@ -8,6 +8,8 @@
 
 #include <libsoup/soup-auth-domain.h>
 
+G_BEGIN_DECLS
+
 #define SOUP_TYPE_AUTH_DOMAIN_BASIC            (soup_auth_domain_basic_get_type ())
 #define SOUP_AUTH_DOMAIN_BASIC(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_AUTH_DOMAIN_BASIC, SoupAuthDomainBasic))
 #define SOUP_AUTH_DOMAIN_BASIC_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_AUTH_DOMAIN_BASIC, SoupAuthDomainBasicClass))
@@ -49,4 +51,6 @@
 						     gpointer        user_data,
 						     GDestroyNotify  dnotify);
 
+G_END_DECLS
+
 #endif /* SOUP_AUTH_DOMAIN_BASIC_H */

Modified: trunk/libsoup/soup-auth-domain-digest.h
==============================================================================
--- trunk/libsoup/soup-auth-domain-digest.h	(original)
+++ trunk/libsoup/soup-auth-domain-digest.h	Mon Oct 27 21:40:40 2008
@@ -8,6 +8,8 @@
 
 #include <libsoup/soup-auth-domain.h>
 
+G_BEGIN_DECLS
+
 #define SOUP_TYPE_AUTH_DOMAIN_DIGEST            (soup_auth_domain_digest_get_type ())
 #define SOUP_AUTH_DOMAIN_DIGEST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_AUTH_DOMAIN_DIGEST, SoupAuthDomainDigest))
 #define SOUP_AUTH_DOMAIN_DIGEST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_AUTH_DOMAIN_DIGEST, SoupAuthDomainDigestClass))
@@ -52,4 +54,6 @@
 						    const char     *realm,
 						    const char     *password);
 
+G_END_DECLS
+
 #endif /* SOUP_AUTH_DOMAIN_DIGEST_H */

Modified: trunk/libsoup/soup-auth-domain.h
==============================================================================
--- trunk/libsoup/soup-auth-domain.h	(original)
+++ trunk/libsoup/soup-auth-domain.h	Mon Oct 27 21:40:40 2008
@@ -8,6 +8,8 @@
 
 #include <libsoup/soup-types.h>
 
+G_BEGIN_DECLS
+
 #define SOUP_TYPE_AUTH_DOMAIN            (soup_auth_domain_get_type ())
 #define SOUP_AUTH_DOMAIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_AUTH_DOMAIN, SoupAuthDomain))
 #define SOUP_AUTH_DOMAIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_AUTH_DOMAIN, SoupAuthDomainClass))
@@ -92,4 +94,6 @@
 							SoupMessage    *msg,
 							const char     *username);
 
+G_END_DECLS
+
 #endif /* SOUP_AUTH_DOMAIN_H */

Modified: trunk/libsoup/soup-cookie-jar.h
==============================================================================
--- trunk/libsoup/soup-cookie-jar.h	(original)
+++ trunk/libsoup/soup-cookie-jar.h	Mon Oct 27 21:40:40 2008
@@ -8,6 +8,8 @@
 
 #include <libsoup/soup-types.h>
 
+G_BEGIN_DECLS
+
 #define SOUP_TYPE_COOKIE_JAR            (soup_cookie_jar_get_type ())
 #define SOUP_COOKIE_JAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_COOKIE_JAR, SoupCookieJar))
 #define SOUP_COOKIE_JAR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_COOKIE_JAR, SoupCookieJarClass))
@@ -45,4 +47,6 @@
 					    SoupURI       *uri,
 					    const char    *cookie);
 
+G_END_DECLS
+
 #endif /* SOUP_COOKIE_JAR_H */

Modified: trunk/libsoup/soup-cookie.c
==============================================================================
--- trunk/libsoup/soup-cookie.c	(original)
+++ trunk/libsoup/soup-cookie.c	Mon Oct 27 21:40:40 2008
@@ -675,6 +675,9 @@
 	g_free (cookie->domain);
 	g_free (cookie->path);
 
+	if (cookie->expires)
+		soup_date_free (cookie->expires);
+
 	g_slice_free (SoupCookie, cookie);
 }
 

Modified: trunk/libsoup/soup-date.c
==============================================================================
--- trunk/libsoup/soup-date.c	(original)
+++ trunk/libsoup/soup-date.c	Mon Oct 27 21:40:40 2008
@@ -410,9 +410,13 @@
 SoupDate *
 soup_date_new_from_string (const char *date_string)
 {
-	SoupDate *date = g_slice_new (SoupDate);
+	SoupDate *date;
 	gboolean success;
 
+	g_return_val_if_fail (date_string != NULL, NULL);
+
+	date = g_slice_new (SoupDate);
+
 	while (g_ascii_isspace (*date_string))
 		date_string++;
 
@@ -489,6 +493,8 @@
 char *
 soup_date_to_string (SoupDate *date, SoupDateFormat format)
 {
+	g_return_val_if_fail (date != NULL, NULL);
+
 	/* FIXME: offset, 8601 zones, etc */
 
 	switch (format) {
@@ -544,6 +550,8 @@
 	time_t tt;
 	GTimeVal val;
 
+	g_return_val_if_fail (date != NULL, 0);
+
 	/* FIXME: offset, etc */
 
 	if (date->year < 1970)
@@ -576,6 +584,9 @@
 void
 soup_date_to_timeval (SoupDate *date, GTimeVal *time)
 {
+	g_return_if_fail (date != NULL);
+	g_return_if_fail (time != NULL);
+
 	/* FIXME: offset, etc */
 
 	time->tv_sec = rata_die_day (date) - TIME_T_EPOCH_RATA_DIE_DAY;
@@ -594,6 +605,8 @@
 gboolean
 soup_date_is_past (SoupDate *date)
 {
+	g_return_val_if_fail (date != NULL, TRUE);
+
 	/* optimization */
 	if (date->year < 2008)
 		return TRUE;
@@ -610,8 +623,11 @@
 SoupDate *
 soup_date_copy (SoupDate *date)
 {
-	SoupDate *copy = g_slice_new (SoupDate);
+	SoupDate *copy;
 
+	g_return_val_if_fail (date != NULL, NULL);
+
+	copy = g_slice_new (SoupDate);
 	memcpy (copy, date, sizeof (SoupDate));
 	return copy;
 }
@@ -625,5 +641,7 @@
 void
 soup_date_free (SoupDate *date)
 {
+	g_return_if_fail (date != NULL);
+
 	g_slice_free (SoupDate, date);
 }

Modified: trunk/libsoup/soup-logger.h
==============================================================================
--- trunk/libsoup/soup-logger.h	(original)
+++ trunk/libsoup/soup-logger.h	Mon Oct 27 21:40:40 2008
@@ -8,6 +8,8 @@
 
 #include <libsoup/soup-types.h>
 
+G_BEGIN_DECLS
+
 #define SOUP_TYPE_LOGGER            (soup_logger_get_type ())
 #define SOUP_LOGGER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_LOGGER, SoupLogger))
 #define SOUP_LOGGER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_LOGGER, SoupLoggerClass))
@@ -73,4 +75,6 @@
 					     gpointer           printer_data,
 					     GDestroyNotify     destroy);
 
+G_END_DECLS
+
 #endif /* SOUP_LOGGER_H */

Modified: trunk/libsoup/soup-multipart.h
==============================================================================
--- trunk/libsoup/soup-multipart.h	(original)
+++ trunk/libsoup/soup-multipart.h	Mon Oct 27 21:40:40 2008
@@ -10,6 +10,8 @@
 #include <libsoup/soup-message-body.h>
 #include <libsoup/soup-message-headers.h>
 
+G_BEGIN_DECLS
+
 typedef struct SoupMultipart SoupMultipart;
 
 GType soup_multipart_get_type (void);
@@ -44,4 +46,6 @@
 
 void     soup_multipart_free               (SoupMultipart       *multipart);
 
+G_END_DECLS
+
 #endif /* SOUP_MULTIPART_H */



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