[evolution-patches] camel-mime-utils.c (a lot warnings fixed)



Have fun

-- 
Philip Van Hoof, software developer
home: me at pvanhoof dot be
gnome: pvanhoof at gnome dot org
work: vanhoof at x-tend dot be
blog: http://pvanhoof.be/blog
--- /home/pvanhoof/repos/gnome/cvs/evolution-data-server/camel/camel-mime-utils.c	2006-04-13 21:59:13.000000000 +0200
+++ camel-mime-utils.c	2006-10-17 11:00:29.000000000 +0200
@@ -356,7 +356,7 @@
 	
 	out = g_malloc (len * 4 / 3 + 5);
 	outlen = camel_base64_encode_close ((unsigned char *)data, len, FALSE,
-				      out, &state, &save);
+				      out, &state, (gint*)&save);
 	out[outlen] = '\0';
 	return (char *)out;
 }
@@ -1032,13 +1032,13 @@
 		decword = g_alloca (tmplen); /* this will always be more-than-enough room */
 		switch(toupper(inptr[0])) {
 		case 'Q':
-			inlen = quoted_decode(inptr+2, tmplen, decword);
+			inlen = quoted_decode((const unsigned char *)inptr+2, tmplen, (unsigned char*)decword);
 			break;
 		case 'B': {
 			int state = 0;
 			unsigned int save = 0;
 			
-			inlen = camel_base64_decode_step((char *)inptr+2, tmplen, decword, &state, &save);
+			inlen = camel_base64_decode_step((unsigned char *)inptr+2, tmplen, (unsigned char*)decword, &state, &save);
 			/* if state != 0 then error? */
 			break;
 		}
@@ -1380,7 +1380,7 @@
 			else
 				*out++ = ' ';
 			out += sprintf (out, "=?%s?Q?", type);
-			out += quoted_encode (buffer, enclen, out, safemask);
+			out += quoted_encode ((const unsigned char *)buffer, enclen,  (unsigned char*)out, safemask);
 			sprintf (out, "?=");
 			
 			d(printf("converted part = %s\n", ascii));
@@ -1414,7 +1414,7 @@
 	GString *out;
 	char *outstr;
 
-	g_return_val_if_fail (g_utf8_validate (in, -1, NULL), NULL);
+	g_return_val_if_fail (g_utf8_validate ((const gchar*)in, -1, NULL), NULL);
 	
 	if (in == NULL)
 		return NULL;
@@ -1426,7 +1426,7 @@
 		inptr++;
 	}
 	if (*inptr == '\0')
-		return g_strdup (in);
+		return g_strdup ((gchar*)in);
 	
 	/* This gets each word out of the input, and checks to see what charset
 	   can be used to encode it. */
@@ -1441,7 +1441,7 @@
 		const char *newinptr;
 		
 		newinptr = g_utf8_next_char (inptr);
-		c = g_utf8_get_char (inptr);
+		c = g_utf8_get_char ((char*)inptr);
 		if (newinptr == NULL || !g_unichar_validate (c)) {
 			w(g_warning ("Invalid UTF-8 sequence encountered (pos %d, char '%c'): %s",
 				     (inptr-in), inptr[0], in));
@@ -1453,29 +1453,29 @@
 			/* we've reached the end of a 'word' */
 			if (word && !(last_was_encoded && encoding)) {
 				/* output lwsp between non-encoded words */
-				g_string_append_len (out, start, word - start);
+				g_string_append_len (out, (const gchar*)start, word - start);
 				start = word;
 			}
 			
 			switch (encoding) {
 			case 0:
-				g_string_append_len (out, start, inptr - start);
+				g_string_append_len (out, (const gchar*)start, inptr - start);
 				last_was_encoded = FALSE;
 				break;
 			case 1:
 				if (last_was_encoded)
 					g_string_append_c (out, ' ');
 				
-				rfc2047_encode_word (out, start, inptr - start, "ISO-8859-1", CAMEL_MIME_IS_ESAFE);
+				rfc2047_encode_word (out, (const char *)start, inptr - start, "ISO-8859-1", CAMEL_MIME_IS_ESAFE);
 				last_was_encoded = TRUE;
 				break;
 			case 2:
 				if (last_was_encoded)
 					g_string_append_c (out, ' ');
 				
-				if (!(charset = camel_charset_best (start, inptr - start)))
+				if (!(charset = camel_charset_best ((const char*)start, inptr - start)))
 					charset = "UTF-8";
-				rfc2047_encode_word (out, start, inptr - start, charset, CAMEL_MIME_IS_ESAFE);
+				rfc2047_encode_word (out, (const char *)start, inptr - start, charset, CAMEL_MIME_IS_ESAFE);
 				last_was_encoded = TRUE;
 				break;
 			}
@@ -1497,32 +1497,32 @@
 		if (!(c < 256 && camel_mime_is_lwsp (c)) && !word)
 			word = inptr;
 		
-		inptr = newinptr;
+		inptr = (const unsigned char *)newinptr;
 	}
 	
 	if (inptr - start) {
 		if (word && !(last_was_encoded && encoding)) {
-			g_string_append_len (out, start, word - start);
+			g_string_append_len (out, (const gchar*)start, word - start);
 			start = word;
 		}
 		
 		switch (encoding) {
 		case 0:
-			g_string_append_len (out, start, inptr - start);
+			g_string_append_len (out, (const gchar*)start, inptr - start);
 			break;
 		case 1:
 			if (last_was_encoded)
 				g_string_append_c (out, ' ');
 			
-			rfc2047_encode_word (out, start, inptr - start, "ISO-8859-1", CAMEL_MIME_IS_ESAFE);
+			rfc2047_encode_word (out, (const char *)start, inptr - start, "ISO-8859-1", CAMEL_MIME_IS_ESAFE);
 			break;
 		case 2:
 			if (last_was_encoded)
 				g_string_append_c (out, ' ');
 			
-			if (!(charset = camel_charset_best (start, inptr - start)))
+			if (!(charset = camel_charset_best ( (const char *)start, inptr - start)))
 				charset = "UTF-8";
-			rfc2047_encode_word (out, start, inptr - start, charset, CAMEL_MIME_IS_ESAFE);
+			rfc2047_encode_word (out, (const char *)start, inptr - start, charset, CAMEL_MIME_IS_ESAFE);
 			break;
 		}
 	}
@@ -1601,7 +1601,7 @@
 		const char *newinptr;
 		
 		newinptr = g_utf8_next_char (inptr);
-		c = g_utf8_get_char (inptr);
+		c = g_utf8_get_char ((char*)inptr);
 		
 		if (!g_unichar_validate (c)) {
 			w(g_warning ("Invalid UTF-8 sequence encountered (pos %d, char '%c'): %s",
@@ -1610,7 +1610,7 @@
 			continue;
 		}
 		
-		inptr = newinptr;
+		inptr = (const unsigned char *) newinptr;
 		if (g_unichar_isspace (c)) {
 			if (count > 0) {
 				word = g_new0 (struct _phrase_word, 1);
@@ -1746,28 +1746,28 @@
 		if (last_word && !(last_word->type == WORD_2047 && word->type == WORD_2047)) {
 			/* one or both of the words are not encoded so we write the spaces out untouched */
 			len = word->start - last_word->end;
-			out = g_string_append_len (out, last_word->end, len);
+			out = g_string_append_len (out, (const gchar*) last_word->end, len);
 		}
 		
 		switch (word->type) {
 		case WORD_ATOM:
-			out = g_string_append_len (out, word->start, word->end - word->start);
+			out = g_string_append_len (out, (const gchar*) word->start, word->end - word->start);
 			break;
 		case WORD_QSTRING:
-			quote_word (out, TRUE, word->start, word->end - word->start);
+			quote_word (out, TRUE, (const char *) word->start, word->end - word->start);
 			break;
 		case WORD_2047:
 			if (last_word && last_word->type == WORD_2047) {
 				/* include the whitespace chars between these 2 words in the
                                    resulting rfc2047 encoded word. */
 				len = word->end - last_word->end;
-				start = last_word->end;
+				start = (const char *) last_word->end;
 				
 				/* encoded words need to be separated by linear whitespace */
 				g_string_append_c (out, ' ');
 			} else {
 				len = word->end - word->start;
-				start = word->start;
+				start = (const char *) word->start;
 			}
 			
 			if (word->encoding == 1) {
@@ -1957,11 +1957,12 @@
 static char *
 hex_decode (const char *in, size_t len)
 {
-	const unsigned char *inend = in + len;
+	const unsigned char *inend = (const unsigned char *) (in + len);
 	unsigned char *inptr, *outptr;
 	char *outbuf;
 	
-	outptr = outbuf = g_malloc (len + 1);
+	outbuf = (char*)g_malloc (len + 1);
+	outptr = (unsigned char *)outbuf;
 	
 	inptr = (unsigned char *) in;
 	while (inptr < inend) {
@@ -3215,15 +3216,15 @@
 
 	/* if we have really broken utf8 passed in, we just treat it as binary data */
 
-	charset = camel_charset_best(in, strlen(in));
+	charset = camel_charset_best((char*)in, strlen((char*)in));
 	if (charset == NULL)
-		return g_strdup(in);
+		return g_strdup((gchar*)in);
 	
 	if (g_ascii_strcasecmp(charset, "UTF-8") != 0) {
-		if ((outbuf = header_convert(charset, "UTF-8", in, strlen(in))))
+		if ((outbuf = (unsigned char *)header_convert(charset, "UTF-8", (const char*)in, strlen((char*)in))))
 			inptr = outbuf;
 		else
-			return g_strdup(in);
+			return g_strdup((gchar*)in);
 	}
 	
 	/* FIXME: set the 'language' as well, assuming we can get that info...? */
@@ -3262,7 +3263,7 @@
 			continue;
 		}
 		
-		value = header_encode_param (p->value, &encoded);
+		value = header_encode_param ((unsigned char *)p->value, &encoded);
 		if (!value) {
 			w(g_warning ("appending parameter %s=%s violates rfc2184", p->name, p->value));
 			value = g_strdup (p->value);
@@ -3783,7 +3784,7 @@
 {
 	unsigned char *p;
 
-	p = h->value;
+	p = (unsigned char *)h->value;
 	while (p && *p) {
 		if (!isascii(*p)) {
 			w(g_warning("Appending header violates rfc: %s: %s", h->name, h->value));
@@ -4249,7 +4250,7 @@
 		switch (a->type) {
 		case CAMEL_HEADER_ADDRESS_NAME:
 			if (encode)
-				text = camel_header_encode_phrase (a->name);
+				text = camel_header_encode_phrase ((unsigned char*)a->name);
 			else
 				text = a->name;
 			if (text && *text)
@@ -4261,7 +4262,7 @@
 			break;
 		case CAMEL_HEADER_ADDRESS_GROUP:
 			if (encode)
-				text = camel_header_encode_phrase (a->name);
+				text = camel_header_encode_phrase ((unsigned char*)a->name);
 			else
 				text = a->name;
 			g_string_append_printf (out, "%s: ", text);


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