gmime r1536 - in trunk: . gmime util



Author: fejj
Date: Thu Apr  2 01:26:59 2009
New Revision: 1536
URL: http://svn.gnome.org/viewvc/gmime?rev=1536&view=rev

Log:
fixed a number of compile warnings exposed by Visual Studio

Modified:
   trunk/gmime.vcproj
   trunk/gmime/gmime-charset.c
   trunk/gmime/gmime-encodings.c
   trunk/gmime/gmime-filter-from.c
   trunk/gmime/gmime-message.c
   trunk/gmime/gmime-multipart.c
   trunk/gmime/gmime-param.c
   trunk/gmime/gmime-parse-utils.c
   trunk/gmime/gmime-parser.c
   trunk/gmime/gmime-stream-buffer.c
   trunk/gmime/gmime-stream-cat.c
   trunk/gmime/gmime-utils.c
   trunk/gmime/internet-address.c
   trunk/util/gtrie.c

Modified: trunk/gmime.vcproj
==============================================================================
--- trunk/gmime.vcproj	(original)
+++ trunk/gmime.vcproj	Thu Apr  2 01:26:59 2009
@@ -39,7 +39,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions="/D &quot;ssize_t&quot;=&quot;long int&quot; /D &quot;GMIME_MAJOR_VERSION&quot;=&quot;2&quot; /D &quot;GMIME_MINOR_VERSION&quot;=&quot;4&quot; /D &quot;GMIME_MICRO_VERSION&quot;=&quot;5&quot; /D &quot;ICONV_CONST&quot;=&quot;const&quot; /D &quot;HAVE_TIMEZONE&quot;"
+				AdditionalOptions="/D &quot;ssize_t&quot;=&quot;gssize&quot; /D &quot;GMIME_MAJOR_VERSION&quot;=&quot;2&quot; /D &quot;GMIME_MINOR_VERSION&quot;=&quot;4&quot; /D &quot;GMIME_MICRO_VERSION&quot;=&quot;5&quot; /D &quot;ICONV_CONST&quot;=&quot;&quot; /D &quot;HAVE_TIMEZONE&quot;"
 				Optimization="0"
 				AdditionalIncludeDirectories="&quot;.&quot;; &quot;util&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GMIME_EXPORTS;"

Modified: trunk/gmime/gmime-charset.c
==============================================================================
--- trunk/gmime/gmime-charset.c	(original)
+++ trunk/gmime/gmime-charset.c	Thu Apr  2 01:26:59 2009
@@ -298,7 +298,7 @@
 				while (*p && !strchr ("@;/", *p))
 					p++;
 				
-				locale_charset = g_ascii_strdown (codeset, p - codeset);
+				locale_charset = g_ascii_strdown (codeset, (size_t)(p - codeset));
 			} else {
 				/* charset unknown */
 				locale_charset = NULL;

Modified: trunk/gmime/gmime-encodings.c
==============================================================================
--- trunk/gmime/gmime-encodings.c	(original)
+++ trunk/gmime/gmime-encodings.c	Thu Apr  2 01:26:59 2009
@@ -468,12 +468,12 @@
 		/* points to the slot for the next char to save */
 		saveout = & (((char *)save)[1]) + ((char *)save)[0];
 		
-		/* inlen can only be 0 1 or 2 */
+		/* inlen can only be 0, 1 or 2 */
 		switch (inlen) {
 		case 2:	*saveout++ = *inptr++;
 		case 1:	*saveout++ = *inptr++;
 		}
-		((char *)save)[0] += inlen;
+		((char *)save)[0] += (char) inlen;
 	}
 	
 	d(printf ("mode = %d\nc1 = %c\nc2 = %c\n",

Modified: trunk/gmime/gmime-filter-from.c
==============================================================================
--- trunk/gmime/gmime-filter-from.c	(original)
+++ trunk/gmime/gmime-filter-from.c	Thu Apr  2 01:26:59 2009
@@ -130,9 +130,9 @@
 	GMimeFilterFrom *from = (GMimeFilterFrom *) filter;
 	struct fromnode *head = NULL, *tail = (struct fromnode *) &head, *node;
 	register char *inptr, *inend;
-	unsigned int left;
 	int fromcount = 0;
 	char *outptr;
+	size_t left;
 	
 	inptr = in;
 	inend = inptr + len;
@@ -146,7 +146,7 @@
 		}
 		
 		if (c == '\n' || !from->midline) {
-			left = inend - inptr;
+			left = (size_t) (inend - inptr);
 			if (left > 0) {
 				from->midline = TRUE;
 				if (left < 5) {
@@ -202,14 +202,14 @@
 			node = node->next;
 		}
 		
-		memcpy (outptr, inptr, (unsigned) (inend - inptr));
+		memcpy (outptr, inptr, (size_t) (inend - inptr));
 		outptr += inend - inptr;
 		*out = filter->outbuf;
-		*outlen = outptr - filter->outbuf;
+		*outlen = (size_t) (outptr - filter->outbuf);
 		*outprespace = filter->outbuf - filter->outreal;
 	} else {
 		*out = in;
-		*outlen = inend - in;
+		*outlen = (size_t) (inend - in);
 		*outprespace = prespace;
 	}
 }

Modified: trunk/gmime/gmime-message.c
==============================================================================
--- trunk/gmime/gmime-message.c	(original)
+++ trunk/gmime/gmime-message.c	Thu Apr  2 01:26:59 2009
@@ -571,7 +571,7 @@
 			g_string_append (str, "\n\t");
 			len = 1;
 		} else if (lwsp) {
-			g_string_append_len (str, lwsp, part->start - lwsp);
+			g_string_append_len (str, lwsp, (size_t) (part->start - lwsp));
 		}
 		
 		g_string_append_len (str, part->start, part->len);

Modified: trunk/gmime/gmime-multipart.c
==============================================================================
--- trunk/gmime/gmime-multipart.c	(original)
+++ trunk/gmime/gmime-multipart.c	Thu Apr  2 01:26:59 2009
@@ -743,7 +743,7 @@
 #else
 	size_t i;
 	
-	srand (time (NULL));
+	srand ((unsigned int) time (NULL));
 	
 	for (i = 0; i < bytes; i++)
 		buffer[i] = (unsigned char) (rand () % 256);

Modified: trunk/gmime/gmime-param.c
==============================================================================
--- trunk/gmime/gmime-param.c	(original)
+++ trunk/gmime/gmime-param.c	Thu Apr  2 01:26:59 2009
@@ -856,8 +856,8 @@
 	
 	while (param) {
 		gboolean encoded = FALSE;
-		unsigned nlen, vlen;
 		int here = out->len;
+		size_t nlen, vlen;
 		int quote = 0;
 		char *value;
 		
@@ -896,7 +896,7 @@
 		
 		if (nlen + vlen + quote > GMIME_FOLD_LEN - 2) {
 			/* we need to do special rfc2184 parameter wrapping */
-			int maxlen = GMIME_FOLD_LEN - (nlen + 6);
+			size_t maxlen = GMIME_FOLD_LEN - (nlen + 6);
 			char *inptr, *inend;
 			int i = 0;
 			
@@ -904,7 +904,7 @@
 			inend = value + vlen;
 			
 			while (inptr < inend) {
-				char *ptr = inptr + MIN (inend - inptr, maxlen);
+				char *ptr = inptr + MIN ((size_t) (inend - inptr), maxlen);
 				
 				if (encoded && ptr < inend) {
 					/* be careful not to break an encoded char (ie %20) */
@@ -930,9 +930,9 @@
 							i++, encoded ? "*" : "");
 				
 				if (encoded || !quote)
-					g_string_append_len (out, inptr, ptr - inptr);
+					g_string_append_len (out, inptr, (size_t) (ptr - inptr));
 				else
-					g_string_append_len_quoted (out, inptr, ptr - inptr);
+					g_string_append_len_quoted (out, inptr, (size_t) (ptr - inptr));
 				
 				used += (out->len - here);
 				

Modified: trunk/gmime/gmime-parse-utils.c
==============================================================================
--- trunk/gmime/gmime-parse-utils.c	(original)
+++ trunk/gmime/gmime-parse-utils.c	Thu Apr  2 01:26:59 2009
@@ -290,7 +290,7 @@
 				break;
 			}
 			
-			g_string_append_len (domain, atom, inptr - atom);
+			g_string_append_len (domain, atom, (size_t) (inptr - atom));
 		}
 		
 		save = inptr;

Modified: trunk/gmime/gmime-parser.c
==============================================================================
--- trunk/gmime/gmime-parser.c	(original)
+++ trunk/gmime/gmime-parser.c	Thu Apr  2 01:26:59 2009
@@ -676,7 +676,7 @@
 		priv->inend += nread;
 	}
 	
-	return priv->inend - priv->inptr;
+	return (ssize_t) (priv->inend - priv->inptr);
 }
 
 
@@ -766,12 +766,12 @@
 			
 			if (inptr + 1 >= inend) {
 				/* we don't have enough data; if we can't get more we have to bail */
-				left = inend - start;
+				left = (ssize_t) (inend - start);
 				priv->inptr = start;
 				goto refill;
 			}
 			
-			len = inptr - start;
+			len = (size_t) (inptr - start);
 			inptr++;
 			
 			if (len >= 5 && !strncmp (start, "From ", 5)) {
@@ -1005,7 +1005,7 @@
 					
 					if (inptr == inend) {
 						/* don't have the full field name */
-						left = inend - start;
+						left = (ssize_t) (inend - start);
 						priv->inptr = start;
 						goto refill;
 					}
@@ -1049,8 +1049,8 @@
 				
 				raw_header_append (priv, start, len);
 				header_append (priv, start, len);
+				left = (ssize_t) (inend - inptr);
 				priv->midline = TRUE;
-				left = inend - inptr;
 				priv->inptr = inptr;
 				goto refill;
 			}
@@ -1073,7 +1073,7 @@
 			inptr++;
 		}
 		
-		left = inend - inptr;
+		left = (ssize_t) (inend - inptr);
 		priv->inptr = inptr;
 	} while (1);
 	

Modified: trunk/gmime/gmime-stream-buffer.c
==============================================================================
--- trunk/gmime/gmime-stream-buffer.c	(original)
+++ trunk/gmime/gmime-stream-buffer.c	Thu Apr  2 01:26:59 2009
@@ -771,7 +771,7 @@
 				
 				if (inptr == inend && outptr < outend) {
 					/* buffer more data */
-					unsigned int offset = buffer->bufptr - buffer->buffer;
+					size_t offset = (size_t) (buffer->bufptr - buffer->buffer);
 					
 					buffer->buflen = buffer->bufend - buffer->buffer +
 						MAX (BUFFER_GROW_SIZE, outend - outptr + 1);
@@ -807,7 +807,7 @@
 		*outptr = '\0';
 	}
 	
-	return (outptr - buf);
+	return (ssize_t) (outptr - buf);
 }
 
 

Modified: trunk/gmime/gmime-stream-cat.c
==============================================================================
--- trunk/gmime/gmime-stream-cat.c	(original)
+++ trunk/gmime/gmime-stream-cat.c	Thu Apr  2 01:26:59 2009
@@ -329,8 +329,7 @@
 {
 	GMimeStreamCat *cat = (GMimeStreamCat *) stream;
 	struct _cat_node *current, *n;
-	gint64 real, off;
-	ssize_t len;
+	gint64 real, off, len;
 	
 	d(fprintf (stderr, "GMimeStreamCat::stream_seek (%p, %ld, %d)\n",
 		   stream, offset, whence));
@@ -432,7 +431,7 @@
 						return -1;
 				}
 				
-				d(fprintf (stderr, "real = %ld, stream[%d] len = %ld\n",
+				d(fprintf (stderr, "real = %lld, stream[%d] len = %lld\n",
 					   real, current->id, len));
 				
 				if ((real + len) > offset) {

Modified: trunk/gmime/gmime-utils.c
==============================================================================
--- trunk/gmime/gmime-utils.c	(original)
+++ trunk/gmime/gmime-utils.c	Thu Apr  2 01:26:59 2009
@@ -851,14 +851,14 @@
 	}
 	
 	addrspec = g_string_new ("");
-	g_string_append_len (addrspec, word, inptr - word);
+	g_string_append_len (addrspec, word, (size_t) (inptr - word));
 	
 	/* get the rest of the local-part */
 	decode_lwsp (&inptr);
 	while (*inptr == '.') {
 		g_string_append_c (addrspec, *inptr++);
 		if ((word = decode_word (&inptr))) {
-			g_string_append_len (addrspec, word, inptr - word);
+			g_string_append_len (addrspec, word, (size_t) (inptr - word));
 			decode_lwsp (&inptr);
 		} else {
 			w(g_warning ("Invalid local-part in addr-spec: %s", *in));
@@ -1626,7 +1626,7 @@
 		
 		*outbuf++ = '\0';
 		
-		return g_realloc (out, outbuf - out);
+		return g_realloc (out, (size_t) (outbuf - out));
 	}
 	
 	outlen = charset_convert (cd, text, len, &out, &outleft, &ninval);
@@ -1670,7 +1670,7 @@
 		}
 	}
 	
-	return (outptr - out);
+	return (ssize_t) (outptr - out);
 }
 
 #define is_rfc2047_encoded_word(atom, len) (len >= 7 && !strncmp (atom, "=?", 2) && !strncmp (atom + len - 2, "?=", 2))
@@ -2375,11 +2375,11 @@
 		
 		switch (word->type) {
 		case WORD_ATOM:
-			g_string_append_len (out, word->start, word->end - word->start);
+			g_string_append_len (out, word->start, (size_t) (word->end - word->start));
 			break;
 		case WORD_QSTRING:
 			g_assert (safemask & IS_PSAFE);
-			g_string_append_len_quoted (out, word->start, word->end - word->start);
+			g_string_append_len_quoted (out, word->start, (size_t) (word->end - word->start));
 			break;
 		case WORD_2047:
 			if (prev && prev->type == WORD_2047) {

Modified: trunk/gmime/internet-address.c
==============================================================================
--- trunk/gmime/internet-address.c	(original)
+++ trunk/gmime/internet-address.c	Thu Apr  2 01:26:59 2009
@@ -1440,7 +1440,7 @@
 		} while (*inptr == '.');
 		
 		if ((word = decode_word (&inptr)))
-			g_string_append_len (addr, word, inptr - word);
+			g_string_append_len (addr, word, (size_t) (inptr - word));
 		
 		decode_lwsp (&inptr);
 	}
@@ -1489,7 +1489,7 @@
 				if (*cend == ')')
 					cend--;
 				
-				comment = g_strndup (comment + 1, cend - comment);
+				comment = g_strndup (comment + 1, (size_t) (cend - comment));
 				g_strstrip (comment);
 				
 				name = g_string_new (comment);
@@ -1541,7 +1541,7 @@
 	word = decode_word (&inptr);
 	
 	while (word) {
-		g_string_append_len (name, word, inptr - word);
+		g_string_append_len (name, word, (size_t) (inptr - word));
 		if ((word = decode_word (&inptr)))
 			g_string_append_c (name, ' ');
 	}

Modified: trunk/util/gtrie.c
==============================================================================
--- trunk/util/gtrie.c	(original)
+++ trunk/util/gtrie.c	Thu Apr  2 01:26:59 2009
@@ -176,7 +176,7 @@
 }
 
 static struct _trie_state *
-trie_insert (GTrie *trie, int depth, struct _trie_state *q, gunichar c)
+trie_insert (GTrie *trie, guint depth, struct _trie_state *q, gunichar c)
 {
 	struct _trie_match *m;
 	
@@ -249,7 +249,7 @@
 	const char *inptr = pattern;
 	struct _trie_state *q, *q1, *r;
 	struct _trie_match *m, *n;
-	int i, depth = 0;
+	guint i, depth = 0;
 	gunichar c;
 	
 	/* Step 1: add the pattern to the trie */



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