gmime r1534 - trunk/gmime



Author: fejj
Date: Thu Apr  2 00:42:09 2009
New Revision: 1534
URL: http://svn.gnome.org/viewvc/gmime?rev=1534&view=rev

Log:
fixed a ton of compiler warnings with strict warning options enabled

Modified:
   trunk/gmime/charset-map.c
   trunk/gmime/gmime-charset.c
   trunk/gmime/gmime-filter-enriched.c
   trunk/gmime/gmime-gpg-context.c
   trunk/gmime/gmime-message-partial.c
   trunk/gmime/gmime-message.c
   trunk/gmime/gmime-object.c
   trunk/gmime/gmime-param.c
   trunk/gmime/gmime-parser.c
   trunk/gmime/gmime-part.c
   trunk/gmime/gmime-stream-buffer.c
   trunk/gmime/gmime-utils.c
   trunk/gmime/gmime.c

Modified: trunk/gmime/charset-map.c
==============================================================================
--- trunk/gmime/charset-map.c	(original)
+++ trunk/gmime/charset-map.c	Thu Apr  2 00:42:09 2009
@@ -117,9 +117,10 @@
 	char *inbuf, *outbuf;
 	guint32 out[128], c;
 	char in[128];
-	int i, j, k;
-	int bytes;
 	iconv_t cd;
+	int bytes;
+	int j, k;
+	size_t i;
 	
 	/* dont count the terminator */
 	bytes = ((sizeof (tables) / sizeof (tables[0])) + 7 - 1) / 8;
@@ -134,7 +135,7 @@
 		inleft = sizeof (in);
 		outbuf = (char *) out;
 		outleft = sizeof (out);
-		while (iconv (cd, &inbuf, &inleft, &outbuf, &outleft) == -1) {
+		while (iconv (cd, &inbuf, &inleft, &outbuf, &outleft) == (size_t) -1) {
 			if (errno == EILSEQ) {
 				inbuf++;
 				inleft--;

Modified: trunk/gmime/gmime-charset.c
==============================================================================
--- trunk/gmime/gmime-charset.c	(original)
+++ trunk/gmime/gmime-charset.c	Thu Apr  2 00:42:09 2009
@@ -202,7 +202,7 @@
 	char *codeset, *lang;
 	
 	if ((codeset = strchr (locale, '.')))
-		lang = g_strndup (locale, codeset - locale);
+		lang = g_strndup (locale, (size_t) (codeset - locale));
 	else
 		lang = g_strdup (locale);
 	

Modified: trunk/gmime/gmime-filter-enriched.c
==============================================================================
--- trunk/gmime/gmime-filter-enriched.c	(original)
+++ trunk/gmime/gmime-filter-enriched.c	Thu Apr  2 00:42:09 2009
@@ -237,7 +237,7 @@
 		while (end < inend && ((*end >= 'a' && *end <= 'z') || (*end >= 'A' && *end <= 'Z')))
 			end++;
 		
-		return g_strndup (inptr, end - inptr);
+		return g_strndup (inptr, (size_t) (end - inptr));
 	}
 	
 	for (i = 0; i < 3; i++) {
@@ -269,7 +269,7 @@
 	while (inptr < inend && *inptr != '"' && *inptr != '<' && *inptr != '>')
 		inptr++;
 	
-	return g_strndup (fontfamily, inptr - fontfamily);
+	return g_strndup (fontfamily, (size_t) (inptr - fontfamily));
 }
 
 static char *
@@ -282,7 +282,7 @@
 	while (inptr < inend && *inptr != '"' && *inptr != '<' && *inptr != '>')
 		inptr++;
 	
-	return g_strndup (lang, inptr - lang);
+	return g_strndup (lang, (size_t) (inptr - lang));
 }
 
 static char *
@@ -467,7 +467,7 @@
 							inptr++;
 						
 #define PARAM_TAG_MIN_LEN  (sizeof ("<param>") + sizeof ("</param>") - 1)
-						if (inptr == inend || (inend - inptr) <= PARAM_TAG_MIN_LEN) {
+						if (inptr == inend || (size_t) (inend - inptr) <= PARAM_TAG_MIN_LEN) {
 							inptr = tag - 1;
 							goto need_input;
 						}

Modified: trunk/gmime/gmime-gpg-context.c
==============================================================================
--- trunk/gmime/gmime-gpg-context.c	(original)
+++ trunk/gmime/gmime-gpg-context.c	Thu Apr  2 00:42:09 2009
@@ -475,7 +475,7 @@
 gpg_ctx_free (struct _GpgCtx *gpg)
 {
 	GMimeSigner *signer, *next;
-	int i;
+	guint i;
 	
 	if (gpg->session)
 		g_object_unref (gpg->session);
@@ -566,7 +566,7 @@
 	const char *hash_str;
 	GPtrArray *argv;
 	char *buf;
-	int i;
+	guint i;
 	
 	argv = g_ptr_array_new ();
 	g_ptr_array_add (argv, "gpg");
@@ -793,7 +793,7 @@
 		inptr++;
 	
 	if (token)
-		*token = g_strndup (start, inptr - start);
+		*token = g_strndup (start, (size_t) (inptr - start));
 	
 	return inptr;
 }
@@ -1391,7 +1391,7 @@
 			goto exception;
 		
 		if (nread > 0) {
-			status_backup (gpg, buffer, nread);
+			status_backup (gpg, buffer, (size_t) nread);
 			if (gpg_ctx_parse_status (gpg, err) == -1)
 				return -1;
 		} else {
@@ -1439,8 +1439,8 @@
 	}
 	
 	if ((pfds[GPG_PASSWD_FD].revents & (POLLOUT | POLLHUP)) && gpg->need_passwd && gpg->send_passwd) {
-		ssize_t w, nwritten = 0;
-		size_t n;
+		size_t n, nwritten = 0;
+		ssize_t w;
 		
 		d(printf ("sending gpg our passphrase...\n"));
 		
@@ -1808,7 +1808,7 @@
 {
 	GMimeGpgContext *ctx = (GMimeGpgContext *) context;
 	struct _GpgCtx *gpg;
-	int i;
+	guint i;
 	
 	gpg = gpg_ctx_new (context->session, ctx->path);
 	if (sign)
@@ -1985,7 +1985,7 @@
 {
 	GMimeGpgContext *ctx = (GMimeGpgContext *) context;
 	struct _GpgCtx *gpg;
-	int i;
+	guint i;
 	
 	gpg = gpg_ctx_new (context->session, ctx->path);
 	gpg_ctx_set_mode (gpg, GPG_CTX_MODE_EXPORT);

Modified: trunk/gmime/gmime-message-partial.c
==============================================================================
--- trunk/gmime/gmime-message-partial.c	(original)
+++ trunk/gmime/gmime-message-partial.c	Thu Apr  2 00:42:09 2009
@@ -320,17 +320,17 @@
 	const char *id;
 	size_t i;
 	
-	g_return_val_if_fail (num > 0, NULL);
-	
-	if (!(id = g_mime_message_partial_get_id (partials[0])))
+	if (num == 0 || !(id = g_mime_message_partial_get_id (partials[0])))
 		return NULL;
 	
 	/* get them into the correct order... */
 	qsort ((void *) partials, num, sizeof (gpointer), partial_compare);
 	
 	/* only the last message/partial part is REQUIRED to have the total parameter */
-	total = g_mime_message_partial_get_total (partials[num - 1]);
-	if (num != total)
+	if ((total = g_mime_message_partial_get_total (partials[num - 1])) == -1)
+		return NULL;
+	
+	if (num != (size_t) total)
 		return NULL;
 	
 	cat = g_mime_stream_cat_new ();
@@ -346,8 +346,10 @@
 			goto exception;
 		
 		/* sanity check to make sure we aren't missing any parts */
-		number = g_mime_message_partial_get_number (partial);
-		if (number != i + 1)
+		if ((number = g_mime_message_partial_get_number (partial)) == -1)
+			goto exception;
+		
+		if ((size_t) number != i + 1)
 			goto exception;
 		
 		wrapper = g_mime_part_get_content_object (GMIME_PART (partial));
@@ -424,7 +426,7 @@
 	size_t len, end;
 	const char *id;
 	gint64 start;
-	int i;
+	guint i;
 	
 	*nparts = 0;
 	

Modified: trunk/gmime/gmime-message.c
==============================================================================
--- trunk/gmime/gmime-message.c	(original)
+++ trunk/gmime/gmime-message.c	Thu Apr  2 00:42:09 2009
@@ -861,7 +861,7 @@
 	GMimeMessage *message = (GMimeMessage *) object;
 	InternetAddressList *addrlist;
 	GMimeRecipientType type;
-	int i;
+	guint i;
 	
 	if (!g_ascii_strcasecmp ("MIME-Version", header))
 		return FALSE;
@@ -1020,7 +1020,7 @@
 {
 	GMimeHeaderList *headers;
 	GMimeMessage *message;
-	int i;
+	guint i;
 	
 	message = g_object_newv (GMIME_TYPE_MESSAGE, 0, NULL);
 	

Modified: trunk/gmime/gmime-object.c
==============================================================================
--- trunk/gmime/gmime-object.c	(original)
+++ trunk/gmime/gmime-object.c	Thu Apr  2 00:42:09 2009
@@ -741,7 +741,7 @@
 {
 	GMimeContentDisposition *disposition;
 	GMimeContentType *content_type;
-	int i;
+	guint i;
 	
 	for (i = 0; i < G_N_ELEMENTS (content_headers); i++) {
 		if (!g_ascii_strcasecmp (content_headers[i], header))
@@ -883,7 +883,7 @@
 static gboolean
 remove_header (GMimeObject *object, const char *header)
 {
-	int i;
+	guint i;
 	
 	for (i = 0; i < G_N_ELEMENTS (content_headers); i++) {
 		if (!g_ascii_strcasecmp (content_headers[i], header))

Modified: trunk/gmime/gmime-param.c
==============================================================================
--- trunk/gmime/gmime-param.c	(original)
+++ trunk/gmime/gmime-param.c	Thu Apr  2 00:42:09 2009
@@ -141,11 +141,11 @@
 	
 	if (*inptr == '"') {
 		start++;
-		out = g_strndup (start, (unsigned int) (inptr - start));
+		out = g_strndup (start, (size_t) (inptr - start));
 		inptr++;
 	} else {
 		/* string wasn't properly quoted */
-		out = g_strndup (start, (unsigned int) (inptr - start));
+		out = g_strndup (start, (size_t) (inptr - start));
 	}
 	
 	*in = inptr;
@@ -177,7 +177,7 @@
 		inptr++;
 	if (inptr > start) {
 		*in = inptr;
-		return g_strndup (start, (unsigned int) (inptr - start));
+		return g_strndup (start, (size_t) (inptr - start));
 	} else {
 		return NULL;
 	}
@@ -215,7 +215,7 @@
 		inptr++;
 	if (inptr > start) {
 		*in = inptr;
-		return g_strndup (start, (unsigned int) (inptr - start));
+		return g_strndup (start, (size_t) (inptr - start));
 	} else {
 		return NULL;
 	}
@@ -396,7 +396,7 @@
 	
 	if (*inptr == '\'') {
 		if (langp)
-			*langp = g_strndup (lang, inptr - lang);
+			*langp = g_strndup (lang, (size_t) (inptr - lang));
 		
 		inptr++;
 	}
@@ -517,7 +517,8 @@
 	char *name, *value;
 	gboolean encoded;
 	GString *gvalue;
-	int id, i;
+	guint i;
+	int id;
 	
 	params = NULL;
 	tail = (GMimeParam *) &params;

Modified: trunk/gmime/gmime-parser.c
==============================================================================
--- trunk/gmime/gmime-parser.c	(original)
+++ trunk/gmime/gmime-parser.c	Thu Apr  2 00:42:09 2009
@@ -917,7 +917,7 @@
 			end = inptr;
 	}
 	
-	header->value = g_strndup (start, end - start);
+	header->value = g_strndup (start, (size_t) (end - start));
 	
 	header->offset = priv->header_offset;
 	

Modified: trunk/gmime/gmime-part.c
==============================================================================
--- trunk/gmime/gmime-part.c	(original)
+++ trunk/gmime/gmime-part.c	Thu Apr  2 00:42:09 2009
@@ -163,7 +163,7 @@
 {
 	GMimePart *mime_part = (GMimePart *) object;
 	char *text;
-	int i;
+	guint i;
 	
 	for (i = 0; i < G_N_ELEMENTS (content_headers); i++) {
 		if (!g_ascii_strcasecmp (content_headers[i], header))
@@ -255,7 +255,7 @@
 mime_part_remove_header (GMimeObject *object, const char *header)
 {
 	GMimePart *mime_part = (GMimePart *) object;
-	int i;
+	guint i;
 	
 	/* Make sure that the header is a Content-* header, else it
 	   doesn't belong on a mime part */

Modified: trunk/gmime/gmime-stream-buffer.c
==============================================================================
--- trunk/gmime/gmime-stream-buffer.c	(original)
+++ trunk/gmime/gmime-stream-buffer.c	Thu Apr  2 00:42:09 2009
@@ -142,8 +142,8 @@
 stream_read (GMimeStream *stream, char *buf, size_t len)
 {
 	GMimeStreamBuffer *buffer = (GMimeStreamBuffer *) stream;
+	size_t buflen, offset;
 	ssize_t n, nread = 0;
-	size_t offset;
 	
 	if (buffer->source == NULL) {
 		errno = EBADF;
@@ -189,7 +189,8 @@
 		break;
 	case GMIME_STREAM_BUFFER_CACHE_READ:
 		while (len > 0) {
-			if ((n = MIN (buffer->bufend - buffer->bufptr, len)) > 0) {
+			buflen = (size_t) (buffer->bufend - buffer->bufptr);
+			if ((n = MIN (buflen, len)) > 0) {
 				memcpy (buf + nread, buffer->bufptr, n);
 				buffer->bufptr += n;
 				nread += n;

Modified: trunk/gmime/gmime-utils.c
==============================================================================
--- trunk/gmime/gmime-utils.c	(original)
+++ trunk/gmime/gmime-utils.c	Thu Apr  2 00:42:09 2009
@@ -919,7 +919,7 @@
 		while (*inptr && *inptr != '>')
 			inptr++;
 		
-		msgid = g_strndup (*in, inptr - *in);
+		msgid = g_strndup (*in, (size_t) (inptr - *in));
 		*in = inptr;
 	}
 	

Modified: trunk/gmime/gmime.c
==============================================================================
--- trunk/gmime/gmime.c	(original)
+++ trunk/gmime/gmime.c	Thu Apr  2 00:42:09 2009
@@ -37,6 +37,7 @@
  * Initialization, shutdown, and version-check functions.
  **/
 
+extern gboolean _g_mime_enable_rfc2047_workarounds (void);
 
 GQuark gmime_error_quark;
 



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