summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-12-10 19:17:52 +0000
committerJeffrey Stedfast <fejj@src.gnome.org>2001-12-10 19:17:52 +0000
commit48ff532362fa5f139952f10e106a7e643a31f2fa (patch)
tree7ad08dc14b6d716383bac5d8f010418346229121
parenta9c2241b09934d05a5ad7832a6729bdb9c46a306 (diff)
downloadevolution-data-server-48ff532362fa5f139952f10e106a7e643a31f2fa.tar.gz
iconv() returns a size_t, not an int.
2001-12-05 Jeffrey Stedfast <fejj@ximian.com> * camel-sasl-digest-md5.c: iconv() returns a size_t, not an int. * camel-pgp-context.c: The return value of iconv() is a size_t, not an int. * camel-mime-part-utils.c (convert_buffer): Always use size_t args for iconv(). * camel-mime-filter-charset.c (complete): Always use size_t args for iconv(). (filter): Same. * camel-mime-utils.c (header_address_fold): Make headerlen a size_t instead of an int. (header_fold): Same. (base64_encode_close): We should be returning a size_t and inlen should also be a size_t. (base64_encode_step): Same here. (base64_decode_step): Here too. (base64_encode_simple): And here... (base64_decode_simple): Same. (uuencode_close): We should also use size_t's here... (uuencode_step): And here too. (uudecode_step): And also here. (quoted_encode_close): Same idea here. (quoted_encode_step): Again here. (quoted_decode_step): Here too. (quoted_encode): Input length should be a size_t. (rfc2047_decode_word): Same. (g_string_append_len): Here too. (append_8bit): " (rfc2047_encode_word): " (quote_word): " (hex_decode): " (rfc2184_decode): Use size_t's with iconv(). (header_decode_param): Same.
-rw-r--r--camel/ChangeLog39
-rw-r--r--camel/camel-cipher-context.c2
-rw-r--r--camel/camel-mime-filter-charset.c16
-rw-r--r--camel/camel-mime-part-utils.c9
-rw-r--r--camel/camel-mime-utils.c130
-rw-r--r--camel/camel-mime-utils.h31
-rw-r--r--camel/camel-pgp-context.c4
-rw-r--r--camel/camel-sasl-digest-md5.c2
-rw-r--r--camel/camel-stream-filter.c5
-rw-r--r--camel/providers/imap/camel-imap-folder.h2
-rw-r--r--camel/providers/imap/camel-imap-store.h4
-rw-r--r--camel/providers/pop3/camel-pop3-store.c45
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c9
13 files changed, 166 insertions, 132 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 53a0c8dd1..681c75abe 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,42 @@
+2001-12-05 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-sasl-digest-md5.c: iconv() returns a size_t, not an int.
+
+ * camel-pgp-context.c: The return value of iconv() is a size_t,
+ not an int.
+
+ * camel-mime-part-utils.c (convert_buffer): Always use size_t args
+ for iconv().
+
+ * camel-mime-filter-charset.c (complete): Always use size_t args
+ for iconv().
+ (filter): Same.
+
+ * camel-mime-utils.c (header_address_fold): Make headerlen a
+ size_t instead of an int.
+ (header_fold): Same.
+ (base64_encode_close): We should be returning a size_t and inlen
+ should also be a size_t.
+ (base64_encode_step): Same here.
+ (base64_decode_step): Here too.
+ (base64_encode_simple): And here...
+ (base64_decode_simple): Same.
+ (uuencode_close): We should also use size_t's here...
+ (uuencode_step): And here too.
+ (uudecode_step): And also here.
+ (quoted_encode_close): Same idea here.
+ (quoted_encode_step): Again here.
+ (quoted_decode_step): Here too.
+ (quoted_encode): Input length should be a size_t.
+ (rfc2047_decode_word): Same.
+ (g_string_append_len): Here too.
+ (append_8bit): "
+ (rfc2047_encode_word): "
+ (quote_word): "
+ (hex_decode): "
+ (rfc2184_decode): Use size_t's with iconv().
+ (header_decode_param): Same.
+
2001-12-07 Dan Winship <danw@ximian.com>
* camel-mime-message.c (camel_mime_message_set_date): Fix the
diff --git a/camel/camel-cipher-context.c b/camel/camel-cipher-context.c
index 2a7b8864b..feefff556 100644
--- a/camel/camel-cipher-context.c
+++ b/camel/camel-cipher-context.c
@@ -28,8 +28,6 @@
#include <glib.h>
-#include <iconv.h>
-
#ifdef ENABLE_THREADS
#include <pthread.h>
#define CIPHER_LOCK(ctx) g_mutex_lock (((CamelCipherContext *) ctx)->priv->lock)
diff --git a/camel/camel-mime-filter-charset.c b/camel/camel-mime-filter-charset.c
index 537b93c5f..d3a02ffd1 100644
--- a/camel/camel-mime-filter-charset.c
+++ b/camel/camel-mime-filter-charset.c
@@ -74,7 +74,7 @@ reset(CamelMimeFilter *mf)
CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)mf;
char buf[16];
char *buffer;
- int outlen = 16;
+ size_t outlen = 16;
/* what happens with the output bytes if this resets the state? */
if (f->ic != (iconv_t) -1) {
@@ -87,11 +87,10 @@ static void
complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlenptr, size_t *outprespace)
{
CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)mf;
- int converted;
+ size_t converted, inlen, outlen;
const char *inbuf;
char *outbuf;
- int inlen, outlen;
-
+
if (f->ic == (iconv_t) -1) {
goto donothing;
}
@@ -110,7 +109,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
if (inlen>0) {
converted = e_iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
- if (converted == -1) {
+ if (converted == (size_t) -1) {
if (errno != EINVAL) {
g_warning("error occured converting: %s", strerror(errno));
goto donothing;
@@ -125,7 +124,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
/* this 'resets' the output stream, returning back to the initial
shift state for multishift charactersets */
converted = e_iconv(f->ic, NULL, 0, &outbuf, &outlen);
- if (converted == -1) {
+ if (converted == (size_t) -1) {
g_warning("Conversion failed to complete: %s", strerror(errno));
}
@@ -153,10 +152,9 @@ static void
filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlenptr, size_t *outprespace)
{
CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)mf;
- int converted;
+ size_t converted, inlen, outlen;
const char *inbuf;
char *outbuf;
- int inlen, outlen;
if (f->ic == (iconv_t) -1) {
goto donothing;
@@ -169,7 +167,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
outbuf = mf->outbuf;
outlen = mf->outsize;
converted = e_iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
- if (converted == -1) {
+ if (converted == (size_t) -1) {
if (errno != EINVAL) {
g_warning("error occured converting: %s", strerror(errno));
goto donothing;
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
index 3bad8de1b..fa644468b 100644
--- a/camel/camel-mime-part-utils.c
+++ b/camel/camel-mime-part-utils.c
@@ -100,10 +100,11 @@ check_html_charset(char *buffer, int length)
static GByteArray *convert_buffer(GByteArray *in, const char *to, const char *from)
{
iconv_t ic;
- int inlen, outlen, i=2;
+ size_t inlen, outlen;
char *inbuf, *outbuf;
char *buffer;
GByteArray *out = NULL;
+ int i = 2;
d(printf("converting buffer from %s to %s: '%.*s'\n", from, to, (int)in->len, in->data));
@@ -122,7 +123,7 @@ static GByteArray *convert_buffer(GByteArray *in, const char *to, const char *fr
inlen = in->len;
outbuf = buffer;
- if (e_iconv(ic, (const char **)&inbuf, &inlen, &outbuf, &outlen) == -1) {
+ if (e_iconv(ic, (const char **)&inbuf, &inlen, &outbuf, &outlen) == (size_t) -1) {
g_free(buffer);
g_warning("conversion failed: %s", strerror(errno));
/* we didn't have enough space */
@@ -139,7 +140,7 @@ static GByteArray *convert_buffer(GByteArray *in, const char *to, const char *fr
/* close off the conversion */
outbuf = buffer;
outlen = in->len * i + 16;
- if (e_iconv(ic, NULL, 0, &outbuf, &outlen) != -1)
+ if (e_iconv(ic, NULL, 0, &outbuf, &outlen) != (size_t) -1)
g_byte_array_append(out, buffer, (in->len*i+16) - outlen);
g_free(buffer);
@@ -156,7 +157,7 @@ static GByteArray *convert_buffer(GByteArray *in, const char *to, const char *fr
static gboolean
is_7bit (GByteArray *buffer)
{
- register int i;
+ register unsigned int i;
for (i = 0; i < buffer->len; i++)
if (buffer->data[i] > 127)
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 247dca055..069804bd8 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -205,8 +205,8 @@ base64_init(void)
/* call this when finished encoding everything, to
flush off the last little bit */
-int
-base64_encode_close(unsigned char *in, int inlen, gboolean break_lines, unsigned char *out, int *state, int *save)
+size_t
+base64_encode_close(unsigned char *in, size_t inlen, gboolean break_lines, unsigned char *out, int *state, int *save)
{
int c1, c2;
unsigned char *outptr = out;
@@ -250,8 +250,8 @@ base64_encode_close(unsigned char *in, int inlen, gboolean break_lines, unsigned
output at a time, saves left-over state in state and save (initialise to
0 on first invocation).
*/
-int
-base64_encode_step(unsigned char *in, int len, gboolean break_lines, unsigned char *out, int *state, int *save)
+size_t
+base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save)
{
register unsigned char *inptr, *outptr;
@@ -336,8 +336,8 @@ base64_encode_step(unsigned char *in, int len, gboolean break_lines, unsigned ch
*
* Decodes a chunk of base64 encoded data
**/
-int
-base64_decode_step(unsigned char *in, int len, unsigned char *out, int *state, unsigned int *save)
+size_t
+base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save)
{
register unsigned char *inptr, *outptr;
unsigned char *inend, c;
@@ -385,7 +385,7 @@ base64_decode_step(unsigned char *in, int len, unsigned char *out, int *state, u
}
char *
-base64_encode_simple (const char *data, int len)
+base64_encode_simple (const char *data, size_t len)
{
unsigned char *out;
int state = 0, outlen;
@@ -398,8 +398,8 @@ base64_encode_simple (const char *data, int len)
return (char *)out;
}
-int
-base64_decode_simple (char *data, int len)
+size_t
+base64_decode_simple (char *data, size_t len)
{
int state = 0;
unsigned int save = 0;
@@ -423,8 +423,8 @@ base64_decode_simple (char *data, int len)
* encoding data with uuencode_step to flush off the last little
* bit.
**/
-int
-uuencode_close (unsigned char *in, int len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save, char *uulen)
+size_t
+uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save, char *uulen)
{
register unsigned char *outptr, *bufptr;
register guint32 saved;
@@ -496,8 +496,8 @@ uuencode_close (unsigned char *in, int len, unsigned char *out, unsigned char *u
* left-over state in @uubuf, @state and @save (initialize to 0 on first
* invocation).
**/
-int
-uuencode_step (unsigned char *in, int len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save, char *uulen)
+size_t
+uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save, char *uulen)
{
register unsigned char *inptr, *outptr, *bufptr;
unsigned char *inend;
@@ -574,8 +574,8 @@ uuencode_step (unsigned char *in, int len, unsigned char *out, unsigned char *uu
* a chunk of uuencoded data. Assumes the "begin <mode> <file name>"
* line has been stripped off.
**/
-int
-uudecode_step (unsigned char *in, int len, unsigned char *out, int *state, guint32 *save, char *uulen)
+size_t
+uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save, char *uulen)
{
register unsigned char *inptr, *outptr;
unsigned char *inend, ch;
@@ -651,8 +651,8 @@ uudecode_step (unsigned char *in, int len, unsigned char *out, int *state, guint
/* complete qp encoding */
-int
-quoted_encode_close(unsigned char *in, int len, unsigned char *out, int *state, int *save)
+size_t
+quoted_encode_close(unsigned char *in, size_t len, unsigned char *out, int *state, int *save)
{
register unsigned char *outptr = out;
int last;
@@ -680,11 +680,11 @@ quoted_encode_close(unsigned char *in, int len, unsigned char *out, int *state,
}
/* perform qp encoding, initialise state to -1 and save to 0 on first invocation */
-int
-quoted_encode_step (unsigned char *in, int len, unsigned char *out, int *statep, int *save)
+size_t
+quoted_encode_step (unsigned char *in, size_t len, unsigned char *out, int *statep, int *save)
{
register guchar *inptr, *outptr, *inend;
- guchar c;
+ unsigned char c;
register int sofar = *save; /* keeps track of how many chars on a line */
register int last = *statep; /* keeps track if last char to end was a space cr etc */
@@ -766,8 +766,8 @@ quoted_encode_step (unsigned char *in, int len, unsigned char *out, int *statep,
Note: Trailing rubbish (at the end of input), like = or =x or =\r will be lost.
*/
-int
-quoted_decode_step(unsigned char *in, int len, unsigned char *out, int *savestate, int *saveme)
+size_t
+quoted_decode_step(unsigned char *in, size_t len, unsigned char *out, int *savestate, int *saveme)
{
register unsigned char *inptr, *outptr;
unsigned char *inend, c;
@@ -859,7 +859,7 @@ quoted_decode_step(unsigned char *in, int len, unsigned char *out, int *savestat
which is slightly different than plain quoted-printable (mainly by allowing 0x20 <> _)
*/
static int
-quoted_decode(const unsigned char *in, int len, unsigned char *out)
+quoted_decode(const unsigned char *in, size_t len, unsigned char *out)
{
register const unsigned char *inptr;
register unsigned char *outptr;
@@ -906,7 +906,7 @@ quoted_decode(const unsigned char *in, int len, unsigned char *out)
/* safemask is the mask to apply to the camel_mime_special_table to determine what
characters can safely be included without encoding */
static int
-quoted_encode(const unsigned char *in, int len, unsigned char *out, unsigned short safemask)
+quoted_encode (const unsigned char *in, size_t len, unsigned char *out, unsigned short safemask)
{
register const unsigned char *inptr, *inend;
unsigned char *outptr;
@@ -970,7 +970,7 @@ header_decode_lwsp(const char **in)
/* decode rfc 2047 encoded string segment */
static char *
-rfc2047_decode_word(const char *in, int len)
+rfc2047_decode_word(const char *in, size_t len)
{
const char *inptr = in+2;
const char *inend = in+len-2;
@@ -978,12 +978,12 @@ rfc2047_decode_word(const char *in, int len)
const char *charset;
char *encname;
int tmplen;
- int ret;
+ size_t ret;
char *decword = NULL;
char *decoded = NULL;
char *outbase = NULL;
char *outbuf;
- int inlen, outlen;
+ size_t inlen, outlen;
gboolean retried = FALSE;
iconv_t ic;
@@ -1036,9 +1036,9 @@ rfc2047_decode_word(const char *in, int len)
retry:
ic = e_iconv_open ("UTF-8", charset);
- if (ic != (iconv_t)-1) {
+ if (ic != (iconv_t) -1) {
ret = e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
- if (ret >= 0) {
+ if (ret != (size_t) -1) {
e_iconv (ic, NULL, 0, &outbuf, &outlen);
*outbuf = 0;
decoded = g_strdup (outbase);
@@ -1070,7 +1070,7 @@ rfc2047_decode_word(const char *in, int len)
/* grrr, glib should have this ! */
static GString *
-g_string_append_len(GString *st, const char *s, int l)
+g_string_append_len(GString *st, const char *s, size_t l)
{
char *tmp;
@@ -1085,7 +1085,7 @@ g_string_append_len(GString *st, const char *s, int l)
according to the rfc's. Anyway, since the conversion to utf-8
is trivial, just do it here without iconv */
static GString *
-append_latin1 (GString *out, const char *in, int len)
+append_latin1 (GString *out, const char *in, size_t len)
{
unsigned int c;
@@ -1103,10 +1103,10 @@ append_latin1 (GString *out, const char *in, int len)
}
static int
-append_8bit (GString *out, const char *inbuf, int inlen, const char *charset)
+append_8bit (GString *out, const char *inbuf, size_t inlen, const char *charset)
{
char *outbase, *outbuf;
- int outlen;
+ size_t outlen;
iconv_t ic;
ic = e_iconv_open ("UTF-8", charset);
@@ -1115,8 +1115,8 @@ append_8bit (GString *out, const char *inbuf, int inlen, const char *charset)
outlen = inlen * 6 + 16;
outbuf = outbase = g_malloc(outlen);
-
- if (e_iconv(ic, &inbuf, &inlen, &outbuf, &outlen) == -1) {
+
+ if (e_iconv(ic, &inbuf, &inlen, &outbuf, &outlen) == (size_t) -1) {
w(g_warning("Conversion to '%s' failed: %s", charset, strerror(errno)));
g_free(outbase);
e_iconv_close(ic);
@@ -1134,7 +1134,7 @@ append_8bit (GString *out, const char *inbuf, int inlen, const char *charset)
/* decodes a simple text, rfc822 + rfc2047 */
static char *
-header_decode_text (const char *in, int inlen, const char *default_charset)
+header_decode_text (const char *in, size_t inlen, const char *default_charset)
{
GString *out;
const char *inptr, *inend, *start, *chunk, *locale_charset;
@@ -1201,7 +1201,7 @@ header_decode_string (const char *in, const char *default_charset)
/* FIXME: needs a way to cache iconv opens for different charsets? */
static void
-rfc2047_encode_word(GString *outstring, const char *in, int len, const char *type, unsigned short safemask)
+rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char *type, unsigned short safemask)
{
iconv_t ic = (iconv_t *)-1;
char *buffer, *out, *ascii;
@@ -1223,8 +1223,9 @@ rfc2047_encode_word(GString *outstring, const char *in, int len, const char *typ
ic = e_iconv_open (type, "UTF-8");
while (inlen) {
- int convlen, i, proclen;
-
+ size_t convlen, proclen;
+ int i;
+
/* break up words into smaller bits, what we really want is encoded + overhead < 75,
but we'll just guess what that means in terms of input chars, and assume its good enough */
@@ -1267,7 +1268,7 @@ rfc2047_encode_word(GString *outstring, const char *in, int len, const char *typ
hopefully-small-enough chunks, and leave it at that */
convlen = MIN(inlen, CAMEL_FOLD_PREENCODED);
p = inptr;
- if (e_iconv(ic, &inptr, &convlen, &out, &outlen) == -1) {
+ if (e_iconv (ic, &inptr, &convlen, &out, &outlen) == (size_t) -1) {
w(g_warning("Conversion problem: conversion truncated: %s", strerror(errno)));
/* blah, we include it anyway, better than infinite loop ... */
inptr = p + convlen;
@@ -1432,7 +1433,7 @@ header_encode_string (const unsigned char *in)
/* apply quoted-string rules to a string */
static void
-quote_word(GString *out, gboolean do_quotes, const char *start, int len)
+quote_word(GString *out, gboolean do_quotes, const char *start, size_t len)
{
int i, c;
@@ -1621,7 +1622,7 @@ header_encode_phrase (const unsigned char *in)
wordl = words;
while (wordl) {
const char *start;
- int len;
+ size_t len;
word = wordl->data;
@@ -1715,7 +1716,7 @@ header_decode_quoted_string(const char **in)
{
const char *inptr = *in;
char *out = NULL, *outptr;
- int outlen;
+ size_t outlen;
int c;
header_decode_lwsp(&inptr);
@@ -1813,10 +1814,10 @@ header_decode_int(const char **in)
#define HEXVAL(c) (isdigit (c) ? (c) - '0' : tolower (c) - 'a' + 10)
static char *
-hex_decode (const char *in, int len)
+hex_decode (const char *in, size_t len)
{
- const guchar *inend = (const guchar *) in + len;
- guchar *inptr, *outptr;
+ const unsigned char *inend = in + len;
+ unsigned char *inptr, *outptr;
char *outbuf;
outptr = outbuf = g_malloc (len);
@@ -1843,7 +1844,7 @@ hex_decode (const char *in, int len)
*/
static char *
-rfc2184_decode (const char *in, int len)
+rfc2184_decode (const char *in, size_t len)
{
const char *inptr = in;
const char *inend = in + len;
@@ -1867,7 +1868,7 @@ rfc2184_decode (const char *in, int len)
if (inptr < inend) {
char *decword, *outbase, *outbuf;
const char *inbuf;
- int inlen, outlen;
+ size_t inlen, outlen;
iconv_t ic;
inbuf = decword = hex_decode (inptr, inend - inptr);
@@ -1875,13 +1876,13 @@ rfc2184_decode (const char *in, int len)
ic = e_iconv_open("UTF-8", charset);
if (ic != (iconv_t) -1) {
- int ret;
+ size_t ret;
outlen = inlen * 6 + 16;
outbuf = outbase = g_malloc (outlen);
ret = e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
- if (ret >= 0) {
+ if (ret != (size_t) -1) {
e_iconv (ic, NULL, 0, &outbuf, &outlen);
*outbuf = '\0';
g_free (decoded);
@@ -2022,7 +2023,7 @@ header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2
* locale and converting to utf8 */
char *outbase, *outbuf, *p;
const char *charset, *inbuf;
- int inlen, outlen;
+ size_t inlen, outlen;
iconv_t ic;
inbuf = value;
@@ -2031,13 +2032,13 @@ header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2
charset = e_iconv_locale_charset();
ic = e_iconv_open ("UTF-8", charset ? charset : "ISO-8859-1");
if (ic != (iconv_t) -1) {
- int ret;
+ size_t ret;
outlen = inlen * 6 + 16;
outbuf = outbase = g_malloc (outlen);
ret = e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
- if (ret >= 0) {
+ if (ret != (size_t) -1) {
e_iconv (ic, NULL, 0, &outbuf, &outlen);
*outbuf = '\0';
}
@@ -2350,8 +2351,9 @@ header_decode_mailbox(const char **in)
pre = header_decode_word(&inptr);
if (pre) {
- int l = strlen(last);
- int p = strlen(pre);
+ size_t l = strlen (last);
+ size_t p = strlen (pre);
+
/* dont append ' ' between sucsessive encoded words */
if ((l>6 && last[l-2] == '?' && last[l-1] == '=')
&& (p>6 && pre[0] == '=' && pre[1] == '?')) {
@@ -2950,7 +2952,7 @@ header_param_list_format_append (GString *out, struct _header_param *p)
gboolean encoded = FALSE;
gboolean quote = FALSE;
int here = out->len;
- int nlen, vlen;
+ size_t nlen, vlen;
char *value;
if (!p->value) {
@@ -3465,7 +3467,7 @@ void
header_raw_append_parse(struct _header_raw **list, const char *header, int offset)
{
register const char *in;
- int fieldlen;
+ size_t fieldlen;
char *name;
in = header;
@@ -3623,8 +3625,8 @@ header_msgid_generate (void)
#define COUNT_LOCK()
#define COUNT_UNLOCK()
#endif /* ENABLE_THREADS */
- static gint count = 0;
- gint hrv;
+ static int count = 0;
+ int hrv;
char *ret;
hrv = gethostname (host, sizeof (host));
@@ -3928,13 +3930,13 @@ header_address_list_format(struct _header_address *a)
}
char *
-header_address_fold (const char *in, int headerlen)
+header_address_fold (const char *in, size_t headerlen)
{
- int len, outlen, i;
+ size_t len, outlen;
const char *inptr = in, *space, *p, *n;
GString *out;
char *ret;
- int needunfold = FALSE;
+ int i, needunfold = FALSE;
if (in == NULL)
return NULL;
@@ -4004,9 +4006,9 @@ header_address_fold (const char *in, int headerlen)
/* simple header folding */
/* will work even if the header is already folded */
char *
-header_fold(const char *in, int headerlen)
+header_fold(const char *in, size_t headerlen)
{
- int len, outlen, i;
+ size_t len, outlen, i;
const char *inptr = in, *space, *p, *n;
GString *out;
char *ret;
diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h
index 77dcae843..fcd1a06fa 100644
--- a/camel/camel-mime-utils.h
+++ b/camel/camel-mime-utils.h
@@ -148,8 +148,8 @@ void header_raw_clear(struct _header_raw **list);
char *header_raw_check_mailing_list(struct _header_raw **list);
/* fold a header */
-char *header_address_fold (const char *in, int headerlen);
-char *header_fold (const char *in, int headerlen);
+char *header_address_fold (const char *in, size_t headerlen);
+char *header_fold (const char *in, size_t headerlen);
char *header_unfold (const char *in);
/* decode a header which is a simple token */
@@ -186,23 +186,24 @@ char *header_location_decode(const char *in);
void header_mime_decode(const char *in, int *maj, int *min);
/* do incremental base64/quoted-printable (de/en)coding */
-int base64_decode_step(unsigned char *in, int len, unsigned char *out, int *state, unsigned int *save);
+size_t base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save);
-int base64_encode_step(unsigned char *in, int len, gboolean break_lines, unsigned char *out, int *state, int *save);
-int base64_encode_close(unsigned char *in, int inlen, gboolean break_lines, unsigned char *out, int *state, int *save);
+size_t base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save);
+size_t base64_encode_close(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save);
-int uudecode_step (unsigned char *in, int len, unsigned char *out, int *state, guint32 *save, char *uulen);
-int uuencode_step (unsigned char *in, int len, unsigned char *out, unsigned char *uubuf, int *state,
- guint32 *save, char *uulen);
-int uuencode_close (unsigned char *in, int len, unsigned char *out, unsigned char *uubuf, int *state,
- guint32 *save, char *uulen);
+size_t uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save, char *uulen);
-int quoted_decode_step(unsigned char *in, int len, unsigned char *out, int *savestate, int *saveme);
+size_t uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state,
+ guint32 *save, char *uulen);
+size_t uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state,
+ guint32 *save, char *uulen);
-int quoted_encode_step(unsigned char *in, int len, unsigned char *out, int *state, int *save);
-int quoted_encode_close(unsigned char *in, int len, unsigned char *out, int *state, int *save);
+size_t quoted_decode_step(unsigned char *in, size_t len, unsigned char *out, int *savestate, int *saveme);
-char *base64_encode_simple (const char *data, int len);
-int base64_decode_simple (char *data, int len);
+size_t quoted_encode_step(unsigned char *in, size_t len, unsigned char *out, int *state, int *save);
+size_t quoted_encode_close(unsigned char *in, size_t len, unsigned char *out, int *state, int *save);
+
+char *base64_encode_simple (const char *data, size_t len);
+size_t base64_decode_simple (char *data, size_t len);
#endif /* ! _CAMEL_MIME_UTILS_H */
diff --git a/camel/camel-pgp-context.c b/camel/camel-pgp-context.c
index e754fdc67..16b3ea72b 100644
--- a/camel/camel-pgp-context.c
+++ b/camel/camel-pgp-context.c
@@ -1066,11 +1066,11 @@ pgp_verify (CamelCipherContext *ctx, CamelCipherHash hash, CamelStream *istream,
cd = e_iconv_open ("UTF-8", locale);
if (cd != (iconv_t) -1) {
const char *inbuf;
- int ret;
+ size_t ret;
inbuf = diagnostics;
ret = e_iconv (cd, &inbuf, &inlen, &outbuf, &outlen);
- if (ret >= 0) {
+ if (ret != (size_t) -1) {
e_iconv (cd, NULL, 0, &outbuf, &outlen);
}
e_iconv_close (cd);
diff --git a/camel/camel-sasl-digest-md5.c b/camel/camel-sasl-digest-md5.c
index 28cc081ab..a88612de7 100644
--- a/camel/camel-sasl-digest-md5.c
+++ b/camel/camel-sasl-digest-md5.c
@@ -709,7 +709,7 @@ digest_response (struct _DigestResponse *resp)
outbuf = username = g_malloc0 (outlen + 1);
buf = resp->username;
- if (cd == (iconv_t) -1 || e_iconv (cd, &buf, &len, &outbuf, &outlen) == -1) {
+ if (cd == (iconv_t) -1 || e_iconv (cd, &buf, &len, &outbuf, &outlen) == (size_t) -1) {
/* We can't convert to UTF-8 - pretend we never got a charset param? */
g_free (resp->charset);
resp->charset = NULL;
diff --git a/camel/camel-stream-filter.c b/camel/camel-stream-filter.c
index 2e782d03c..b325aea1f 100644
--- a/camel/camel-stream-filter.c
+++ b/camel/camel-stream-filter.c
@@ -306,8 +306,9 @@ do_flush (CamelStream *stream)
struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
struct _filter *f;
char *buffer;
- int len, presize;
-
+ int presize;
+ size_t len;
+
if (p->last_was_read) {
g_warning("Flushing a filter stream without writing to it");
return 0;
diff --git a/camel/providers/imap/camel-imap-folder.h b/camel/providers/imap/camel-imap-folder.h
index 05e46ce6a..8ab7d009d 100644
--- a/camel/providers/imap/camel-imap-folder.h
+++ b/camel/providers/imap/camel-imap-folder.h
@@ -34,7 +34,7 @@ extern "C" {
#endif /* __cplusplus }*/
#include "camel-imap-types.h"
-#include "camel-disco-folder.h"
+#include <camel/camel-disco-folder.h>
#include <camel/camel-folder-search.h>
#define CAMEL_IMAP_FOLDER_TYPE (camel_imap_folder_get_type ())
diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h
index 09c7ddf9b..43c9b8e1f 100644
--- a/camel/providers/imap/camel-imap-store.h
+++ b/camel/providers/imap/camel-imap-store.h
@@ -32,10 +32,10 @@ extern "C" {
#endif /* __cplusplus }*/
#include "camel-imap-types.h"
-#include "camel-disco-store.h"
+#include <camel/camel-disco-store.h>
#ifdef ENABLE_THREADS
-#include "e-util/e-msgport.h"
+#include <e-util/e-msgport.h>
typedef struct _CamelImapMsg CamelImapMsg;
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index e959aa2de..6ff88d61c 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -348,7 +348,7 @@ pop3_try_authenticate (CamelService *service, const char *errmsg,
CamelPop3Store *store = (CamelPop3Store *)service;
int status;
char *msg;
-
+
/* The KPOP code will have set the password to be the username
* in connect_to_server. Password and APOP are the only other
* cases, and they both need a password. So if there's no
@@ -356,19 +356,18 @@ pop3_try_authenticate (CamelService *service, const char *errmsg,
*/
if (!service->url->passwd) {
char *prompt;
-
+
prompt = g_strdup_printf (_("%sPlease enter the POP3 password "
"for %s@%s"), errmsg ? errmsg : "",
service->url->user,
service->url->host);
- service->url->passwd = camel_session_get_password (
- camel_service_get_session (service),
- prompt, TRUE, service, "password", ex);
+ service->url->passwd = camel_session_get_password (camel_service_get_session (service),
+ prompt, TRUE, service, "password", ex);
g_free (prompt);
if (!service->url->passwd)
return FALSE;
}
-
+
if (!service->url->authmech || !strcmp (service->url->authmech, "+KPOP")) {
status = camel_pop3_command (store, &msg, ex, "USER %s",
service->url->user);
@@ -385,22 +384,22 @@ pop3_try_authenticate (CamelService *service, const char *errmsg,
return FALSE;
}
g_free (msg);
-
+
status = camel_pop3_command (store, &msg, ex, "PASS %s",
service->url->passwd);
} else if (!strcmp (service->url->authmech, "+APOP")
&& store->apop_timestamp) {
char *secret, md5asc[33], *d;
unsigned char md5sum[16], *s;
-
+
secret = g_strdup_printf ("%s%s", store->apop_timestamp,
service->url->passwd);
md5_get_digest (secret, strlen (secret), md5sum);
g_free (secret);
-
+
for (s = md5sum, d = md5asc; d < md5asc + 32; s++, d += 2)
sprintf (d, "%.2x", *s);
-
+
status = camel_pop3_command (store, &msg, ex, "APOP %s %s",
service->url->user, md5asc);
} else {
@@ -410,15 +409,16 @@ pop3_try_authenticate (CamelService *service, const char *errmsg,
"authentication mechanism."));
return FALSE;
}
-
+
if (status == CAMEL_POP3_ERR) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
_("Unable to connect to POP server.\n"
"Error sending password: %s"),
msg ? msg : _("(Unknown)"));
}
-
+
g_free (msg);
+
return status == CAMEL_POP3_ERR;
}
@@ -427,36 +427,33 @@ pop3_connect (CamelService *service, CamelException *ex)
{
char *errbuf = NULL;
gboolean tryagain;
-
+
if (!connect_to_server (service, ex))
return FALSE;
-
+
camel_exception_clear (ex);
do {
if (camel_exception_is_set (ex)) {
- errbuf = g_strdup_printf (
- "%s\n\n",
- camel_exception_get_description (ex));
+ errbuf = g_strdup_printf ("%s\n\n", camel_exception_get_description (ex));
camel_exception_clear (ex);
-
+
/* Uncache the password before prompting again. */
- camel_session_forget_password (
- camel_service_get_session (service),
- service, "password", ex);
+ camel_session_forget_password (camel_service_get_session (service),
+ service, "password", ex);
g_free (service->url->passwd);
service->url->passwd = NULL;
}
-
+
tryagain = pop3_try_authenticate (service, errbuf, ex);
g_free (errbuf);
errbuf = NULL;
} while (tryagain);
-
+
if (camel_exception_is_set (ex)) {
camel_service_disconnect (service, TRUE, ex);
return FALSE;
}
-
+
return TRUE;
}
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 73dfbea34..78509fad2 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -406,8 +406,7 @@ smtp_connect (CamelService *service, CamelException *ex)
while (!authenticated) {
if (errbuf) {
/* We need to un-cache the password before prompting again */
- camel_session_forget_password (
- session, service, "password", ex);
+ camel_session_forget_password (session, service, "password", ex);
g_free (service->url->passwd);
service->url->passwd = NULL;
}
@@ -419,10 +418,8 @@ smtp_connect (CamelService *service, CamelException *ex)
errbuf ? errbuf : "", service->url->user,
service->url->host);
- service->url->passwd =
- camel_session_get_password (
- session, prompt, TRUE,
- service, "password", ex);
+ service->url->passwd = camel_session_get_password (session, prompt, TRUE,
+ service, "password", ex);
g_free (prompt);
g_free (errbuf);