** Merge a bunch of compiler warning fixes and cosmetic cleanups from
authorMatthew Barnes <mbarnes@redhat.com>
Thu, 15 Nov 2007 04:34:38 +0000 (04:34 +0000)
committerMatthew Barnes <mbarnes@src.gnome.org>
Thu, 15 Nov 2007 04:34:38 +0000 (04:34 +0000)
2007-11-14  Matthew Barnes  <mbarnes@redhat.com>

** Merge a bunch of compiler warning fixes and cosmetic
   cleanups from camel-lite.

svn path=/trunk/; revision=8211

125 files changed:
camel/ChangeLog
camel/broken-date-parser.c
camel/camel-arg.h
camel/camel-block-file.c
camel/camel-certdb.h
camel/camel-cipher-context.h
camel/camel-disco-diary.h
camel/camel-disco-folder.h
camel/camel-disco-store.h
camel/camel-exception.c
camel/camel-filter-driver.c
camel/camel-filter-driver.h
camel/camel-filter-search.c
camel/camel-filter-search.h
camel/camel-folder-search.c
camel/camel-folder-summary.c
camel/camel-folder-summary.h
camel/camel-folder-thread.c
camel/camel-folder.c
camel/camel-folder.h
camel/camel-gpg-context.c
camel/camel-html-parser.h
camel/camel-http-stream.c
camel/camel-http-stream.h
camel/camel-lock-helper.h
camel/camel-lock.h
camel/camel-mime-filter-basic.c
camel/camel-mime-filter-basic.h
camel/camel-mime-filter-bestenc.h
camel/camel-mime-filter-canon.c
camel/camel-mime-filter-canon.h
camel/camel-mime-filter-crlf.h
camel/camel-mime-filter-gzip.c
camel/camel-mime-filter-pgp.c
camel/camel-mime-filter-yenc.c
camel/camel-mime-parser.c
camel/camel-mime-parser.h
camel/camel-mime-part-utils.c
camel/camel-mime-part.c
camel/camel-mime-utils.c
camel/camel-mime-utils.h
camel/camel-multipart-encrypted.h
camel/camel-multipart-signed.h
camel/camel-multipart.c
camel/camel-net-utils.c
camel/camel-object.c
camel/camel-object.h
camel/camel-offline-folder.h
camel/camel-offline-store.h
camel/camel-operation.h
camel/camel-private.h
camel/camel-sasl-anonymous.c
camel/camel-sasl-cram-md5.c
camel/camel-sasl-digest-md5.c
camel/camel-sasl-login.c
camel/camel-sasl-ntlm.c
camel/camel-sasl-plain.c
camel/camel-search-private.c
camel/camel-search-private.h
camel/camel-seekable-substream.c
camel/camel-service.c
camel/camel-service.h
camel/camel-session.h
camel/camel-smime-context.c
camel/camel-smime-context.h
camel/camel-store-summary.c
camel/camel-store-summary.h
camel/camel-store.c
camel/camel-store.h
camel/camel-stream-buffer.c
camel/camel-tcp-stream-openssl.c
camel/camel-tcp-stream-raw.c
camel/camel-tcp-stream-ssl.c
camel/camel-text-index.c
camel/camel-transport.h
camel/camel-url-scanner.c
camel/camel-url.c
camel/camel-utf8.c
camel/camel-vee-folder.c
camel/camel-vee-store.c
camel/providers/groupwise/ChangeLog
camel/providers/groupwise/camel-groupwise-store.c
camel/providers/imap/ChangeLog
camel/providers/imap/camel-imap-folder.h
camel/providers/imap/camel-imap-message-cache.c
camel/providers/imap/camel-imap-search.c
camel/providers/imap/camel-imap-store-summary.h
camel/providers/imap/camel-imap-store.c
camel/providers/imap/camel-imap-store.h
camel/providers/imap/camel-imap-utils.c
camel/providers/imap4/ChangeLog
camel/providers/imap4/camel-imap4-store-summary.c
camel/providers/imap4/camel-imap4-store.c
camel/providers/imap4/camel-imap4-summary.c
camel/providers/imapp/camel-imapp-store.c
camel/providers/local/ChangeLog
camel/providers/local/camel-local-folder.c
camel/providers/local/camel-local-folder.h
camel/providers/local/camel-local-store.c
camel/providers/local/camel-local-summary.h
camel/providers/local/camel-maildir-folder.c
camel/providers/local/camel-maildir-store.c
camel/providers/local/camel-maildir-summary.c
camel/providers/local/camel-maildir-summary.h
camel/providers/local/camel-mbox-store.c
camel/providers/local/camel-mbox-summary.c
camel/providers/local/camel-mh-store.c
camel/providers/local/camel-mh-store.h
camel/providers/local/camel-spool-store.c
camel/providers/local/camel-spool-store.h
camel/providers/nntp/ChangeLog
camel/providers/nntp/camel-nntp-store-summary.h
camel/providers/nntp/camel-nntp-store.c
camel/providers/nntp/camel-nntp-store.h
camel/providers/nntp/camel-nntp-stream.c
camel/providers/nntp/camel-nntp-stream.h
camel/providers/pop3/ChangeLog
camel/providers/pop3/camel-pop3-engine.c
camel/providers/pop3/camel-pop3-engine.h
camel/providers/pop3/camel-pop3-folder.c
camel/providers/pop3/camel-pop3-store.c
camel/providers/pop3/camel-pop3-stream.c
camel/providers/pop3/camel-pop3-stream.h
camel/providers/smtp/ChangeLog
camel/providers/smtp/camel-smtp-transport.c

index e6dfbaa..933560f 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-14  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Merge a bunch of compiler warning fixes and cosmetic
+          cleanups from camel-lite.
+
 2007-11-11  Matthew Barnes  <mbarnes@redhat.com>
 
        * camel-tcp-stream-ssl.c (enable_ssl):
index bf5ac00..b4b224a 100644 (file)
@@ -122,7 +122,7 @@ datetok (const char *date)
        const unsigned char *start, *end;
        unsigned int mask;
 
-       start = date;
+       start = (const unsigned char *)date;
        while (*start) {
                /* kill leading whitespace */
                while (*start && isspace ((int) *start))
@@ -195,7 +195,7 @@ get_wday (const unsigned char *in, unsigned int inlen)
                return -1;
 
        for (wday = 0; wday < 7; wday++)
-               if (!g_ascii_strncasecmp (in, tm_days[wday], 3))
+               if (!g_ascii_strncasecmp ((const char *)in, tm_days[wday], 3))
                        return wday;
 
        return -1;  /* unknown week day */
@@ -223,7 +223,7 @@ get_month (const unsigned char *in, unsigned int inlen)
                return -1;
 
        for (i = 0; i < 12; i++)
-               if (!g_ascii_strncasecmp (in, tm_months[i], 3))
+               if (!g_ascii_strncasecmp ((const char*)in, tm_months[i], 3))
                        return i;
 
        return -1;  /* unknown month */
@@ -313,7 +313,7 @@ get_tzone (struct _date_token **token)
                                if (len != inlen)
                                        continue;
 
-                               if (!strncmp (inptr, tz_offsets[t].name, len))
+                               if (!strncmp ((const char*)inptr, tz_offsets[t].name, len))
                                        return tz_offsets[t].offset;
                        }
                }
index d673158..05724c3 100644 (file)
@@ -42,7 +42,7 @@ enum camel_arg_t {
        CAMEL_ARG_DBL = 0x20000000, /* double */
        CAMEL_ARG_STR = 0x30000000, /* c string */
        CAMEL_ARG_PTR = 0x40000000, /* ptr */
-       CAMEL_ARG_BOO = 0x50000000, /* bool */
+       CAMEL_ARG_BOO = 0x50000000  /* bool */
 };
 
 typedef struct _CamelArg CamelArg;
index 1c22b19..72f797b 100644 (file)
@@ -564,7 +564,7 @@ CamelBlock *camel_block_file_get_block(CamelBlockFile *bs, camel_block_t id)
                bl = g_malloc0(sizeof(*bl));
                bl->id = id;
                if (lseek(bs->fd, id, SEEK_SET) == -1 ||
-                   camel_read (bs->fd, bl->data, CAMEL_BLOCK_SIZE) == -1) {
+                   camel_read (bs->fd, (char *) bl->data, CAMEL_BLOCK_SIZE) == -1) {
                        block_file_unuse(bs);
                        CAMEL_BLOCK_FILE_UNLOCK(bs, cache_lock);
                        g_free(bl);
index abfe0f9..ac55164 100644 (file)
@@ -38,14 +38,14 @@ typedef struct _CamelCertDB CamelCertDB;
 typedef struct _CamelCertDBClass CamelCertDBClass;
 
 enum {
-       CAMEL_CERTDB_DIRTY  = (1 << 0),
+       CAMEL_CERTDB_DIRTY  = (1 << 0)
 };
 
 enum {
        CAMEL_CERT_STRING_ISSUER,
        CAMEL_CERT_STRING_SUBJECT,
        CAMEL_CERT_STRING_HOSTNAME,
-       CAMEL_CERT_STRING_FINGERPRINT,
+       CAMEL_CERT_STRING_FINGERPRINT
 };
 
 typedef enum {
@@ -53,7 +53,7 @@ typedef enum {
        CAMEL_CERT_TRUST_NEVER,
        CAMEL_CERT_TRUST_MARGINAL,
        CAMEL_CERT_TRUST_FULLY,
-       CAMEL_CERT_TRUST_ULTIMATE,
+       CAMEL_CERT_TRUST_ULTIMATE
 } CamelCertTrust;
 
 typedef struct {
index de5be44..59fafea 100644 (file)
@@ -57,19 +57,19 @@ typedef enum _camel_cipher_validity_sign_t {
        CAMEL_CIPHER_VALIDITY_SIGN_GOOD,
        CAMEL_CIPHER_VALIDITY_SIGN_BAD,
        CAMEL_CIPHER_VALIDITY_SIGN_UNKNOWN,
-       CAMEL_CIPHER_VALIDITY_SIGN_NEED_PUBLIC_KEY,
+       CAMEL_CIPHER_VALIDITY_SIGN_NEED_PUBLIC_KEY
 } camel_cipher_validity_sign_t;
 
 typedef enum _camel_cipher_validity_encrypt_t {
        CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE,
        CAMEL_CIPHER_VALIDITY_ENCRYPT_WEAK,
        CAMEL_CIPHER_VALIDITY_ENCRYPT_ENCRYPTED, /* encrypted, unknown strenght */
-       CAMEL_CIPHER_VALIDITY_ENCRYPT_STRONG,
+       CAMEL_CIPHER_VALIDITY_ENCRYPT_STRONG
 } camel_cipher_validity_encrypt_t;
 
 typedef enum _camel_cipher_validity_mode_t {
        CAMEL_CIPHER_VALIDITY_SIGN,
-       CAMEL_CIPHER_VALIDITY_ENCRYPT,
+       CAMEL_CIPHER_VALIDITY_ENCRYPT
 } camel_cipher_validity_mode_t;
 
 struct _CamelCipherCertInfo {
index 8288350..41b8677 100644 (file)
@@ -40,7 +40,7 @@ typedef enum {
 
        CAMEL_DISCO_DIARY_FOLDER_EXPUNGE,
        CAMEL_DISCO_DIARY_FOLDER_APPEND,
-       CAMEL_DISCO_DIARY_FOLDER_TRANSFER,
+       CAMEL_DISCO_DIARY_FOLDER_TRANSFER
 } CamelDiscoDiaryAction;
 
 typedef enum {
index de9a7b9..7d6e5a9 100644 (file)
@@ -35,12 +35,11 @@ G_BEGIN_DECLS
 
 enum {
        CAMEL_DISCO_FOLDER_ARG_OFFLINE_SYNC = CAMEL_FOLDER_ARG_LAST,
-
        CAMEL_DISCO_FOLDER_ARG_LAST = CAMEL_FOLDER_ARG_LAST + 0x100
 };
 
 enum {
-       CAMEL_DISCO_FOLDER_OFFLINE_SYNC = CAMEL_DISCO_FOLDER_ARG_OFFLINE_SYNC | CAMEL_ARG_BOO,
+       CAMEL_DISCO_FOLDER_OFFLINE_SYNC = CAMEL_DISCO_FOLDER_ARG_OFFLINE_SYNC | CAMEL_ARG_BOO
 };
 
 struct _CamelDiscoFolder {
index de794c3..88e3fc1 100644 (file)
@@ -35,7 +35,7 @@
 G_BEGIN_DECLS
 
 enum {
-       CAMEL_DISCO_STORE_ARG_FIRST  = CAMEL_STORE_ARG_FIRST + 100,
+       CAMEL_DISCO_STORE_ARG_FIRST  = CAMEL_STORE_ARG_FIRST + 100
 };
 
 typedef enum {
index f4e1ad0..8496790 100644 (file)
 /* dont turn this off */
 #define w(x) x
 
-/* i dont know why gthread_mutex stuff even exists, this is easier */
-
-/* also, i'm not convinced mutexes are needed here.  But it
-   doesn't really hurt either */
-static pthread_mutex_t exception_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-#define CAMEL_EXCEPTION_LOCK(e) (pthread_mutex_lock(&exception_mutex))
-#define CAMEL_EXCEPTION_UNLOCK(e) (pthread_mutex_unlock(&exception_mutex))
-
-static EMemChunk *exception_chunks = NULL;
 
 /**
  * camel_exception_new: allocate a new exception object.
@@ -62,19 +52,12 @@ camel_exception_new (void)
 {
        CamelException *ex;
 
-       CAMEL_EXCEPTION_LOCK(exception);
-
-       if (exception_chunks == NULL)
-               exception_chunks = e_memchunk_new(16, sizeof(CamelException));
-
-       ex = e_memchunk_alloc(exception_chunks);
+       ex = g_slice_new (CamelException);
        ex->desc = NULL;
 
        /* set the Exception Id to NULL */
        ex->id = CAMEL_EXCEPTION_NONE;
 
-       CAMEL_EXCEPTION_UNLOCK(exception);
-
        return ex;
 }
 
@@ -109,14 +92,10 @@ camel_exception_clear (CamelException *exception)
        if (!exception)
                return;
 
-       CAMEL_EXCEPTION_LOCK(exception);
-
        if (exception->desc)
                g_free (exception->desc);
        exception->desc = NULL;
        exception->id = CAMEL_EXCEPTION_NONE;
-
-       CAMEL_EXCEPTION_UNLOCK(exception);
 }
 
 /**
@@ -135,11 +114,7 @@ camel_exception_free (CamelException *exception)
        if (exception->desc)
                g_free (exception->desc);
 
-       CAMEL_EXCEPTION_LOCK(exception);
-
-       e_memchunk_free(exception_chunks, exception);
-
-       CAMEL_EXCEPTION_UNLOCK(exception);
+       g_slice_free (CamelException, exception);
 }
 
 /**
@@ -160,21 +135,14 @@ void
 camel_exception_set (CamelException *ex, ExceptionId id, const char *desc)
 {
        if (camel_debug("exception"))
-               printf("CamelException.set(%p, %u, '%s')\n", ex, id, desc);
-
+               printf("CamelException.set(%p, %u, '%s')\n", (void *) ex, id, desc);
        if (!ex)
                return;
-
-       CAMEL_EXCEPTION_LOCK(exception);
-
        ex->id = id;
-
        if (desc != ex->desc) {
                g_free (ex->desc);
                ex->desc = g_strdup (desc);
        }
-
-       CAMEL_EXCEPTION_UNLOCK(exception);
 }
 
 /**
@@ -208,20 +176,16 @@ camel_exception_setv (CamelException *ex, ExceptionId id, const char *format, ..
        va_end (args);
 
        if (camel_debug("exception"))
-               printf("CamelException.setv(%p, %u, '%s')\n", ex, id, desc);
+               printf("CamelException.setv(%p, %u, '%s')\n", (void *) ex, id, desc);
 
        if (!ex) {
                g_free(desc);
                return;
        }
 
-       CAMEL_EXCEPTION_LOCK(exception);
-
        g_free(ex->desc);
        ex->desc = desc;
        ex->id = id;
-
-       CAMEL_EXCEPTION_UNLOCK(exception);
 }
 
 /**
@@ -248,8 +212,6 @@ camel_exception_xfer (CamelException *ex_dst,
                return;
        }
 
-       CAMEL_EXCEPTION_LOCK(exception);
-
        if (ex_dst->desc)
                g_free (ex_dst->desc);
 
@@ -258,8 +220,6 @@ camel_exception_xfer (CamelException *ex_dst,
 
        ex_src->desc = NULL;
        ex_src->id = CAMEL_EXCEPTION_NONE;
-
-       CAMEL_EXCEPTION_UNLOCK(exception);
 }
 
 /**
index ba12c24..344a56f 100644 (file)
@@ -1210,6 +1210,7 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, co
 
                info = camel_message_info_new_from_header(NULL, ((CamelMimePart *)msg)->headers);
                ((CamelMessageInfoBase *)info)->size = camel_mime_parser_tell(mp) - last;
+
                last = camel_mime_parser_tell(mp);
                status = camel_filter_driver_filter_message (driver, msg, info, NULL, NULL, source_url,
                                                             original_source_url ? original_source_url : source_url, ex);
index c7a3156..dc23c53 100644 (file)
@@ -54,7 +54,7 @@ enum camel_filter_status_t {
        CAMEL_FILTER_STATUS_START,      /* start of new message processed */
        CAMEL_FILTER_STATUS_ACTION,     /* an action performed */
        CAMEL_FILTER_STATUS_PROGRESS,   /* (an) extra update(s), if its taking longer to process */
-       CAMEL_FILTER_STATUS_END,        /* end of message */
+       CAMEL_FILTER_STATUS_END         /* end of message */
 };
 
 typedef CamelFolder * (*CamelFilterGetFolderFunc) (CamelFilterDriver *driver, const char *uri,
index c4c930d..4e49f2f 100644 (file)
@@ -164,12 +164,14 @@ check_header (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMess
                                }
                        }
                } else {
-                       CamelMimeMessage *message = camel_filter_search_get_message (fms, f);
+                       CamelMimeMessage *message;
                        struct _camel_header_raw *header;
                        const char *charset = NULL;
                        camel_search_t type = CAMEL_SEARCH_TYPE_ENCODED;
                        CamelContentType *ct;
 
+                       message = camel_filter_search_get_message (fms, f);
+
                        /* FIXME: what about Resent-To, Resent-Cc and Resent-From? */
                        if (g_ascii_strcasecmp("to", name) == 0 || g_ascii_strcasecmp("cc", name) == 0 || g_ascii_strcasecmp("from", name) == 0)
                                type = CAMEL_SEARCH_TYPE_ADDRESS_ENCODED;
index 5bee19e..25bf5ed 100644 (file)
@@ -34,7 +34,7 @@ G_BEGIN_DECLS
 enum {
        CAMEL_SEARCH_ERROR    = -1,
        CAMEL_SEARCH_NOMATCH  =  0,
-       CAMEL_SEARCH_MATCHED  =  1,
+       CAMEL_SEARCH_MATCHED  =  1
 };
 
 typedef CamelMimeMessage * (*CamelFilterSearchGetMessageFunc) (void *data, CamelException *ex);
index ffb3926..c987120 100644 (file)
@@ -136,7 +136,7 @@ free_mempool(void *key, void *value, void *data)
        GPtrArray *uids = key;
        EMemPool *pool = value;
 
-       g_warning("Search closed with outstanding result unfreed: %p", uids);
+       g_warning("Search closed with outstanding result unfreed: %p", (void *) uids);
 
        g_ptr_array_free(uids, TRUE);
        e_mempool_destroy(pool);
@@ -919,7 +919,7 @@ check_header(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolder
                                        truth = TRUE;
                                } else if (how == CAMEL_SEARCH_MATCH_CONTAINS) {
                                        /* doesn't make sense to split words on anything but contains i.e. we can't have an ending match different words */
-                                       words = camel_search_words_split(argv[i]->value.string);
+                                       words = camel_search_words_split((const unsigned char *) argv[i]->value.string);
                                        truth = TRUE;
                                        for (j=0;j<words->len && truth;j++) {
                                                truth = camel_search_header_match(header, words->words[j]->word, how, type, NULL);
@@ -1120,7 +1120,7 @@ match_words_1message (CamelDataWrapper *object, struct _camel_search_words *word
                camel_stream_write (CAMEL_STREAM (mem), "", 1);
                for (i=0;i<words->len;i++) {
                        /* FIXME: This is horridly slow, and should use a real search algorithm */
-                       if (camel_ustrstrcase(mem->buffer->data, words->words[i]->word) != NULL) {
+                       if (camel_ustrstrcase((const char *) mem->buffer->data, words->words[i]->word) != NULL) {
                                *mask |= (1<<i);
                                /* shortcut a match */
                                if (*mask == (1<<(words->len))-1)
@@ -1209,7 +1209,7 @@ search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam
                } else {
                        for (i=0;i<argc && !truth;i++) {
                                if (argv[i]->type == ESEXP_RES_STRING) {
-                                       words = camel_search_words_split(argv[i]->value.string);
+                                       words = camel_search_words_split((const unsigned char *) argv[i]->value.string);
                                        truth = TRUE;
                                        if ((words->type & CAMEL_SEARCH_WORD_COMPLEX) == 0 && search->body_index) {
                                                for (j=0;j<words->len && truth;j++)
@@ -1242,7 +1242,7 @@ search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam
 
                        for (i=0;i<argc;i++) {
                                if (argv[i]->type == ESEXP_RES_STRING) {
-                                       words = camel_search_words_split(argv[i]->value.string);
+                                       words = camel_search_words_split((const unsigned char *) argv[i]->value.string);
                                        if ((words->type & CAMEL_SEARCH_WORD_COMPLEX) == 0 && search->body_index) {
                                                matches = match_words_index(search, words, ex);
                                        } else {
index 00c3cf2..5ba8ed0 100644 (file)
@@ -529,7 +529,7 @@ perform_content_info_load(CamelFolderSummary *s, FILE *in)
                return NULL;
 
        if (camel_file_util_decode_uint32(in, &count) == -1 || count > 500) {
-               camel_folder_summary_content_info_free(s, ci);
+               camel_folder_summary_content_info_free (s, ci);
                return NULL;
        }
 
@@ -540,7 +540,7 @@ perform_content_info_load(CamelFolderSummary *s, FILE *in)
                        part->parent = ci;
                } else {
                        d(fprintf (stderr, "Summary file format messed up?"));
-                       camel_folder_summary_content_info_free(s, ci);
+                       camel_folder_summary_content_info_free (s, ci);
                        return NULL;
                }
        }
@@ -714,6 +714,7 @@ camel_folder_summary_save(CamelFolderSummary *s)
 
        /* now write out each message ... */
        /* we check ferorr when done for i/o errors */
+
        count = s->messages->len;
        for (i = 0; i < count; i++) {
                mi = s->messages->pdata[i];
@@ -744,6 +745,7 @@ camel_folder_summary_save(CamelFolderSummary *s)
 #ifdef G_OS_WIN32
        g_unlink(s->summary_path);
 #endif
+
        if (g_rename(path, s->summary_path) == -1) {
                i = errno;
                g_unlink(path);
@@ -761,10 +763,9 @@ camel_folder_summary_save(CamelFolderSummary *s)
        s->flags &= ~CAMEL_SUMMARY_DIRTY;
        return 0;
 
- exception:
+exception:
 
        i = errno;
-
        fclose (out);
        fclose (out_meta);
 
@@ -826,9 +827,10 @@ summary_assign_uid(CamelFolderSummary *s, CamelMessageInfo *info)
        const char *uid;
        CamelMessageInfo *mi;
 
-       uid = camel_message_info_uid(info);
+       uid = camel_message_info_uid (info);
+
        if (uid == NULL || uid[0] == 0) {
-               g_free(info->uid);
+               g_free (info->uid);
                uid = info->uid = camel_folder_summary_next_uid_string(s);
        }
 
@@ -836,12 +838,17 @@ summary_assign_uid(CamelFolderSummary *s, CamelMessageInfo *info)
 
        while ((mi = g_hash_table_lookup(s->messages_uid, uid))) {
                CAMEL_SUMMARY_UNLOCK(s, summary_lock);
+
                if (mi == info)
                        return 0;
+
                d(printf ("Trying to insert message with clashing uid (%s).  new uid re-assigned", camel_message_info_uid(info)));
+
                g_free(info->uid);
                uid = info->uid = camel_folder_summary_next_uid_string(s);
+
                camel_message_info_set_flags(info, CAMEL_MESSAGE_FOLDER_FLAGGED, CAMEL_MESSAGE_FOLDER_FLAGGED);
+
                CAMEL_SUMMARY_LOCK(s, summary_lock);
        }
 
@@ -1216,7 +1223,7 @@ camel_folder_summary_remove_uid(CamelFolderSummary *s, const char *uid)
                CAMEL_SUMMARY_UNLOCK(s, summary_lock);
                camel_folder_summary_remove(s, oldinfo);
                camel_message_info_free(oldinfo);
-        } else {
+       } else {
                CAMEL_SUMMARY_UNLOCK(s, ref_lock);
                CAMEL_SUMMARY_UNLOCK(s, summary_lock);
        }
@@ -2017,7 +2024,7 @@ content_info_load(CamelFolderSummary *s, FILE *in)
        if (camel_file_util_decode_uint32(in, &count) == -1 || count > 500)
                goto error;
 
-       for (i=0;i<count;i++) {
+       for (i = 0; i < count; i++) {
                char *name, *value;
                camel_folder_summary_decode_token(in, &name);
                camel_folder_summary_decode_token(in, &value);
@@ -2074,6 +2081,7 @@ content_info_save(CamelFolderSummary *s, FILE *out, CamelMessageContentInfo *ci)
        camel_folder_summary_encode_token(out, ci->id);
        camel_folder_summary_encode_token(out, ci->description);
        camel_folder_summary_encode_token(out, ci->encoding);
+
        return camel_file_util_encode_uint32(out, ci->size);
 }
 
@@ -2295,6 +2303,7 @@ summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msgi
        /* using the object types is more accurate than using the mime/types */
        if (CAMEL_IS_MULTIPART(containee)) {
                parts = camel_multipart_get_number(CAMEL_MULTIPART(containee));
+
                for (i=0;i<parts;i++) {
                        CamelMimePart *part = camel_multipart_get_part(CAMEL_MULTIPART(containee), i);
                        g_assert(part);
index e66874b..8887bb3 100644 (file)
@@ -192,7 +192,7 @@ struct _CamelChangeInfo {
 */
 
 typedef enum _CamelFolderSummaryFlags {
-       CAMEL_SUMMARY_DIRTY = 1<<0,
+       CAMEL_SUMMARY_DIRTY = 1<<0
 } CamelFolderSummaryFlags;
 
 struct _CamelFolderSummary {
index a89f176..035d65a 100644 (file)
@@ -225,7 +225,7 @@ remove_node(CamelFolderThreadNode **list, CamelFolderThreadNode *node, CamelFold
                c = c->next;
        }
 
-       printf("ERROR: removing node %p failed\n", node);
+       printf("ERROR: removing node %p failed\n", (void *) node);
 }
 
 static void
@@ -330,16 +330,16 @@ dump_tree_rec(struct _tree_info *info, CamelFolderThreadNode *c, int depth)
 
        while (c) {
                if (g_hash_table_lookup(info->visited, c)) {
-                       printf("WARNING: NODE REVISITED: %p\n", c);
+                       printf("WARNING: NODE REVISITED: %p\n", (void *) c);
                } else {
                        g_hash_table_insert(info->visited, c, c);
                }
                if (c->message) {
-                       printf("%s %p Subject: %s <%08x%08x>\n", p, c, camel_message_info_subject(c->message),
+                       printf("%s %p Subject: %s <%08x%08x>\n", p, (void *) c, camel_message_info_subject(c->message),
                               camel_message_info_message_id(c->message)->id.part.hi, camel_message_info_message_id(c->message)->id.part.lo);
                        count += 1;
                } else {
-                       printf("%s %p <empty>\n", p, c);
+                       printf("%s %p <empty>\n", p, (void *) c);
                }
                if (c->child)
                        count += dump_tree_rec(info, c->child, depth+1);
index 63f335d..0d9184c 100644 (file)
@@ -85,7 +85,6 @@ static void append_message (CamelFolder *folder, CamelMimeMessage *message,
                            const CamelMessageInfo *info, char **appended_uid,
                            CamelException *ex);
 
-
 static GPtrArray        *get_uids            (CamelFolder *folder);
 static void              free_uids           (CamelFolder *folder,
                                              GPtrArray *array);
@@ -310,7 +309,7 @@ folder_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
        guint32 tag;
        int unread = -1, deleted = 0, junked = 0, visible = 0, count = -1;
 
-       for (i=0;i<args->argc;i++) {
+       for (i = 0; i < args->argc; i++) {
                CamelArgGet *arg = &args->argv[i];
 
                tag = arg->tag;
@@ -350,9 +349,9 @@ folder_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 
                                /* TODO: Locking? */
                                unread = 0;
-                               count = camel_folder_summary_count(folder->summary);
-                               for (j=0; j<count; j++) {
-                                       if ((info = camel_folder_summary_index(folder->summary, j))) {
+                               count = camel_folder_summary_count (folder->summary);
+                               for (j = 0; j < count; j++) {
+                                       if ((info = camel_folder_summary_index (folder->summary, j))) {
                                                guint32 flags = camel_message_info_flags(info);
 
                                                if ((flags & (CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_JUNK)) == 0)
@@ -1748,7 +1747,7 @@ filter_free(CamelSession *session, CamelSessionThreadMsg *msg)
 
 static CamelSessionThreadOps filter_ops = {
        filter_filter,
-       filter_free,
+       filter_free
 };
 
 struct _CamelFolderChangeInfoPrivate {
@@ -1925,12 +1924,12 @@ camel_folder_change_info_new(void)
 {
        CamelFolderChangeInfo *info;
 
-       info = g_malloc(sizeof(*info));
+       info = g_slice_new (CamelFolderChangeInfo);
        info->uid_added = g_ptr_array_new();
        info->uid_removed = g_ptr_array_new();
        info->uid_changed = g_ptr_array_new();
        info->uid_recent = g_ptr_array_new();
-       info->priv = g_malloc0(sizeof(*info->priv));
+       info->priv = g_slice_new (struct _CamelFolderChangeInfoPrivate);
        info->priv->uid_stored = g_hash_table_new(g_str_hash, g_str_equal);
        info->priv->uid_source = NULL;
        info->priv->uid_filter = g_ptr_array_new();
@@ -2339,11 +2338,11 @@ camel_folder_change_info_free(CamelFolderChangeInfo *info)
        g_hash_table_destroy(p->uid_stored);
        g_ptr_array_free(p->uid_filter, TRUE);
        e_mempool_destroy(p->uid_pool);
-       g_free(p);
+       g_slice_free (struct _CamelFolderChangeInfoPrivate, p);
 
        g_ptr_array_free(info->uid_added, TRUE);
        g_ptr_array_free(info->uid_removed, TRUE);
        g_ptr_array_free(info->uid_changed, TRUE);
        g_ptr_array_free(info->uid_recent, TRUE);
-       g_free(info);
+       g_slice_free (CamelFolderChangeInfo, info);
 }
index 6afeee4..afaeae3 100644 (file)
@@ -52,7 +52,7 @@ enum {
        CAMEL_FOLDER_ARG_UID_ARRAY,
        CAMEL_FOLDER_ARG_INFO_ARRAY,
        CAMEL_FOLDER_ARG_PROPERTIES,
-       CAMEL_FOLDER_ARG_LAST = CAMEL_ARG_FIRST + 0x2000,
+       CAMEL_FOLDER_ARG_LAST = CAMEL_ARG_FIRST + 0x2000
 };
 
 enum {
@@ -70,7 +70,7 @@ enum {
        CAMEL_FOLDER_INFO_ARRAY = CAMEL_FOLDER_ARG_INFO_ARRAY | CAMEL_ARG_PTR,
 
        /* GSList of settable folder properties */
-       CAMEL_FOLDER_PROPERTIES = CAMEL_FOLDER_ARG_PROPERTIES | CAMEL_ARG_PTR,
+       CAMEL_FOLDER_PROPERTIES = CAMEL_FOLDER_ARG_PROPERTIES | CAMEL_ARG_PTR
 };
 
 struct _CamelFolderChangeInfo {
@@ -105,7 +105,7 @@ struct _CamelFolder {
 #define CAMEL_FOLDER_HAS_BEEN_DELETED       (1<<3)
 #define CAMEL_FOLDER_IS_TRASH               (1<<4)
 #define CAMEL_FOLDER_IS_JUNK                (1<<5)
-#define CAMEL_FOLDER_FILTER_JUNK           (1<<6)
+#define CAMEL_FOLDER_FILTER_JUNK           (1<<6)
 
 typedef struct {
        CamelObjectClass parent_class;
index a954bb1..d8fb496 100644 (file)
@@ -168,7 +168,7 @@ enum _GpgCtxMode {
        GPG_CTX_MODE_ENCRYPT,
        GPG_CTX_MODE_DECRYPT,
        GPG_CTX_MODE_IMPORT,
-       GPG_CTX_MODE_EXPORT,
+       GPG_CTX_MODE_EXPORT
 };
 
 enum _GpgTrustMetric {
@@ -747,9 +747,9 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, CamelException *ex)
        if (camel_debug("gpg:status"))
                printf ("status: %s\n", status);
 
-       if (strncmp (status, "[GNUPG:] ", 9) != 0) {
+       if (strncmp ((const char *) status, "[GNUPG:] ", 9) != 0) {
                char *message;
-               message = g_locale_to_utf8(status, -1, NULL, NULL, NULL);
+               message = g_locale_to_utf8((const gchar *) status, -1, NULL, NULL, NULL);
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
                                      _("Unexpected GnuPG status message encountered:\n\n%s"),
                                      message);
@@ -873,16 +873,16 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, CamelException *ex)
                                             _("Failed to unlock secret key: 3 bad passphrases given."));
                        return -1;
                }
-       } else if (!strncmp (status, "UNEXPECTED ", 11)) {
+       } else if (!strncmp ((const char *) status, "UNEXPECTED ", 11)) {
                /* this is an error */
                char *message;
-               message = g_locale_to_utf8(status+11, -1, NULL, NULL, NULL);
+               message = g_locale_to_utf8((const gchar *) status+11, -1, NULL, NULL, NULL);
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
                                      _("Unexpected response from GnuPG: %s"),
                                      message);
                g_free(message);
                return -1;
-       } else if (!strncmp (status, "NODATA", 6)) {
+       } else if (!strncmp ((char *) status, "NODATA", 6)) {
                /* this is an error */
                /* But we ignore it anyway, we should get other response codes to say why */
                gpg->nodata = TRUE;
index c843dc4..3fca000 100644 (file)
@@ -54,7 +54,7 @@ typedef enum _camel_html_parser_t {
        CAMEL_HTML_PARSER_VAL,                  /* value */
        CAMEL_HTML_PARSER_VAL_ENT,              /* entity in value */
        CAMEL_HTML_PARSER_EOD,                  /* end of current data */
-       CAMEL_HTML_PARSER_EOF,                  /* end of file */
+       CAMEL_HTML_PARSER_EOF                   /* end of file */
 } camel_html_parser_t;
 
 struct _CamelHTMLParser {
index 1aa8d59..5ede95f 100644 (file)
@@ -268,7 +268,7 @@ http_get_statuscode (CamelHttpStream *http)
 
        /* parse the HTTP status code */
        if (!g_ascii_strncasecmp (buffer, "HTTP/", 5)) {
-               token = http_next_token (buffer);
+               token = http_next_token ((const unsigned char *) buffer);
                http->statuscode = camel_header_decode_int (&token);
                return http->statuscode;
        }
@@ -583,7 +583,7 @@ camel_http_stream_set_proxy (CamelHttpStream *http_stream, const char *proxy_url
 
                basic = g_strdup_printf("%s:%s", http_stream->proxy->user?http_stream->proxy->user:"",
                                        http_stream->proxy->passwd?http_stream->proxy->passwd:"");
-               basic64 = g_base64_encode(basic, strlen(basic));
+               basic64 = g_base64_encode((const guchar *) basic, strlen(basic));
                memset(basic, 0, strlen(basic));
                g_free(basic);
                camel_http_stream_set_proxy_authpass(http_stream, basic64);
index 241d047..c3f4c6e 100644 (file)
@@ -39,7 +39,7 @@ G_BEGIN_DECLS
 typedef enum {
        /*CAMEL_HTTP_METHOD_OPTIONS,*/
        CAMEL_HTTP_METHOD_GET,
-       CAMEL_HTTP_METHOD_HEAD,
+       CAMEL_HTTP_METHOD_HEAD
        /*CAMEL_HTTP_METHOD_POST,*/
        /*CAMEL_HTTP_METHOD_PUT,*/
        /*CAMEL_HTTP_METHOD_DELETE,*/
index 729b133..03c79cc 100644 (file)
@@ -47,13 +47,13 @@ enum {
        CAMEL_LOCK_HELPER_STATUS_PROTOCOL,
        CAMEL_LOCK_HELPER_STATUS_NOMEM,
        CAMEL_LOCK_HELPER_STATUS_SYSTEM,
-       CAMEL_LOCK_HELPER_STATUS_INVALID, /* not allowed to lock/doesn't exist etc */
+       CAMEL_LOCK_HELPER_STATUS_INVALID /* not allowed to lock/doesn't exist etc */
 };
 
 /* commands */
 enum {
        CAMEL_LOCK_HELPER_LOCK = 0xf0f,
-       CAMEL_LOCK_HELPER_UNLOCK = 0xf0f0,
+       CAMEL_LOCK_HELPER_UNLOCK = 0xf0f0
 };
 
 /* seconds between lock refreshes */
index 0eb7c95..d5afc6a 100644 (file)
@@ -37,7 +37,7 @@ G_BEGIN_DECLS
 
 typedef enum {
        CAMEL_LOCK_READ,
-       CAMEL_LOCK_WRITE,
+       CAMEL_LOCK_WRITE
 } CamelLockType;
 
 /* specific locking strategies */
index b14f61d..3421158 100644 (file)
@@ -102,39 +102,39 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
                /* wont go to more than 2x size (overly conservative) */
                camel_mime_filter_set_size(mf, len*2+6, FALSE);
                if (len > 0)
-                       newlen += g_base64_encode_step(in, len, TRUE, mf->outbuf, &f->state, &f->save);
+                       newlen += g_base64_encode_step((const guchar *) in, len, TRUE, mf->outbuf, &f->state, &f->save);
                newlen += g_base64_encode_close(TRUE, mf->outbuf, &f->state, &f->save);
                g_assert(newlen <= len*2+6);
                break;
        case CAMEL_MIME_FILTER_BASIC_QP_ENC:
                /* *4 is definetly more than needed ... */
                camel_mime_filter_set_size(mf, len*4+4, FALSE);
-               newlen = camel_quoted_encode_close(in, len, mf->outbuf, &f->state, &f->save);
+               newlen = camel_quoted_encode_close((unsigned char *) in, len, (unsigned char *) mf->outbuf, &f->state, &f->save);
                g_assert(newlen <= len*4+4);
                break;
        case CAMEL_MIME_FILTER_BASIC_UU_ENC:
                /* won't go to more than 2 * (x + 2) + 62 */
                camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE);
-               newlen = camel_uuencode_close (in, len, mf->outbuf, f->uubuf, &f->state, &f->save);
+               newlen = camel_uuencode_close ((unsigned char *) in, len, (unsigned char *) mf->outbuf, f->uubuf, &f->state, (guint32 *) &f->save);
                g_assert (newlen <= (len + 2) * 2 + 62);
                break;
        case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
                /* output can't possibly exceed the input size */
                camel_mime_filter_set_size(mf, len, FALSE);
-               newlen = g_base64_decode_step(in, len, mf->outbuf, &f->state, &f->save);
+               newlen = g_base64_decode_step(in, len, (guchar *) mf->outbuf, &f->state, (guint *) &f->save);
                g_assert(newlen <= len);
                break;
        case CAMEL_MIME_FILTER_BASIC_QP_DEC:
                /* output can't possibly exceed the input size, well unless its not really qp, then +2 max */
                camel_mime_filter_set_size(mf, len+2, FALSE);
-               newlen = camel_quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save);
+               newlen = camel_quoted_decode_step((unsigned char *) in, len, (unsigned char *) mf->outbuf, &f->state, (gint *) &f->save);
                g_assert(newlen <= len+2);
                break;
        case CAMEL_MIME_FILTER_BASIC_UU_DEC:
                if ((f->state & CAMEL_UUDECODE_STATE_BEGIN) && !(f->state & CAMEL_UUDECODE_STATE_END)) {
                        /* "begin <mode> <filename>\n" has been found, so we can now start decoding */
                        camel_mime_filter_set_size (mf, len + 3, FALSE);
-                       newlen = camel_uudecode_step (in, len, mf->outbuf, &f->state, &f->save);
+                       newlen = camel_uudecode_step ((unsigned char *) in, len, (unsigned char *) mf->outbuf, &f->state, (guint32 *) &f->save);
                } else {
                        newlen = 0;
                }
@@ -166,31 +166,31 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
        case CAMEL_MIME_FILTER_BASIC_BASE64_ENC:
                /* wont go to more than 2x size (overly conservative) */
                camel_mime_filter_set_size(mf, len*2+6, FALSE);
-               newlen = g_base64_encode_step(in, len, TRUE, mf->outbuf, &f->state, &f->save);
+               newlen = g_base64_encode_step((const guchar *) in, len, TRUE, mf->outbuf, &f->state, &f->save);
                g_assert(newlen <= len*2+6);
                break;
        case CAMEL_MIME_FILTER_BASIC_QP_ENC:
                /* *4 is overly conservative, but will do */
                camel_mime_filter_set_size(mf, len*4+4, FALSE);
-               newlen = camel_quoted_encode_step(in, len, mf->outbuf, &f->state, &f->save);
+               newlen = camel_quoted_encode_step((unsigned char *) in, len, (unsigned char *) mf->outbuf, &f->state, (gint *) &f->save);
                g_assert(newlen <= len*4+4);
                break;
        case CAMEL_MIME_FILTER_BASIC_UU_ENC:
                /* won't go to more than 2 * (x + 2) + 62 */
                camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE);
-               newlen = camel_uuencode_step (in, len, mf->outbuf, f->uubuf, &f->state, &f->save);
+               newlen = camel_uuencode_step ((unsigned char *) in, len, (unsigned char *) mf->outbuf, f->uubuf, &f->state, (guint32 *) &f->save);
                g_assert (newlen <= (len + 2) * 2 + 62);
                break;
        case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
                /* output can't possibly exceed the input size */
                camel_mime_filter_set_size(mf, len+3, FALSE);
-               newlen = g_base64_decode_step(in, len, mf->outbuf, &f->state, &f->save);
+               newlen = g_base64_decode_step(in, len, (guchar *) mf->outbuf, &f->state, (guint *) &f->save);
                g_assert(newlen <= len+3);
                break;
        case CAMEL_MIME_FILTER_BASIC_QP_DEC:
                /* output can't possibly exceed the input size */
                camel_mime_filter_set_size(mf, len + 2, FALSE);
-               newlen = camel_quoted_decode_step(in, len, mf->outbuf, &f->state, &f->save);
+               newlen = camel_quoted_decode_step((unsigned char *) in, len, (unsigned char *) mf->outbuf, &f->state, (gint *) &f->save);
                g_assert(newlen <= len + 2);
                break;
        case CAMEL_MIME_FILTER_BASIC_UU_DEC:
@@ -232,7 +232,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
                if ((f->state & CAMEL_UUDECODE_STATE_BEGIN) && !(f->state & CAMEL_UUDECODE_STATE_END)) {
                        /* "begin <mode> <filename>\n" has been found, so we can now start decoding */
                        camel_mime_filter_set_size (mf, len + 3, FALSE);
-                       newlen = camel_uudecode_step (in, len, mf->outbuf, &f->state, &f->save);
+                       newlen = camel_uudecode_step ((unsigned char *) in, len, (unsigned char *) mf->outbuf, &f->state, (guint32 *) &f->save);
                } else {
                        newlen = 0;
                }
index b6d88b7..1d15ec2 100644 (file)
@@ -38,7 +38,7 @@ typedef enum {
        CAMEL_MIME_FILTER_BASIC_QP_ENC,
        CAMEL_MIME_FILTER_BASIC_QP_DEC,
        CAMEL_MIME_FILTER_BASIC_UU_ENC,
-       CAMEL_MIME_FILTER_BASIC_UU_DEC,
+       CAMEL_MIME_FILTER_BASIC_UU_DEC
 } CamelMimeFilterBasicType;
 
 struct _CamelMimeFilterBasic {
index 98b1d80..daad4dc 100644 (file)
@@ -41,7 +41,7 @@ typedef enum _CamelBestencRequired {
        /* do we treat 'lf' as if it were crlf? */
        CAMEL_BESTENC_LF_IS_CRLF = 1<<8,
        /* do we not allow "From " to appear at the start of a line in any part? */
-       CAMEL_BESTENC_NO_FROM = 1<<9,
+       CAMEL_BESTENC_NO_FROM = 1<<9
 } CamelBestencRequired;
 
 typedef enum _CamelBestencEncoding {
@@ -50,7 +50,7 @@ typedef enum _CamelBestencEncoding {
        CAMEL_BESTENC_BINARY,
 
        /* is the content stream to be treated as text? */
-       CAMEL_BESTENC_TEXT = 1<<8,
+       CAMEL_BESTENC_TEXT = 1<<8
 } CamelBestencEncoding;
 
 struct _CamelMimeFilterBestenc {
index 57f0639..9c3567f 100644 (file)
@@ -80,8 +80,8 @@ filter_run(CamelMimeFilter *f, char *in, size_t len, size_t prespace, char **out
        flags = ((CamelMimeFilterCanon *)f)->flags;
 
        /* first, work out how much space we need */
-       inptr = in;
-       inend = in+len;
+       inptr = (unsigned char *)in;
+       inend = (const unsigned char *) (in+len);
        while (inptr < inend)
                if (*inptr++ == '\n')
                        lf++;
@@ -93,7 +93,7 @@ filter_run(CamelMimeFilter *f, char *in, size_t len, size_t prespace, char **out
        camel_mime_filter_set_size(f, len+lf*3+4, FALSE);
 
        o = f->outbuf;
-       inptr = in;
+       inptr = (unsigned char *)in;
        start = inptr;
        starto = o;
        while (inptr < inend) {
@@ -102,7 +102,7 @@ filter_run(CamelMimeFilter *f, char *in, size_t len, size_t prespace, char **out
                if (flags & CAMEL_MIME_FILTER_CANON_FROM && c == 'F') {
                        inptr++;
                        if (inptr < inend-4) {
-                               if (strncmp(inptr, "rom ", 4) == 0) {
+                               if (strncmp((char*)inptr, "rom ", 4) == 0) {
                                        strcpy(o, "=46rom ");
                                        inptr+=4;
                                        o+= 7;
@@ -153,7 +153,7 @@ filter_run(CamelMimeFilter *f, char *in, size_t len, size_t prespace, char **out
        if (last) {
                *outlen = o - f->outbuf;
        } else {
-               camel_mime_filter_backup(f, start, inend - start);
+               camel_mime_filter_backup(f, (const char*)start, inend - start);
                *outlen = starto - f->outbuf;
        }
 
index 48ea0ab..615e722 100644 (file)
@@ -38,7 +38,7 @@ typedef struct _CamelMimeFilterCanonClass CamelMimeFilterCanonClass;
 enum {
        CAMEL_MIME_FILTER_CANON_CRLF = (1<<0), /* canoncialise end of line to crlf, otherwise canonicalise to lf only */
        CAMEL_MIME_FILTER_CANON_FROM = (1<<1), /* escape "^From " using quoted-printable semantics into "=46rom " */
-       CAMEL_MIME_FILTER_CANON_STRIP = (1<<2), /* strip trailing space */
+       CAMEL_MIME_FILTER_CANON_STRIP = (1<<2)  /* strip trailing space */
 };
 
 struct _CamelMimeFilterCanon {
index eacbce9..cac48e5 100644 (file)
@@ -42,7 +42,7 @@ typedef enum {
 
 typedef enum {
        CAMEL_MIME_FILTER_CRLF_MODE_CRLF_DOTS,
-       CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY,
+       CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY
 } CamelMimeFilterCRLFMode;
 
 struct _CamelMimeFilterCRLF {
index 3726d2d..ccb9309 100644 (file)
@@ -43,7 +43,7 @@ enum {
        GZIP_FLAG_FCOMMENT  = (1 << 4),
        GZIP_FLAG_RESERVED0 = (1 << 5),
        GZIP_FLAG_RESERVED1 = (1 << 6),
-       GZIP_FLAG_RESERVED2 = (1 << 7),
+       GZIP_FLAG_RESERVED2 = (1 << 7)
 };
 
 #define GZIP_FLAG_RESERVED (GZIP_FLAG_RESERVED0 | GZIP_FLAG_RESERVED1 | GZIP_FLAG_RESERVED2)
@@ -185,18 +185,18 @@ gzip_filter (CamelMimeFilter *filter, char *in, size_t len, size_t prespace,
 
                memcpy (filter->outbuf, priv->hdr.buf, 10);
 
-               priv->stream->next_out = filter->outbuf + 10;
+               priv->stream->next_out = (Bytef *) filter->outbuf + 10;
                priv->stream->avail_out = filter->outsize - 10;
 
                priv->state.zip.wrote_hdr = TRUE;
        } else {
                camel_mime_filter_set_size (filter, (len * 2) + 12, FALSE);
 
-               priv->stream->next_out = filter->outbuf;
+               priv->stream->next_out = (Bytef *) filter->outbuf;
                priv->stream->avail_out = filter->outsize;
        }
 
-       priv->stream->next_in = in;
+       priv->stream->next_in = (Bytef *) in;
        priv->stream->avail_in = len;
 
        do {
@@ -210,7 +210,7 @@ gzip_filter (CamelMimeFilter *filter, char *in, size_t len, size_t prespace,
                        n = filter->outsize - priv->stream->avail_out;
                        camel_mime_filter_set_size (filter, n + (priv->stream->avail_in * 2) + 12, TRUE);
                        priv->stream->avail_out = filter->outsize - n;
-                       priv->stream->next_out = filter->outbuf + n;
+                       priv->stream->next_out = (Bytef *) filter->outbuf + n;
 
                        if (priv->stream->avail_in == 0) {
                                guint32 val;
@@ -229,13 +229,13 @@ gzip_filter (CamelMimeFilter *filter, char *in, size_t len, size_t prespace,
                        }
                } else {
                        if (priv->stream->avail_in > 0)
-                               camel_mime_filter_backup (filter, priv->stream->next_in, priv->stream->avail_in);
+                               camel_mime_filter_backup (filter, (const char *) priv->stream->next_in, priv->stream->avail_in);
 
                        break;
                }
        } while (1);
 
-       priv->crc32 = crc32 (priv->crc32, in, len - priv->stream->avail_in);
+       priv->crc32 = crc32 (priv->crc32, (unsigned char *) in, len - priv->stream->avail_in);
        priv->isize += len - priv->stream->avail_in;
 
        *out = filter->outbuf;
@@ -346,10 +346,10 @@ gunzip_filter (CamelMimeFilter *filter, char *in, size_t len, size_t prespace,
 
        camel_mime_filter_set_size (filter, (len * 2) + 12, FALSE);
 
-       priv->stream->next_in = in;
+       priv->stream->next_in = (Bytef *) in;
        priv->stream->avail_in = len - 8;
 
-       priv->stream->next_out = filter->outbuf;
+       priv->stream->next_out = (Bytef *) filter->outbuf;
        priv->stream->avail_out = filter->outsize;
 
        do {
@@ -368,12 +368,12 @@ gunzip_filter (CamelMimeFilter *filter, char *in, size_t len, size_t prespace,
                        n = filter->outsize - priv->stream->avail_out;
                        camel_mime_filter_set_size (filter, n + (priv->stream->avail_in * 2) + 12, TRUE);
                        priv->stream->avail_out = filter->outsize - n;
-                       priv->stream->next_out = filter->outbuf + n;
+                       priv->stream->next_out = (Bytef *) filter->outbuf + n;
                } else {
                        priv->stream->avail_in += 8;
 
                        if (priv->stream->avail_in > 0)
-                               camel_mime_filter_backup (filter, priv->stream->next_in, priv->stream->avail_in);
+                               camel_mime_filter_backup (filter, (char *) priv->stream->next_in, priv->stream->avail_in);
 
                        break;
                }
index 96e246b..0dd4ad0 100644 (file)
@@ -43,7 +43,7 @@ enum {
        PGP_PREFACE,
        PGP_HEADER,
        PGP_MESSAGE,
-       PGP_FOOTER,
+       PGP_FOOTER
 };
 
 static void
index 88494cf..226e1d8 100644 (file)
@@ -95,7 +95,7 @@ filter_filter (CamelMimeFilter *filter, char *in, size_t len, size_t prespace,
        case CAMEL_MIME_FILTER_YENC_DIRECTION_ENCODE:
                /* won't go to more than 2 * (x + 2) + 62 */
                camel_mime_filter_set_size (filter, (len + 2) * 2 + 62, FALSE);
-               newlen = camel_yencode_step (in, len, filter->outbuf, &yenc->state,
+               newlen = camel_yencode_step ((const unsigned char *) in, len, (unsigned char *) filter->outbuf, &yenc->state,
                                             &yenc->pcrc, &yenc->crc);
                g_assert (newlen <= (len + 2) * 2 + 62);
                break;
@@ -166,7 +166,7 @@ filter_filter (CamelMimeFilter *filter, char *in, size_t len, size_t prespace,
                if ((yenc->state & CAMEL_MIME_YDECODE_STATE_DECODE) && !(yenc->state & CAMEL_MIME_YDECODE_STATE_END)) {
                        /* all yEnc headers have been found so we can now start decoding */
                        camel_mime_filter_set_size (filter, len + 3, FALSE);
-                       newlen = camel_ydecode_step (in, len, filter->outbuf, &yenc->state, &yenc->pcrc, &yenc->crc);
+                       newlen = camel_ydecode_step ((const unsigned char *) in, len, (unsigned char *) filter->outbuf, &yenc->state, &yenc->pcrc, &yenc->crc);
                        g_assert (newlen <= len + 3);
                } else {
                        newlen = 0;
@@ -190,7 +190,7 @@ filter_complete (CamelMimeFilter *filter, char *in, size_t len, size_t prespace,
        case CAMEL_MIME_FILTER_YENC_DIRECTION_ENCODE:
                /* won't go to more than 2 * (x + 2) + 62 */
                camel_mime_filter_set_size (filter, (len + 2) * 2 + 62, FALSE);
-               newlen = camel_yencode_close (in, len, filter->outbuf, &yenc->state,
+               newlen = camel_yencode_close ((const unsigned char *) in, len, (unsigned char *) filter->outbuf, &yenc->state,
                                               &yenc->pcrc, &yenc->crc);
                g_assert (newlen <= (len + 2) * 2 + 62);
                break;
@@ -198,7 +198,7 @@ filter_complete (CamelMimeFilter *filter, char *in, size_t len, size_t prespace,
                if ((yenc->state & CAMEL_MIME_YDECODE_STATE_DECODE) && !(yenc->state & CAMEL_MIME_YDECODE_STATE_END)) {
                        /* all yEnc headers have been found so we can now start decoding */
                        camel_mime_filter_set_size (filter, len + 3, FALSE);
-                       newlen = camel_ydecode_step (in, len, filter->outbuf, &yenc->state,
+                       newlen = camel_ydecode_step ((const unsigned char *) in, len, (unsigned char *) filter->outbuf, &yenc->state,
                                                      &yenc->pcrc, &yenc->crc);
                        g_assert (newlen <= len + 3);
                } else {
index 6c1ac60..10e996e 100644 (file)
@@ -366,7 +366,7 @@ byte_array_to_string(GByteArray *array)
                return NULL;
 
        if (array->len == 0 || array->data[array->len-1] != '\0')
-               g_byte_array_append(array, "", 1);
+               g_byte_array_append(array, (guint8 *) "", 1);
 
        return (const char *) array->data;
 }
@@ -1039,7 +1039,7 @@ folder_scan_skip_line(struct _header_scan_state *s, GByteArray *save)
                }
 
                if (save)
-                       g_byte_array_append(save, s->inptr, inptr-s->inptr);
+                       g_byte_array_append(save, (guint8 *) s->inptr, inptr-s->inptr);
 
                s->inptr = inptr;
 
@@ -1438,7 +1438,7 @@ folder_scan_init(void)
        s->outptr = s->outbuf;
        s->outend = s->outbuf+1024;
 
-       s->realbuf = g_malloc(SCAN_BUF + SCAN_HEAD*2);
+       s->realbuf = g_malloc(SCAN_BUF + SCAN_HEAD*2);
        s->inbuf = s->realbuf + SCAN_HEAD;
        s->inptr = s->inbuf;
        s->inend = s->inbuf;
@@ -1712,11 +1712,11 @@ tail_recurse:
                                        if (h->prestage > 0) {
                                                if (h->posttext == NULL)
                                                        h->posttext = g_byte_array_new();
-                                               g_byte_array_append(h->posttext, *databuffer, *datalength);
+                                               g_byte_array_append(h->posttext, (guint8 *) *databuffer, *datalength);
                                        } else {
                                                if (h->pretext == NULL)
                                                        h->pretext = g_byte_array_new();
-                                               g_byte_array_append(h->pretext, *databuffer, *datalength);
+                                               g_byte_array_append(h->pretext, (guint8 *) *databuffer, *datalength);
                                        }
                                }
                        } while (hb==h && *datalength>0);
index f24b8e5..4588b3c 100644 (file)
@@ -59,7 +59,7 @@ typedef enum _camel_mime_parser_state_t {
        CAMEL_MIME_PARSER_STATE_HEADER_END,     /* dummy value */
        CAMEL_MIME_PARSER_STATE_BODY_END,       /* end of message */
        CAMEL_MIME_PARSER_STATE_MULTIPART_END,  /* end of multipart  */
-       CAMEL_MIME_PARSER_STATE_MESSAGE_END,    /* end of message */
+       CAMEL_MIME_PARSER_STATE_MESSAGE_END     /* end of message */
 } camel_mime_parser_state_t;
 
 struct _CamelMimeParser {
index c695fe0..fd7cf4b 100644 (file)
@@ -68,7 +68,7 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser
        buffer = g_byte_array_new ();
        while (camel_mime_parser_step (mp, &buf, &len) != CAMEL_MIME_PARSER_STATE_BODY_END) {
                d(printf("appending o/p data: %d: %.*s\n", len, len, buf));
-               g_byte_array_append (buffer, buf, len);
+               g_byte_array_append (buffer, (guint8 *) buf, len);
        }
 
        d(printf("message part kept in memory!\n"));
index 888931e..b22ca17 100644 (file)
@@ -341,7 +341,7 @@ free_headers (CamelMedium *medium, GArray *gheaders)
 void
 camel_mime_part_set_description (CamelMimePart *mime_part, const char *description)
 {
-       char *text = camel_header_encode_string (description);
+       char *text = camel_header_encode_string ((const unsigned char *) description);
 
        camel_medium_set_header (CAMEL_MEDIUM (mime_part),
                                 "Content-Description", text);
index caa567e..b20ec2a 100644 (file)
@@ -113,9 +113,9 @@ camel_base64_encode_close(unsigned char *in, size_t inlen, gboolean break_lines,
        gsize bytes = 0;
 
        if (inlen > 0)
-               bytes += g_base64_encode_step (in, inlen, break_lines, out, state, save);
+               bytes += g_base64_encode_step (in, inlen, break_lines, (gchar *) out, state, save);
 
-       bytes += g_base64_encode_close (break_lines, out, state, save);
+       bytes += g_base64_encode_close (break_lines, (gchar *) out, state, save);
 
        return bytes;
 }
@@ -140,7 +140,7 @@ camel_base64_encode_close(unsigned char *in, size_t inlen, gboolean break_lines,
 size_t
 camel_base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save)
 {
-       return g_base64_encode_step (in, len, break_lines, out, state, save);
+       return g_base64_encode_step (in, len, break_lines, (gchar *) out, state, save);
 }
 
 
@@ -159,7 +159,7 @@ camel_base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, un
 size_t
 camel_base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save)
 {
-       return g_base64_decode_step (in, len, out, state, save);
+       return g_base64_decode_step ((gchar *) in, len, out, state, save);
 }
 
 
@@ -175,7 +175,7 @@ camel_base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int
 char *
 camel_base64_encode_simple (const char *data, size_t len)
 {
-       return g_base64_encode (data, len);
+       return g_base64_encode ((const guchar *) data, len);
 }
 
 
@@ -857,13 +857,13 @@ rfc2047_decode_word(const char *in, size_t len)
                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;
                }
@@ -1205,7 +1205,7 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char *
                        else
                                *out++ = ' ';
                        out += sprintf (out, "=?%s?Q?", type);
-                       out += quoted_encode (buffer, enclen, out, safemask);
+                       out += quoted_encode ((unsigned char *) buffer, enclen, (unsigned char *) out, safemask);
                        sprintf (out, "?=");
 
                        d(printf("converted part = %s\n", ascii));
@@ -1239,7 +1239,7 @@ camel_header_encode_string (const unsigned char *in)
        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;
@@ -1251,7 +1251,7 @@ camel_header_encode_string (const unsigned char *in)
                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. */
@@ -1266,7 +1266,7 @@ camel_header_encode_string (const unsigned char *in)
                const char *newinptr;
 
                newinptr = g_utf8_next_char (inptr);
-               c = g_utf8_get_char (inptr);
+               c = g_utf8_get_char ((gchar *) 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));
@@ -1278,29 +1278,29 @@ camel_header_encode_string (const unsigned char *in)
                        /* 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 char *) 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;
                        }
@@ -1322,32 +1322,32 @@ camel_header_encode_string (const unsigned char *in)
                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;
                }
        }
@@ -1426,7 +1426,7 @@ header_encode_phrase_get_words (const unsigned char *in)
                const char *newinptr;
 
                newinptr = g_utf8_next_char (inptr);
-               c = g_utf8_get_char (inptr);
+               c = g_utf8_get_char ((gchar *) inptr);
 
                if (!g_unichar_validate (c)) {
                        w(g_warning ("Invalid UTF-8 sequence encountered (pos %d, char '%c'): %s",
@@ -1435,7 +1435,7 @@ header_encode_phrase_get_words (const unsigned char *in)
                        continue;
                }
 
-               inptr = newinptr;
+               inptr = (const unsigned char *) newinptr;
                if (g_unichar_isspace (c)) {
                        if (count > 0) {
                                word = g_new0 (struct _phrase_word, 1);
@@ -1571,28 +1571,28 @@ camel_header_encode_phrase (const unsigned char *in)
                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, (char *) 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, (char *) word->start, word->end - word->start);
                        break;
                case WORD_QSTRING:
-                       quote_word (out, TRUE, word->start, word->end - word->start);
+                       quote_word (out, TRUE, (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) {
@@ -1782,11 +1782,12 @@ camel_header_decode_int(const char **in)
 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) {
@@ -2033,12 +2034,14 @@ camel_header_param_list_free(struct _camel_header_param *p)
 CamelContentType *
 camel_content_type_new(const char *type, const char *subtype)
 {
-       CamelContentType *t = g_malloc(sizeof(*t));
+       CamelContentType *t;
 
+       t = g_slice_new (CamelContentType);
        t->type = g_strdup(type);
        t->subtype = g_strdup(subtype);
        t->params = NULL;
        t->refcount = 1;
+
        return t;
 }
 
@@ -2071,7 +2074,7 @@ camel_content_type_unref(CamelContentType *ct)
                        camel_header_param_list_free(ct->params);
                        g_free(ct->type);
                        g_free(ct->subtype);
-                       g_free(ct);
+                       g_slice_free (CamelContentType, ct);
                        ct = NULL;
                } else {
                        ct->refcount--;
@@ -3040,15 +3043,15 @@ header_encode_param (const unsigned char *in, gboolean *encoded)
 
        /* 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((char *) 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((char *) in);
        }
 
        /* FIXME: set the 'language' as well, assuming we can get that info...? */
@@ -3087,7 +3090,7 @@ camel_header_param_list_format_append (GString *out, struct _camel_header_param
                        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);
@@ -3608,7 +3611,7 @@ check_header(struct _camel_header_raw *h)
 {
        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));
@@ -4074,7 +4077,7 @@ header_address_list_encode_append (GString *out, int encode, struct _camel_heade
                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)
@@ -4086,7 +4089,7 @@ header_address_list_encode_append (GString *out, int encode, struct _camel_heade
                        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);
index 8167ebf..07fd0a7 100644 (file)
@@ -264,7 +264,7 @@ enum {
        CAMEL_MIME_IS_QPSAFE    = 1<<6,
        CAMEL_MIME_IS_ESAFE     = 1<<7, /* encoded word safe */
        CAMEL_MIME_IS_PSAFE     = 1<<8, /* encoded word in phrase safe */
-       CAMEL_MIME_IS_ATTRCHAR  = 1<<9, /* attribute-char safe (rfc2184) */
+       CAMEL_MIME_IS_ATTRCHAR  = 1<<9  /* attribute-char safe (rfc2184) */
 };
 
 extern unsigned short camel_mime_special_table[256];
index 5d15a36..a6d28b7 100644 (file)
@@ -39,7 +39,7 @@ typedef struct _CamelMultipartEncryptedClass CamelMultipartEncryptedClass;
 /* 'handy' enums for getting the internal parts of the multipart */
 enum {
        CAMEL_MULTIPART_ENCRYPTED_VERSION,
-       CAMEL_MULTIPART_ENCRYPTED_CONTENT,
+       CAMEL_MULTIPART_ENCRYPTED_CONTENT
 };
 
 struct _CamelMultipartEncrypted {
index b04a990..0d893da 100644 (file)
@@ -48,7 +48,7 @@ enum {
 /* 'handy' enums for getting the internal parts of the multipart */
 enum {
        CAMEL_MULTIPART_SIGNED_CONTENT,
-       CAMEL_MULTIPART_SIGNED_SIGNATURE,
+       CAMEL_MULTIPART_SIGNED_SIGNATURE
 };
 
 typedef struct _CamelMultipartSigned CamelMultipartSigned;
index 6dae3f2..9ea46af 100644 (file)
@@ -360,15 +360,15 @@ set_boundary (CamelMultipart *multipart, const char *boundary)
 
        if (!boundary) {
                /* Generate a fairly random boundary string. */
-               bgen = g_strdup_printf ("%p:%lu:%lu", multipart,
+               bgen = g_strdup_printf ("%p:%lu:%lu", (void *) multipart,
                                        (unsigned long) getpid(),
                                        (unsigned long) time(NULL));
-               md5_get_digest (bgen, strlen (bgen), digest);
+               md5_get_digest (bgen, strlen (bgen), (unsigned char *) digest);
                g_free (bgen);
                strcpy (bbuf, "=-");
                p = bbuf + 2;
                state = save = 0;
-               p += g_base64_encode_step (digest, 16, FALSE, p, &state, &save);
+               p += g_base64_encode_step ((guchar *) digest, 16, FALSE, p, &state, &save);
                *p = '\0';
 
                boundary = bbuf;
index 9b28b13..3e2e3ea 100644 (file)
@@ -684,9 +684,10 @@ camel_getaddrinfo(const char *name, const char *service, const struct addrinfo *
        msg->hostbufmem = g_malloc(msg->hostbuflen);
 #endif
        if (cs_waitinfo(cs_getaddrinfo, msg, _("Host lookup failed"), ex) == 0) {
-               if (msg->result != 0)
+               if (msg->result != 0) {
                        camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Host lookup failed: %s: %s"),
                                              name, gai_strerror (msg->result));
+               }
 
                cs_freeinfo(msg);
        } else
index ced8f81..d5488ef 100644 (file)
@@ -134,19 +134,12 @@ static void camel_object_bag_remove_unlocked(CamelObjectBag *inbag, CamelObject
 
 /* ********************************************************************** */
 
-static pthread_mutex_t chunks_lock = PTHREAD_MUTEX_INITIALIZER;
-
-static EMemChunk *pair_chunks;
-static EMemChunk *hook_chunks;
-static unsigned int pair_id = 1;
-
 /* type-lock must be recursive, for atomically creating classes */
 static GStaticRecMutex type_lock = G_STATIC_REC_MUTEX_INIT;
 /* ref-lock must be global :-(  for object bags to work */
 static GMutex *ref_lock;
 
 static GHashTable *type_table;
-static EMemChunk *type_chunks;
 
 /* fundamental types are accessed via global */
 CamelType camel_object_type;
@@ -164,14 +157,17 @@ CamelType camel_interface_type;
 static struct _CamelHookPair *
 pair_alloc(void)
 {
+       static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+       static guint next_id = 1;
        CamelHookPair *pair;
 
-       P_LOCK(chunks_lock);
-       pair = e_memchunk_alloc(pair_chunks);
-       pair->id = pair_id++;
-       if (pair_id == 0)
-               pair_id = 1;
-       P_UNLOCK(chunks_lock);
+       pair = g_slice_new (CamelHookPair);
+
+       g_static_mutex_lock (&mutex);
+       pair->id = next_id++;
+       if (next_id == 0)
+               next_id = 1;
+       g_static_mutex_unlock (&mutex);
 
        return pair;
 }
@@ -179,33 +175,19 @@ pair_alloc(void)
 static void
 pair_free(CamelHookPair *pair)
 {
-       g_assert(pair_chunks != NULL);
-
-       P_LOCK(chunks_lock);
-       e_memchunk_free(pair_chunks, pair);
-       P_UNLOCK(chunks_lock);
+       g_slice_free (CamelHookPair, pair);
 }
 
 static struct _CamelHookList *
 hooks_alloc(void)
 {
-       CamelHookList *hooks;
-
-       P_LOCK(chunks_lock);
-       hooks = e_memchunk_alloc(hook_chunks);
-       P_UNLOCK(chunks_lock);
-
-       return hooks;
+       return g_slice_new0 (CamelHookList);
 }
 
 static void
 hooks_free(CamelHookList *hooks)
 {
-       g_assert(hook_chunks != NULL);
-
-       P_LOCK(chunks_lock);
-       e_memchunk_free(hook_chunks, hooks);
-       P_UNLOCK(chunks_lock);
+       g_slice_free (CamelHookList, hooks);
 }
 
 /* not checked locked, who cares, only required for people that want to redefine root objects */
@@ -218,9 +200,6 @@ camel_type_init(void)
                return;
 
        init = TRUE;
-       pair_chunks = e_memchunk_new(16, sizeof(CamelHookPair));
-       hook_chunks = e_memchunk_new(16, sizeof(CamelHookList));
-       type_chunks = e_memchunk_new(32, sizeof(CamelType));
        type_table = g_hash_table_new(NULL, NULL);
        ref_lock = g_mutex_new();
 }
@@ -478,7 +457,7 @@ cobject_state_read(CamelObject *obj, FILE *fp)
                        switch(argv->argv[argv->argc].tag & CAMEL_ARG_TYPE) {
                        case CAMEL_ARG_INT:
                        case CAMEL_ARG_BOO:
-                               if (camel_file_util_decode_uint32(fp, &argv->argv[argv->argc].ca_int) == -1)
+                               if (camel_file_util_decode_uint32(fp, (guint32 *) &argv->argv[argv->argc].ca_int) == -1)
                                        goto cleanup;
                                break;
                        case CAMEL_ARG_STR:
@@ -754,7 +733,7 @@ co_type_register(CamelType parent, const char * name,
 
        size = offset + klass_size;
 
-       klass = g_malloc0(size);
+       klass = g_slice_alloc0(size);
 
        klass->klass_size = size;
        klass->klass_data = offset;
@@ -772,11 +751,11 @@ co_type_register(CamelType parent, const char * name,
                return NULL;
        }
 
-       klass = g_malloc0(klass_size);
+       klass = g_slice_alloc (klass_size);
        klass->klass_size = klass_size;
        klass->object_size = object_size;
        klass->lock = g_mutex_new();
-       klass->instance_chunks = e_memchunk_new(8, object_size);
+       klass->hooks = NULL;
 
        klass->parent = parent;
        if (parent) {
@@ -858,7 +837,7 @@ camel_object_new(CamelType type)
 
        CLASS_LOCK(type);
 
-       o = e_memchunk_alloc0(type->instance_chunks);
+       o = g_slice_alloc0 (type->object_size);
 
 #ifdef CAMEL_OBJECT_TRACK_INSTANCES
        if (type->instances)
@@ -950,7 +929,7 @@ camel_object_unref(void *vo)
        if (o->next)
                o->next->prev = o->prev;
 #endif
-       e_memchunk_free(klass->instance_chunks, o);
+       g_slice_free1 (klass->object_size, o);
        CLASS_UNLOCK(klass);
 }
 
@@ -1097,7 +1076,7 @@ camel_object_cast(CamelObject *o, CamelType ctype)
                k = k->parent;
        }
 
-       g_warning("Object %p (class '%s') doesn't have '%s' in its hierarchy", o, o->klass->name, ctype->name);
+       g_warning("Object %p (class '%s') doesn't have '%s' in its hierarchy", (void *) o, o->klass->name, ctype->name);
 
        return NULL;
 }
@@ -1442,7 +1421,7 @@ camel_object_unhook_event(void *vo, const char * name, CamelObjectEventHookFunc
        camel_object_unget_hooks(obj);
 
        g_warning("camel_object_unhook_event: cannot find hook/data pair %p/%p in an instance of `%s' attached to `%s'",
-                 func, data, obj->klass->name, name);
+                 (void *) func, data, obj->klass->name, name);
 }
 
 void
@@ -1489,6 +1468,7 @@ trigger:
        /* also, no hooks, dont bother going further */
        if (obj->hooks == NULL)
                return;
+
 trigger_interface:
        /* lock the object for hook emission */
        camel_object_ref(obj);
@@ -1922,10 +1902,11 @@ object_class_dump_tree_rec(CamelType root, int depth)
                        CamelHookPair *pair = root->hooks;
 
                        while (pair) {
-                               printf("%s  event '%s' prep %p\n", p, pair->name, pair->func.prep);
+                               printf("%s  event '%s' prep %p\n", p, pair->name, (void *) pair->func.prep);
                                pair = pair->next;
                        }
                }
+
 #ifdef CAMEL_OBJECT_TRACK_INSTANCES
                o = root->instances;
                while (o) {
index 345f259..61be690 100644 (file)
@@ -89,7 +89,7 @@ enum {
        CAMEL_OBJECT_ARG_DESCRIPTION = CAMEL_ARG_FIRST, /* Get a copy of the meta-data list (should be freed) */
        CAMEL_OBJECT_ARG_METADATA,
        CAMEL_OBJECT_ARG_STATE_FILE,
-       CAMEL_OBJECT_ARG_PERSISTENT_PROPERTIES,
+       CAMEL_OBJECT_ARG_PERSISTENT_PROPERTIES
 };
 
 enum {
@@ -99,11 +99,11 @@ enum {
        /* sets where the persistent data should reside, otherwise it isn't persistent */
        CAMEL_OBJECT_STATE_FILE = CAMEL_OBJECT_ARG_STATE_FILE | CAMEL_ARG_STR,
        /* returns a GSList CamelProperties of persistent properties */
-       CAMEL_OBJECT_PERSISTENT_PROPERTIES = CAMEL_OBJECT_ARG_PERSISTENT_PROPERTIES | CAMEL_ARG_PTR,
+       CAMEL_OBJECT_PERSISTENT_PROPERTIES = CAMEL_OBJECT_ARG_PERSISTENT_PROPERTIES | CAMEL_ARG_PTR
 };
 
 typedef enum _CamelObjectFlags {
-       CAMEL_OBJECT_DESTROY = (1<<0),
+       CAMEL_OBJECT_DESTROY = (1<<0)
 } CamelObjectFlags;
 
 /* returned by get::CAMEL_OBJECT_METADATA */
index b0f6371..9621562 100644 (file)
@@ -42,7 +42,7 @@ enum {
 };
 
 enum {
-       CAMEL_OFFLINE_FOLDER_SYNC_OFFLINE = CAMEL_OFFLINE_FOLDER_ARG_SYNC_OFFLINE | CAMEL_ARG_BOO,
+       CAMEL_OFFLINE_FOLDER_SYNC_OFFLINE = CAMEL_OFFLINE_FOLDER_ARG_SYNC_OFFLINE | CAMEL_ARG_BOO
 };
 
 struct _CamelOfflineFolder {
index 8482b40..c155aaa 100644 (file)
@@ -39,12 +39,12 @@ typedef struct _CamelOfflineStore CamelOfflineStore;
 typedef struct _CamelOfflineStoreClass CamelOfflineStoreClass;
 
 enum {
-       CAMEL_OFFLINE_STORE_ARG_FIRST  = CAMEL_STORE_ARG_FIRST + 100,
+       CAMEL_OFFLINE_STORE_ARG_FIRST  = CAMEL_STORE_ARG_FIRST + 100
 };
 
 enum {
        CAMEL_OFFLINE_STORE_NETWORK_AVAIL,
-       CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL,
+       CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL
 };
 
 struct _CamelOfflineStore {
index 46cb46d..3f2080f 100644 (file)
@@ -32,7 +32,7 @@ typedef void (*CamelOperationStatusFunc)(struct _CamelOperation *op, const char
 
 typedef enum _camel_operation_status_t {
        CAMEL_OPERATION_START = -1,
-       CAMEL_OPERATION_END = -2,
+       CAMEL_OPERATION_END = -2
 } camel_operation_status_t;
 
 /* main thread functions */
index c09b03c..b302dd9 100644 (file)
@@ -44,13 +44,13 @@ struct _CamelFolderPrivate {
 };
 
 #define CAMEL_FOLDER_LOCK(f, l) \
-       (g_static_mutex_lock(&((CamelFolder *)f)->priv->l))
+       (g_static_mutex_lock(&((CamelFolder *) (f))->priv->l))
 #define CAMEL_FOLDER_UNLOCK(f, l) \
-       (g_static_mutex_unlock(&((CamelFolder *)f)->priv->l))
+       (g_static_mutex_unlock(&((CamelFolder *) (f))->priv->l))
 #define CAMEL_FOLDER_REC_LOCK(f, l) \
-       (g_static_rec_mutex_lock(&((CamelFolder *)f)->priv->l))
+       (g_static_rec_mutex_lock(&((CamelFolder *) (f))->priv->l))
 #define CAMEL_FOLDER_REC_UNLOCK(f, l) \
-       (g_static_rec_mutex_unlock(&((CamelFolder *)f)->priv->l))
+       (g_static_rec_mutex_unlock(&((CamelFolder *) (f))->priv->l))
 
 
 struct _CamelStorePrivate {
@@ -58,17 +58,19 @@ struct _CamelStorePrivate {
 };
 
 #define CAMEL_STORE_LOCK(f, l) \
-       (g_static_rec_mutex_lock(&((CamelStore *)f)->priv->l))
+       (g_static_rec_mutex_lock(&((CamelStore *) (f))->priv->l))
 #define CAMEL_STORE_UNLOCK(f, l) \
-       (g_static_rec_mutex_unlock(&((CamelStore *)f)->priv->l))
+       (g_static_rec_mutex_unlock(&((CamelStore *) (f))->priv->l))
 
 
 struct _CamelTransportPrivate {
        GMutex *send_lock;   /* for locking send operations */
 };
 
-#define CAMEL_TRANSPORT_LOCK(f, l) (g_mutex_lock(((CamelTransport *)f)->priv->l))
-#define CAMEL_TRANSPORT_UNLOCK(f, l) (g_mutex_unlock(((CamelTransport *)f)->priv->l))
+#define CAMEL_TRANSPORT_LOCK(f, l) \
+       (g_mutex_lock(((CamelTransport *) (f))->priv->l))
+#define CAMEL_TRANSPORT_UNLOCK(f, l) \
+       (g_mutex_unlock(((CamelTransport *) (f))->priv->l))
 
 
 struct _CamelServicePrivate {
@@ -77,13 +79,15 @@ struct _CamelServicePrivate {
 };
 
 #define CAMEL_SERVICE_LOCK(f, l) \
-       (g_static_mutex_lock(&((CamelService *)f)->priv->l))
+       (g_static_mutex_lock(&((CamelService *) (f))->priv->l))
 #define CAMEL_SERVICE_UNLOCK(f, l) \
-       (g_static_mutex_unlock(&((CamelService *)f)->priv->l))
+       (g_static_mutex_unlock(&((CamelService *) (f))->priv->l))
 #define CAMEL_SERVICE_REC_LOCK(f, l) \
-       (g_static_rec_mutex_lock(&((CamelService *)f)->priv->l))
+       (g_static_rec_mutex_lock(&((CamelService *) (f))->priv->l))
 #define CAMEL_SERVICE_REC_UNLOCK(f, l) \
-       (g_static_rec_mutex_unlock(&((CamelService *)f)->priv->l))
+       (g_static_rec_mutex_unlock(&((CamelService *) (f))->priv->l))
+#define CAMEL_SERVICE_REC_TRYLOCK(f, l) \
+       (g_static_rec_mutex_trylock(&((CamelService *) (f))->priv->l))
 
 
 struct _CamelSessionPrivate {
@@ -97,8 +101,10 @@ struct _CamelSessionPrivate {
        GHashTable *thread_msg_op;
 };
 
-#define CAMEL_SESSION_LOCK(f, l) (g_mutex_lock(((CamelSession *)f)->priv->l))
-#define CAMEL_SESSION_UNLOCK(f, l) (g_mutex_unlock(((CamelSession *)f)->priv->l))
+#define CAMEL_SESSION_LOCK(f, l) \
+       (g_mutex_lock(((CamelSession *) (f))->priv->l))
+#define CAMEL_SESSION_UNLOCK(f, l) \
+       (g_mutex_unlock(((CamelSession *) (f))->priv->l))
 
 
 /* most of this stuff really is private, but the lock can be used by subordinate classes */
@@ -123,8 +129,10 @@ struct _CamelFolderSummaryPrivate {
        GMutex *ref_lock;       /* for reffing/unreffing messageinfo's ALWAYS obtain before summary_lock */
 };
 
-#define CAMEL_SUMMARY_LOCK(f, l) (g_mutex_lock(((CamelFolderSummary *)f)->priv->l))
-#define CAMEL_SUMMARY_UNLOCK(f, l) (g_mutex_unlock(((CamelFolderSummary *)f)->priv->l))
+#define CAMEL_SUMMARY_LOCK(f, l) \
+       (g_mutex_lock(((CamelFolderSummary *) (f))->priv->l))
+#define CAMEL_SUMMARY_UNLOCK(f, l) \
+       (g_mutex_unlock(((CamelFolderSummary *) (f))->priv->l))
 
 
 struct _CamelStoreSummaryPrivate {
@@ -134,8 +142,10 @@ struct _CamelStoreSummaryPrivate {
        GMutex *ref_lock;       /* for reffing/unreffing messageinfo's ALWAYS obtain before summary_lock */
 };
 
-#define CAMEL_STORE_SUMMARY_LOCK(f, l) (g_mutex_lock(((CamelStoreSummary *)f)->priv->l))
-#define CAMEL_STORE_SUMMARY_UNLOCK(f, l) (g_mutex_unlock(((CamelStoreSummary *)f)->priv->l))
+#define CAMEL_STORE_SUMMARY_LOCK(f, l) \
+       (g_mutex_lock(((CamelStoreSummary *) (f))->priv->l))
+#define CAMEL_STORE_SUMMARY_UNLOCK(f, l) \
+       (g_mutex_unlock(((CamelStoreSummary *) (f))->priv->l))
 
 
 struct _CamelVeeFolderPrivate {
@@ -147,16 +157,20 @@ struct _CamelVeeFolderPrivate {
        GMutex *changed_lock;           /* for locking the folders-changed list */
 };
 
-#define CAMEL_VEE_FOLDER_LOCK(f, l) (g_mutex_lock(((CamelVeeFolder *)f)->priv->l))
-#define CAMEL_VEE_FOLDER_UNLOCK(f, l) (g_mutex_unlock(((CamelVeeFolder *)f)->priv->l))
+#define CAMEL_VEE_FOLDER_LOCK(f, l) \
+       (g_mutex_lock(((CamelVeeFolder *) (f))->priv->l))
+#define CAMEL_VEE_FOLDER_UNLOCK(f, l) \
+       (g_mutex_unlock(((CamelVeeFolder *) (f))->priv->l))
 
 
 struct _CamelDataWrapperPrivate {
        pthread_mutex_t stream_lock;
 };
 
-#define CAMEL_DATA_WRAPPER_LOCK(dw, l)   (pthread_mutex_lock(&((CamelDataWrapper *)dw)->priv->l))
-#define CAMEL_DATA_WRAPPER_UNLOCK(dw, l) (pthread_mutex_unlock(&((CamelDataWrapper *)dw)->priv->l))
+#define CAMEL_DATA_WRAPPER_LOCK(dw, l) \
+       (pthread_mutex_lock(&((CamelDataWrapper *) (dw))->priv->l))
+#define CAMEL_DATA_WRAPPER_UNLOCK(dw, l) \
+       (pthread_mutex_unlock(&((CamelDataWrapper *) (dw))->priv->l))
 
 
 /* most of this stuff really is private, but the lock can be used by subordinate classes */
@@ -167,8 +181,10 @@ struct _CamelCertDBPrivate {
        GMutex *ref_lock;       /* for reffing/unreffing certs */
 };
 
-#define CAMEL_CERTDB_LOCK(db, l) (g_mutex_lock (((CamelCertDB *) db)->priv->l))
-#define CAMEL_CERTDB_UNLOCK(db, l) (g_mutex_unlock (((CamelCertDB *) db)->priv->l))
+#define CAMEL_CERTDB_LOCK(db, l) \
+       (g_mutex_lock (((CamelCertDB *) (db))->priv->l))
+#define CAMEL_CERTDB_UNLOCK(db, l) \
+       (g_mutex_unlock (((CamelCertDB *) (db))->priv->l))
 
 #ifdef G_OS_WIN32
 int fsync (int fd);
index 2f31e8f..efbbade 100644 (file)
@@ -137,7 +137,7 @@ anon_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
                }
                camel_object_unref (cia);
                ret = g_byte_array_new ();
-               g_byte_array_append (ret, sasl_anon->trace_info, strlen (sasl_anon->trace_info));
+               g_byte_array_append (ret, (guint8 *) sasl_anon->trace_info, strlen (sasl_anon->trace_info));
                break;
        case CAMEL_SASL_ANON_TRACE_OPAQUE:
                if (strchr (sasl_anon->trace_info, '@')) {
@@ -147,7 +147,7 @@ anon_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
                        return NULL;
                }
                ret = g_byte_array_new ();
-               g_byte_array_append (ret, sasl_anon->trace_info, strlen (sasl_anon->trace_info));
+               g_byte_array_append (ret, (guint8 *) sasl_anon->trace_info, strlen (sasl_anon->trace_info));
                break;
        case CAMEL_SASL_ANON_TRACE_EMPTY:
                ret = g_byte_array_new ();
index 3c26b8c..b0a1f75 100644 (file)
@@ -134,12 +134,12 @@ cram_md5_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
 
        /* lowercase hexify that bad-boy... */
        for (s = digest, p = md5asc; p < md5asc + 32; s++, p += 2)
-               sprintf (p, "%.2x", *s);
+               sprintf ((char *) p, "%.2x", *s);
 
        ret = g_byte_array_new ();
-       g_byte_array_append (ret, sasl->service->url->user, strlen (sasl->service->url->user));
-       g_byte_array_append (ret, " ", 1);
-       g_byte_array_append (ret, md5asc, 32);
+       g_byte_array_append (ret, (guint8 *) sasl->service->url->user, strlen (sasl->service->url->user));
+       g_byte_array_append (ret, (guint8 *) " ", 1);
+       g_byte_array_append (ret, (guint8 *) md5asc, 32);
 
        sasl->authenticated = TRUE;
 
index 00bf813..b61c8f0 100644 (file)
@@ -546,7 +546,7 @@ digest_hex (guchar *digest, guchar hex[33])
 
        /* lowercase hexify that bad-boy... */
        for (s = digest, p = hex; p < hex + 32; s++, p += 2)
-               sprintf (p, "%.2x", *s);
+               sprintf ((char *) p, "%.2x", *s);
 }
 
 static char *
@@ -568,22 +568,22 @@ compute_response (struct _DigestResponse *resp, const char *passwd, gboolean cli
 
        /* compute A1 */
        md5_init (&ctx);
-       md5_update (&ctx, resp->username, strlen (resp->username));
-       md5_update (&ctx, ":", 1);
-       md5_update (&ctx, resp->realm, strlen (resp->realm));
-       md5_update (&ctx, ":", 1);
-       md5_update (&ctx, passwd, strlen (passwd));
+       md5_update (&ctx, (const guchar *) resp->username, strlen (resp->username));
+       md5_update (&ctx, (const guchar *) ":", 1);
+       md5_update (&ctx, (const guchar *) resp->realm, strlen (resp->realm));
+       md5_update (&ctx, (const guchar *) ":", 1);
+       md5_update (&ctx, (const guchar *) passwd, strlen (passwd));
        md5_final (&ctx, digest);
 
        md5_init (&ctx);
        md5_update (&ctx, digest, 16);
-       md5_update (&ctx, ":", 1);
-       md5_update (&ctx, resp->nonce, strlen (resp->nonce));
-       md5_update (&ctx, ":", 1);
-       md5_update (&ctx, resp->cnonce, strlen (resp->cnonce));
+       md5_update (&ctx, (const guchar *) ":", 1);
+       md5_update (&ctx, (const guchar *) resp->nonce, strlen (resp->nonce));
+       md5_update (&ctx, (const guchar *) ":", 1);
+       md5_update (&ctx, (const guchar *) resp->cnonce, strlen (resp->cnonce));
        if (resp->authzid) {
-               md5_update (&ctx, ":", 1);
-               md5_update (&ctx, resp->authzid, strlen (resp->authzid));
+               md5_update (&ctx, (const guchar *) ":", 1);
+               md5_update (&ctx, (const guchar *) resp->authzid, strlen (resp->authzid));
        }
 
        /* hexify A1 */
@@ -594,18 +594,18 @@ compute_response (struct _DigestResponse *resp, const char *passwd, gboolean cli
        md5_init (&ctx);
        if (client) {
                /* we are calculating the client response */
-               md5_update (&ctx, "AUTHENTICATE:", strlen ("AUTHENTICATE:"));
+               md5_update (&ctx, (const guchar *) "AUTHENTICATE:", strlen ("AUTHENTICATE:"));
        } else {
                /* we are calculating the server rspauth */
-               md5_update (&ctx, ":", 1);
+               md5_update (&ctx, (const guchar *) ":", 1);
        }
 
        buf = digest_uri_to_string (resp->uri);
-       md5_update (&ctx, buf, strlen (buf));
+       md5_update (&ctx, (const guchar *) buf, strlen (buf));
        g_free (buf);
 
        if (resp->qop == QOP_AUTH_INT || resp->qop == QOP_AUTH_CONF)
-               md5_update (&ctx, ":00000000000000000000000000000000", 33);
+               md5_update (&ctx, (const guchar *) ":00000000000000000000000000000000", 33);
 
        /* now hexify A2 */
        md5_final (&ctx, digest);
@@ -613,17 +613,17 @@ compute_response (struct _DigestResponse *resp, const char *passwd, gboolean cli
 
        /* compute KD */
        md5_init (&ctx);
-       md5_update (&ctx, hex_a1, 32);
-       md5_update (&ctx, ":", 1);
-       md5_update (&ctx, resp->nonce, strlen (resp->nonce));
-       md5_update (&ctx, ":", 1);
-       md5_update (&ctx, resp->nc, 8);
-       md5_update (&ctx, ":", 1);
-       md5_update (&ctx, resp->cnonce, strlen (resp->cnonce));
-       md5_update (&ctx, ":", 1);
-       md5_update (&ctx, qop_to_string (resp->qop), strlen (qop_to_string (resp->qop)));
-       md5_update (&ctx, ":", 1);
-       md5_update (&ctx, hex_a2, 32);
+       md5_update (&ctx, (const guchar *) hex_a1, 32);
+       md5_update (&ctx, (const guchar *) ":", 1);
+       md5_update (&ctx, (const guchar *) resp->nonce, strlen (resp->nonce));
+       md5_update (&ctx, (const guchar *) ":", 1);
+       md5_update (&ctx, (const guchar *) resp->nc, 8);
+       md5_update (&ctx, (const guchar *) ":", 1);
+       md5_update (&ctx, (const guchar *) resp->cnonce, strlen (resp->cnonce));
+       md5_update (&ctx, (const guchar *) ":", 1);
+       md5_update (&ctx, (const guchar *) qop_to_string (resp->qop), strlen (qop_to_string (resp->qop)));
+       md5_update (&ctx, (const guchar *) ":", 1);
+       md5_update (&ctx, (const guchar *) hex_a2, 32);
        md5_final (&ctx, digest);
 
        digest_hex (digest, out);
@@ -648,13 +648,13 @@ generate_response (struct _DigestChallenge *challenge, const char *host,
        resp->nonce = g_strdup (challenge->nonce);
 
        /* generate the cnonce */
-       bgen = g_strdup_printf ("%p:%lu:%lu", resp,
+       bgen = g_strdup_printf ("%p:%lu:%lu", (void *) resp,
                                (unsigned long) getpid (),
                                (unsigned long) time (NULL));
-       md5_get_digest (bgen, strlen (bgen), digest);
+       md5_get_digest (bgen, strlen (bgen), (guchar *) digest);
        g_free (bgen);
        /* take our recommended 64 bits of entropy */
-       resp->cnonce = g_base64_encode (digest, 8);
+       resp->cnonce = g_base64_encode ((guchar *) digest, 8);
 
        /* we don't support re-auth so the nonce count is always 1 */
        strcpy (resp->nc, "00000001");
@@ -688,7 +688,7 @@ generate_response (struct _DigestChallenge *challenge, const char *host,
        /* we don't really care about this... */
        resp->authzid = NULL;
 
-       compute_response (resp, passwd, TRUE, resp->resp);
+       compute_response (resp, passwd, TRUE, (guchar *) resp->resp);
 
        return resp;
 }
@@ -701,7 +701,7 @@ digest_response (struct _DigestResponse *resp)
        char *buf;
 
        buffer = g_byte_array_new ();
-       g_byte_array_append (buffer, "username=\"", 10);
+       g_byte_array_append (buffer, (guint8 *) "username=\"", 10);
        if (resp->charset) {
                /* Encode the username using the requested charset */
                char *username, *outbuf;
@@ -734,61 +734,61 @@ digest_response (struct _DigestResponse *resp)
                if (cd != (iconv_t) -1)
                        e_iconv_close (cd);
 
-               g_byte_array_append (buffer, username, strlen (username));
+               g_byte_array_append (buffer, (guint8 *) username, strlen (username));
                g_free (username);
        } else {
-               g_byte_array_append (buffer, resp->username, strlen (resp->username));
+               g_byte_array_append (buffer, (guint8 *) resp->username, strlen (resp->username));
        }
 
-       g_byte_array_append (buffer, "\",realm=\"", 9);
-       g_byte_array_append (buffer, resp->realm, strlen (resp->realm));
+       g_byte_array_append (buffer, (guint8 *) "\",realm=\"", 9);
+       g_byte_array_append (buffer, (guint8 *) resp->realm, strlen (resp->realm));
 
-       g_byte_array_append (buffer, "\",nonce=\"", 9);
-       g_byte_array_append (buffer, resp->nonce, strlen (resp->nonce));
+       g_byte_array_append (buffer, (guint8 *) "\",nonce=\"", 9);
+       g_byte_array_append (buffer, (guint8 *) resp->nonce, strlen (resp->nonce));
 
-       g_byte_array_append (buffer, "\",cnonce=\"", 10);
-       g_byte_array_append (buffer, resp->cnonce, strlen (resp->cnonce));
+       g_byte_array_append (buffer, (guint8 *) "\",cnonce=\"", 10);
+       g_byte_array_append (buffer, (guint8 *) resp->cnonce, strlen (resp->cnonce));
 
-       g_byte_array_append (buffer, "\",nc=", 5);
-       g_byte_array_append (buffer, resp->nc, 8);
+       g_byte_array_append (buffer, (guint8 *) "\",nc=", 5);
+       g_byte_array_append (buffer, (guint8 *) resp->nc, 8);
 
-       g_byte_array_append (buffer, ",qop=", 5);
+       g_byte_array_append (buffer, (guint8 *) ",qop=", 5);
        str = qop_to_string (resp->qop);
-       g_byte_array_append (buffer, str, strlen (str));
+       g_byte_array_append (buffer, (guint8 *) str, strlen (str));
 
-       g_byte_array_append (buffer, ",digest-uri=\"", 13);
+       g_byte_array_append (buffer, (guint8 *) ",digest-uri=\"", 13);
        buf = digest_uri_to_string (resp->uri);
-       g_byte_array_append (buffer, buf, strlen (buf));
+       g_byte_array_append (buffer, (guint8 *) buf, strlen (buf));
        g_free (buf);
 
-       g_byte_array_append (buffer, "\",response=", 11);
-       g_byte_array_append (buffer, resp->resp, 32);
+       g_byte_array_append (buffer, (guint8 *) "\",response=", 11);
+       g_byte_array_append (buffer, (guint8 *) resp->resp, 32);
 
        if (resp->maxbuf > 0) {
-               g_byte_array_append (buffer, ",maxbuf=", 8);
+               g_byte_array_append (buffer, (guint8 *) ",maxbuf=", 8);
                buf = g_strdup_printf ("%u", resp->maxbuf);
-               g_byte_array_append (buffer, buf, strlen (buf));
+               g_byte_array_append (buffer, (guint8 *) buf, strlen (buf));
                g_free (buf);
        }
 
        if (resp->charset) {
-               g_byte_array_append (buffer, ",charset=", 9);
-               g_byte_array_append (buffer, resp->charset, strlen (resp->charset));
+               g_byte_array_append (buffer, (guint8 *) ",charset=", 9);
+               g_byte_array_append (buffer, (guint8 *) resp->charset, strlen ((char *) resp->charset));
        }
 
        if (resp->cipher != CIPHER_INVALID) {
                str = cipher_to_string (resp->cipher);
                if (str) {
-                       g_byte_array_append (buffer, ",cipher=\"", 9);
-                       g_byte_array_append (buffer, str, strlen (str));
-                       g_byte_array_append (buffer, "\"", 1);
+                       g_byte_array_append (buffer, (guint8 *) ",cipher=\"", 9);
+                       g_byte_array_append (buffer, (guint8 *) str, strlen (str));
+                       g_byte_array_append (buffer, (guint8 *) "\"", 1);
                }
        }
 
        if (resp->authzid) {
-               g_byte_array_append (buffer, ",authzid=\"", 10);
-               g_byte_array_append (buffer, resp->authzid, strlen (resp->authzid));
-               g_byte_array_append (buffer, "\"", 1);
+               g_byte_array_append (buffer, (guint8 *) ",authzid=\"", 10);
+               g_byte_array_append (buffer, (guint8 *) resp->authzid, strlen (resp->authzid));
+               g_byte_array_append (buffer, (guint8 *) "\"", 1);
        }
 
        return buffer;
@@ -821,7 +821,7 @@ digest_md5_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
                        return NULL;
                }
 
-               tokens = g_strndup (token->data, token->len);
+               tokens = g_strndup ((gchar *) token->data, token->len);
                priv->challenge = parse_server_challenge (tokens, &abort);
                g_free (tokens);
                if (!priv->challenge || abort) {
@@ -855,7 +855,7 @@ digest_md5_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
                break;
        case STATE_FINAL:
                if (token->len)
-                       tokens = g_strndup (token->data, token->len);
+                       tokens = g_strndup ((gchar *) token->data, token->len);
                else
                        tokens = NULL;
 
index 9a9deb4..4f8b5e1 100644 (file)
@@ -121,11 +121,11 @@ login_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
        switch (priv->state) {
        case LOGIN_USER:
                buf = g_byte_array_new ();
-               g_byte_array_append (buf, url->user, strlen (url->user));
+               g_byte_array_append (buf, (guint8 *) url->user, strlen (url->user));
                break;
        case LOGIN_PASSWD:
                buf = g_byte_array_new ();
-               g_byte_array_append (buf, url->passwd, strlen (url->passwd));
+               g_byte_array_append (buf, (guint8 *) url->passwd, strlen (url->passwd));
 
                sasl->authenticated = TRUE;
                break;
index 9fe1853..f64c54b 100644 (file)
@@ -105,15 +105,15 @@ ntlm_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
        ret = g_byte_array_new ();
 
        if (!token || !token->len) {
-               g_byte_array_append (ret, NTLM_REQUEST,
+               g_byte_array_append (ret, (guint8 *) NTLM_REQUEST,
                                     sizeof (NTLM_REQUEST) - 1);
                return ret;
        }
 
        memcpy (nonce, token->data + NTLM_CHALLENGE_NONCE_OFFSET, 8);
-       ntlm_lanmanager_hash (sasl->service->url->passwd, hash);
+       ntlm_lanmanager_hash (sasl->service->url->passwd, (char *) hash);
        ntlm_calc_response (hash, nonce, lm_resp);
-       ntlm_nt_hash (sasl->service->url->passwd, hash);
+       ntlm_nt_hash (sasl->service->url->passwd, (char *) hash);
        ntlm_calc_response (hash, nonce, nt_resp);
 
        ret = g_byte_array_new ();
@@ -125,17 +125,17 @@ ntlm_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
                NTLM_RESPONSE_FLAGS, sizeof (NTLM_RESPONSE_FLAGS) - 1);
 
        ntlm_set_string (ret, NTLM_RESPONSE_DOMAIN_OFFSET,
-                        token->data + NTLM_CHALLENGE_DOMAIN_OFFSET,
-                        atoi (token->data + NTLM_CHALLENGE_DOMAIN_LEN_OFFSET));
+                        (const char *) token->data + NTLM_CHALLENGE_DOMAIN_OFFSET,
+                        atoi ((char *) token->data + NTLM_CHALLENGE_DOMAIN_LEN_OFFSET));
        ntlm_set_string (ret, NTLM_RESPONSE_USER_OFFSET,
                         sasl->service->url->user,
                         strlen (sasl->service->url->user));
        ntlm_set_string (ret, NTLM_RESPONSE_HOST_OFFSET,
                         "UNKNOWN", sizeof ("UNKNOWN") - 1);
        ntlm_set_string (ret, NTLM_RESPONSE_LM_RESP_OFFSET,
-                        lm_resp, sizeof (lm_resp));
+                        (const char *) lm_resp, sizeof (lm_resp));
        ntlm_set_string (ret, NTLM_RESPONSE_NT_RESP_OFFSET,
-                        nt_resp, sizeof (nt_resp));
+                        (const char *) nt_resp, sizeof (nt_resp));
 
        sasl->authenticated = TRUE;
        return ret;
@@ -177,10 +177,10 @@ ntlm_lanmanager_hash (const char *password, char hash[21])
        memcpy (hash, LM_PASSWORD_MAGIC, 21);
 
        setup_schedule (lm_password, ks);
-       des (ks, hash);
+       des (ks, (unsigned char *) hash);
 
        setup_schedule (lm_password + 7, ks);
-       des (ks, hash + 8);
+       des (ks, (unsigned char *) hash + 8);
 }
 
 static void
@@ -195,7 +195,7 @@ ntlm_nt_hash (const char *password, char hash[21])
                *p++ = '\0';
        }
 
-       md4sum (buf, p - buf, hash);
+       md4sum (buf, p - buf, (unsigned char *) hash);
        memset (hash + 16, 0, 5);
 
        g_free (buf);
@@ -208,7 +208,7 @@ ntlm_set_string (GByteArray *ba, int offset, const char *data, int len)
        ba->data[offset + 1] = ba->data[offset + 3] = (len >> 8) & 0xFF;
        ba->data[offset + 4] =  ba->len       & 0xFF;
        ba->data[offset + 5] = (ba->len >> 8) & 0xFF;
-       g_byte_array_append (ba, data, len);
+       g_byte_array_append (ba, (guint8 *) data, len);
 }
 
 
index 5d5ae87..b93ce4f 100644 (file)
@@ -97,10 +97,10 @@ plain_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
 
        /* FIXME: make sure these are "UTF8-SAFE" */
        buf = g_byte_array_new ();
-       g_byte_array_append (buf, "", 1);
-       g_byte_array_append (buf, url->user, strlen (url->user));
-       g_byte_array_append (buf, "", 1);
-       g_byte_array_append (buf, url->passwd, strlen (url->passwd));
+       g_byte_array_append (buf, (guint8 *) "", 1);
+       g_byte_array_append (buf, (guint8 *) url->user, strlen (url->user));
+       g_byte_array_append (buf, (guint8 *) "", 1);
+       g_byte_array_append (buf, (guint8 *) url->passwd, strlen (url->passwd));
 
        sasl->authenticated = TRUE;
 
index 92e6a0a..2d1e298 100644 (file)
@@ -383,7 +383,7 @@ header_match(const char *value, const char *match, camel_search_match_t how)
        /* from dan the man, if we have mixed case, perform a case-sensitive match,
           otherwise not */
        p = (const unsigned char *)match;
-       while ((c = camel_utf8_getc(&p))) {
+       while ((c = camel_utf8_getc (&p))) {
                if (g_unichar_isupper(c)) {
                        switch (how) {
                        case CAMEL_SEARCH_MATCH_EXACT:
index 21b76c3..a156058 100644 (file)
@@ -36,7 +36,7 @@ typedef enum {
        CAMEL_SEARCH_MATCH_END = 1<<1,
        CAMEL_SEARCH_MATCH_REGEX = 1<<2, /* disables the first 2 */
        CAMEL_SEARCH_MATCH_ICASE = 1<<3,
-       CAMEL_SEARCH_MATCH_NEWLINE = 1<<4,
+       CAMEL_SEARCH_MATCH_NEWLINE = 1<<4
 } camel_search_flags_t;
 
 typedef enum {
@@ -44,7 +44,7 @@ typedef enum {
        CAMEL_SEARCH_MATCH_CONTAINS,
        CAMEL_SEARCH_MATCH_STARTS,
        CAMEL_SEARCH_MATCH_ENDS,
-       CAMEL_SEARCH_MATCH_SOUNDEX,
+       CAMEL_SEARCH_MATCH_SOUNDEX
 } camel_search_match_t;
 
 typedef enum {
@@ -52,7 +52,7 @@ typedef enum {
        CAMEL_SEARCH_TYPE_ENCODED,
        CAMEL_SEARCH_TYPE_ADDRESS,
        CAMEL_SEARCH_TYPE_ADDRESS_ENCODED,
-       CAMEL_SEARCH_TYPE_MLIST, /* its a mailing list pseudo-header */
+       CAMEL_SEARCH_TYPE_MLIST /* its a mailing list pseudo-header */
 } camel_search_t;
 
 /* builds a regex that represents a string search */
@@ -69,7 +69,7 @@ const char *camel_ustrstrcase(const char *haystack, const char *needle);
 typedef enum _camel_search_word_t {
        CAMEL_SEARCH_WORD_SIMPLE = 1,
        CAMEL_SEARCH_WORD_COMPLEX = 2,
-       CAMEL_SEARCH_WORD_8BIT = 4,
+       CAMEL_SEARCH_WORD_8BIT = 4
 } camel_search_word_t;
 
 struct _camel_search_word {
index 6cd2697..5da82d9 100644 (file)
@@ -139,7 +139,7 @@ parent_reset (CamelSeekableSubstream *seekable_substream, CamelSeekableStream *p
        if (camel_seekable_stream_tell (parent) == seekable_stream->position)
                return TRUE;
 
-       return camel_seekable_stream_seek (parent, seekable_stream->position, CAMEL_STREAM_SET) == seekable_stream->position;
+       return camel_seekable_stream_seek (parent, (off_t) seekable_stream->position, CAMEL_STREAM_SET) == seekable_stream->position;
 }
 
 static ssize_t
index 11c1317..896fd63 100644 (file)
@@ -638,6 +638,8 @@ camel_service_query_auth_types (CamelService *service, CamelException *ex)
 {
        GList *ret;
 
+       g_return_val_if_fail (service != NULL, NULL);
+
        /* note that we get the connect lock here, which means the callee
           must not call the connect functions itself */
        CAMEL_SERVICE_REC_LOCK (service, connect_lock);
index 4202d9e..9cf73d2 100644 (file)
@@ -43,7 +43,7 @@ enum {
        CAMEL_SERVICE_ARG_AUTH,
        CAMEL_SERVICE_ARG_HOSTNAME,
        CAMEL_SERVICE_ARG_PORT,
-       CAMEL_SERVICE_ARG_PATH,
+       CAMEL_SERVICE_ARG_PATH
 };
 
 #define CAMEL_SERVICE_USERNAME     (CAMEL_SERVICE_ARG_USERNAME | CAMEL_ARG_STR)
index 704ec46..067db98 100644 (file)
@@ -51,7 +51,7 @@ enum {
        CAMEL_SESSION_PASSWORD_REPROMPT = 1 << 0,
        CAMEL_SESSION_PASSWORD_SECRET = 1 << 2,
        CAMEL_SESSION_PASSWORD_STATIC = 1 << 3,
-       CAMEL_SESSION_PASSPHRASE = 1 << 4,
+       CAMEL_SESSION_PASSPHRASE = 1 << 4
 };
 
 struct _CamelSession
index 50347bb..8078b74 100644 (file)
@@ -160,7 +160,7 @@ camel_smime_context_describe_part(CamelSMIMEContext *context, CamelMimePart *par
                                           NULL, NULL,  /* password callback    */
                                           NULL, NULL); /* decrypt key callback */
 
-               NSS_CMSDecoder_Update(dec, istream->buffer->data, istream->buffer->len);
+               NSS_CMSDecoder_Update(dec, (char *) istream->buffer->data, istream->buffer->len);
                camel_object_unref(istream);
 
                cmsg = NSS_CMSDecoder_Finish(dec);
@@ -404,7 +404,7 @@ sm_sign(CamelCipherContext *context, const char *userid, CamelCipherHash hash, C
                goto fail;
        }
 
-       if (NSS_CMSEncoder_Update(enc, ((CamelStreamMem *)istream)->buffer->data, ((CamelStreamMem *)istream)->buffer->len) != SECSuccess) {
+       if (NSS_CMSEncoder_Update(enc, (char *) ((CamelStreamMem *)istream)->buffer->data, ((CamelStreamMem *)istream)->buffer->len) != SECSuccess) {
                NSS_CMSEncoder_Cancel(enc);
                camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to add data to CMS encoder"));
                goto fail;
@@ -720,7 +720,7 @@ sm_verify(CamelCipherContext *context, CamelMimePart *ipart, CamelException *ex)
                                   NULL, NULL); /* decrypt key callback */
 
        camel_data_wrapper_decode_to_stream(camel_medium_get_content_object((CamelMedium *)sigpart), (CamelStream *)mem);
-       (void)NSS_CMSDecoder_Update(dec, mem->buffer->data, mem->buffer->len);
+       (void)NSS_CMSDecoder_Update(dec, (char *) mem->buffer->data, mem->buffer->len);
        cmsg = NSS_CMSDecoder_Finish(dec);
        if (cmsg == NULL) {
                camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Decoder failed"));
@@ -856,7 +856,7 @@ sm_encrypt(CamelCipherContext *context, const char *userid, GPtrArray *recipient
        /* FIXME: Canonicalise the input? */
        mem = (CamelStreamMem *)camel_stream_mem_new();
        camel_data_wrapper_write_to_stream((CamelDataWrapper *)ipart, (CamelStream *)mem);
-       if (NSS_CMSEncoder_Update(enc, mem->buffer->data, mem->buffer->len) != SECSuccess) {
+       if (NSS_CMSEncoder_Update(enc, (char *) mem->buffer->data, mem->buffer->len) != SECSuccess) {
                NSS_CMSEncoder_Cancel(enc);
                camel_object_unref(mem);
                camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to add data to encoder"));
@@ -939,7 +939,7 @@ sm_decrypt(CamelCipherContext *context, CamelMimePart *ipart, CamelMimePart *opa
                                   NULL, NULL,
                                   NULL, NULL); /* decrypt key callback */
 
-       if (NSS_CMSDecoder_Update(dec, istream->buffer->data, istream->buffer->len) != SECSuccess) {
+       if (NSS_CMSDecoder_Update(dec, (char *) istream->buffer->data, istream->buffer->len) != SECSuccess) {
                printf("decoder update failed\n");
        }
        camel_object_unref(istream);
index 9bacfe8..af4b4ad 100644 (file)
@@ -42,7 +42,7 @@ typedef enum _camel_smime_describe_t {
        CAMEL_SMIME_SIGNED = 1<<0,
        CAMEL_SMIME_ENCRYPTED = 1<<1,
        CAMEL_SMIME_CERTS = 1<<2,
-       CAMEL_SMIME_CRLS = 1<<3,
+       CAMEL_SMIME_CRLS = 1<<3
 } camel_smime_describe_t;
 
 typedef struct _CamelSMIMEContext CamelSMIMEContext;
index 8bd8983..f489704 100644 (file)
@@ -438,6 +438,7 @@ camel_store_summary_save(CamelStoreSummary *s)
                io(printf("**  open error: %s\n", strerror (errno)));
                return -1;
        }
+
        out = fdopen(fd, "wb");
        if ( out == NULL ) {
                i = errno;
@@ -831,11 +832,7 @@ camel_store_summary_info_new(CamelStoreSummary *s)
 {
        CamelStoreInfo *info;
 
-       CAMEL_STORE_SUMMARY_LOCK(s, alloc_lock);
-       if (s->store_info_chunks == NULL)
-               s->store_info_chunks = e_memchunk_new(32, s->store_info_size);
-       info = e_memchunk_alloc0(s->store_info_chunks);
-       CAMEL_STORE_SUMMARY_UNLOCK(s, alloc_lock);
+       info = g_slice_alloc0(s->store_info_size);
        info->refcount = 1;
        return info;
 }
@@ -944,7 +941,7 @@ store_info_free(CamelStoreSummary *s, CamelStoreInfo *info)
 {
        g_free(info->path);
        g_free(info->uri);
-       e_memchunk_free(s->store_info_chunks, info);
+       g_slice_free1(s->store_info_size, info);
 }
 
 static const char *
index 1ce0103..cb5572f 100644 (file)
@@ -67,7 +67,7 @@ enum {
        CAMEL_STORE_INFO_PATH = 0,
        CAMEL_STORE_INFO_NAME,
        CAMEL_STORE_INFO_URI,
-       CAMEL_STORE_INFO_LAST,
+       CAMEL_STORE_INFO_LAST
 };
 
 struct _CamelStoreInfo {
@@ -81,7 +81,7 @@ struct _CamelStoreInfo {
 
 typedef enum _CamelStoreSummaryFlags {
        CAMEL_STORE_SUMMARY_DIRTY = 1<<0,
-       CAMEL_STORE_SUMMARY_FRAGMENT = 1<<1, /* path name is stored in fragment rather than path */
+       CAMEL_STORE_SUMMARY_FRAGMENT = 1<<1 /* path name is stored in fragment rather than path */
 } CamelStoreSummaryFlags;
 
 struct _CamelStoreSummary {
index 284d7b9..c329ebc 100644 (file)
@@ -234,6 +234,7 @@ camel_store_get_folder (CamelStore *store, const char *folder_name, guint32 flag
 {
        CamelFolder *folder = NULL;
 
+       g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
        g_return_val_if_fail (folder_name != NULL, NULL);
 
        /* O_EXCL doesn't make sense if we aren't requesting to also create the folder if it doesn't exist */
@@ -291,7 +292,7 @@ camel_store_get_folder (CamelStore *store, const char *folder_name, guint32 flag
        if (camel_debug_start(":store")) {
                char *u = camel_url_to_string(((CamelService *)store)->url, CAMEL_URL_HIDE_PASSWORD);
 
-               printf("CamelStore('%s'):get_folder('%s', %u) = %p\n", u, folder_name, flags, folder);
+               printf("CamelStore('%s'):get_folder('%s', %u) = %p\n", u, folder_name, flags, (void *) folder);
                if (ex && ex->id)
                        printf("  failed: '%s'\n", ex->desc);
                g_free(u);
@@ -713,7 +714,7 @@ add_special_info (CamelStore *store, CamelFolderInfo *info, const char *name, co
                g_free (vinfo->uri);
        } else {
                /* There wasn't a Trash/Junk folder so create a new folder entry */
-               vinfo = g_new0 (CamelFolderInfo, 1);
+               vinfo = camel_folder_info_new ();
 
                g_assert(parent != NULL);
 
@@ -800,7 +801,7 @@ camel_store_get_folder_info(CamelStore *store, const char *top, guint32 flags, C
 
        if (camel_debug_start("store:folder_info")) {
                char *url = camel_url_to_string(((CamelService *)store)->url, CAMEL_URL_HIDE_ALL);
-               printf("Get folder info(%p:%s, '%s') =\n", store, url, top?top:"<null>");
+               printf("Get folder info(%p:%s, '%s') =\n", (void *) store, url, top?top:"<null>");
                g_free(url);
                dump_fi(info, 2);
                camel_debug_end();
@@ -873,10 +874,21 @@ camel_folder_info_free (CamelFolderInfo *fi)
                g_free (fi->name);
                g_free (fi->full_name);
                g_free (fi->uri);
-               g_free (fi);
+               g_slice_free (CamelFolderInfo, fi);
        }
 }
 
+/**
+ * camel_folder_info_new:
+ *
+ * Return value: a new empty CamelFolderInfo instance
+ **/
+CamelFolderInfo *
+camel_folder_info_new (void)
+{
+       return g_slice_new0 (CamelFolderInfo);
+}
+
 static int
 folder_info_cmp (const void *ap, const void *bp)
 {
@@ -945,7 +957,7 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace,
                                CamelURL *url;
                                char *sep;
 
-                               pfi = g_new0 (CamelFolderInfo, 1);
+                               pfi = camel_folder_info_new ();
                                if (short_names) {
                                        pfi->name = strrchr (pname, separator);
                                        if (pfi->name)
@@ -1014,7 +1026,7 @@ folder_info_clone_rec(CamelFolderInfo *fi, CamelFolderInfo *parent)
 {
        CamelFolderInfo *info;
 
-       info = g_malloc(sizeof(*info));
+       info = camel_folder_info_new ();
        info->parent = parent;
        info->uri = g_strdup(fi->uri);
        info->name = g_strdup(fi->name);
index 783d557..e9c3cbe 100644 (file)
@@ -36,7 +36,7 @@
 G_BEGIN_DECLS
 
 enum {
-       CAMEL_STORE_ARG_FIRST  = CAMEL_SERVICE_ARG_FIRST + 100,
+       CAMEL_STORE_ARG_FIRST = CAMEL_SERVICE_ARG_FIRST + 100
 };
 
 typedef struct _CamelFolderInfo {
@@ -228,6 +228,7 @@ void             camel_store_free_folder_info_full (CamelStore *store,
 void             camel_store_free_folder_info_nop  (CamelStore *store,
                                                    CamelFolderInfo *fi);
 
+CamelFolderInfo *camel_folder_info_new             (void);
 void             camel_folder_info_free            (CamelFolderInfo *fi);
 CamelFolderInfo *camel_folder_info_build           (GPtrArray *folders,
                                                    const char *namespace,
index d8b183d..5354cea 100644 (file)
@@ -36,7 +36,7 @@
 static CamelStreamClass *parent_class = NULL;
 
 enum {
-       BUF_USER = 1<<0,        /* user-supplied buffer, do not free */
+       BUF_USER = 1<<0 /* user-supplied buffer, do not free */
 };
 
 #define BUF_SIZE 1024
@@ -126,7 +126,7 @@ set_vbuf(CamelStreamBuffer *sbf, char *buf, CamelStreamBufferMode mode, int size
                g_free(sbf->buf);
        }
        if (buf) {
-               sbf->buf = buf;
+               sbf->buf = (unsigned char *) buf;
                sbf->flags |= BUF_USER;
        } else {
                sbf->buf = g_malloc(size);
@@ -253,7 +253,7 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
                                        bptr += bytes_read;
                                }
                        } else {
-                               bytes_read = camel_stream_read(sbf->stream, sbf->buf, sbf->size);
+                               bytes_read = camel_stream_read(sbf->stream, (char *) sbf->buf, sbf->size);
                                if (bytes_read>0) {
                                        size_t bytes_used = bytes_read > n ? n : bytes_read;
                                        sbf->ptr = sbf->buf;
@@ -312,7 +312,7 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
 
        /* if we've filled the buffer, write it out, reset buffer */
        if (left == todo) {
-               if (stream_write_all(sbf->stream, sbf->buf, sbf->size) == -1)
+               if (stream_write_all(sbf->stream, (const char *) sbf->buf, sbf->size) == -1)
                        return -1;
 
                sbf->ptr = sbf->buf;
@@ -340,7 +340,7 @@ stream_flush (CamelStream *stream)
        if ((sbf->mode & CAMEL_STREAM_BUFFER_MODE) == CAMEL_STREAM_BUFFER_WRITE) {
                size_t len = sbf->ptr - sbf->buf;
 
-               if (camel_stream_write (sbf->stream, sbf->buf, len) == -1)
+               if (camel_stream_write (sbf->stream, (const char *) sbf->buf, len) == -1)
                        return -1;
 
                sbf->ptr = sbf->buf;
@@ -391,8 +391,8 @@ camel_stream_buffer_gets(CamelStreamBuffer *sbf, char *buf, unsigned int max)
        int bytes_read;
 
        outptr = buf;
-       inptr = sbf->ptr;
-       inend = sbf->end;
+       inptr = (char *) sbf->ptr;
+       inend = (char *) sbf->end;
        outend = buf+max-1;     /* room for NUL */
 
        do {
@@ -401,25 +401,27 @@ camel_stream_buffer_gets(CamelStreamBuffer *sbf, char *buf, unsigned int max)
                        *outptr++ = c;
                        if (c == '\n') {
                                *outptr = 0;
-                               sbf->ptr = inptr;
+                               sbf->ptr = (unsigned char *) inptr;
                                return outptr-buf;
                        }
                }
                if (outptr == outend)
                        break;
 
-               bytes_read = camel_stream_read (sbf->stream, sbf->buf, sbf->size);
+               bytes_read = camel_stream_read (sbf->stream, (char *) sbf->buf, sbf->size);
                if (bytes_read == -1) {
                        if (buf == outptr)
                                return -1;
                        else
                                bytes_read = 0;
                }
-               inptr = sbf->ptr = sbf->buf;
-               inend = sbf->end = sbf->buf + bytes_read;
+               sbf->ptr = sbf->buf;
+               sbf->end = sbf->buf + bytes_read;
+               inptr = (char *) sbf->ptr;
+               inend = (char *) sbf->end;
        } while (bytes_read>0);
 
-       sbf->ptr = inptr;
+       sbf->ptr = (unsigned char *) inptr;
        *outptr = 0;
 
        return (int)(outptr - buf);
@@ -445,7 +447,7 @@ camel_stream_buffer_read_line (CamelStreamBuffer *sbf)
        p = sbf->linebuf;
 
        while (1) {
-               nread = camel_stream_buffer_gets (sbf, p, sbf->linesize - (p - sbf->linebuf));
+               nread = camel_stream_buffer_gets (sbf, (char *) p, sbf->linesize - (p - sbf->linebuf));
                if (nread <=0) {
                        if (p > sbf->linebuf)
                                break;
@@ -467,5 +469,5 @@ camel_stream_buffer_read_line (CamelStreamBuffer *sbf)
                p--;
        p[0] = 0;
 
-       return g_strdup(sbf->linebuf);
+       return g_strdup((char *) sbf->linebuf);
 }
index 2d599a0..f170db5 100644 (file)
@@ -313,6 +313,7 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
 
                        timeout.tv_sec = 0;
                        timeout.tv_usec = TIMEOUT_USEC;
+
                        select (fdmax, &rdset, 0, 0, &timeout);
                        if (FD_ISSET (cancel_fd, &rdset)) {
                                fcntl (openssl->priv->sockfd, F_SETFL, flags);
@@ -377,6 +378,7 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
                fcntl (openssl->priv->sockfd, F_SETFL, flags | O_NONBLOCK);
 
                fdmax = MAX (openssl->priv->sockfd, cancel_fd) + 1;
+
                do {
                        FD_ZERO (&rdset);
                        FD_ZERO (&wrset);
@@ -666,13 +668,13 @@ ssl_verify (int ok, X509_STORE_CTX *ctx)
        md5len = sizeof (md5sum);
        X509_digest (cert, EVP_md5 (), md5sum, &md5len);
        for (i = 0, f = fingerprint; i < 16; i++, f += 3)
-               sprintf (f, "%.2x%c", md5sum[i], i != 15 ? ':' : '\0');
+               sprintf ((char *) f, "%.2x%c", md5sum[i], i != 15 ? ':' : '\0');
 
 #define GET_STRING(name) X509_NAME_oneline (name, buf, 256)
 
        certdb = camel_certdb_get_default ();
        if (certdb) {
-               ccert = camel_certdb_get_cert (certdb, fingerprint);
+               ccert = camel_certdb_get_cert (certdb, (const char *) fingerprint);
                if (ccert) {
                        if (ccert->trust != CAMEL_CERT_TRUST_UNKNOWN) {
                                ok = ccert->trust != CAMEL_CERT_TRUST_NEVER;
@@ -686,8 +688,8 @@ ssl_verify (int ok, X509_STORE_CTX *ctx)
                        ccert = camel_certdb_cert_new (certdb);
                        camel_cert_set_issuer (certdb, ccert, GET_STRING (X509_get_issuer_name (cert)));
                        camel_cert_set_subject (certdb, ccert, GET_STRING (X509_get_subject_name (cert)));
-                       camel_cert_set_hostname (certdb, ccert, stream->priv->expected_host);
-                       camel_cert_set_fingerprint (certdb, ccert, fingerprint);
+                       camel_cert_set_hostname (certdb, ccert, (const char *) stream->priv->expected_host);
+                       camel_cert_set_fingerprint (certdb, ccert, (const char *) fingerprint);
                        camel_cert_set_trust (certdb, ccert, CAMEL_CERT_TRUST_UNKNOWN);
 
                        /* Add the certificate to our db */
@@ -850,7 +852,7 @@ stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
                           get_sockopt_level (data),
                           optname,
                           (void *) &data->value,
-                          &optlen);
+                          (socklen_t *) &optlen);
 }
 
 static int
index 6b3562a..18148ce 100644 (file)
@@ -487,7 +487,7 @@ stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
                           get_sockopt_level (data),
                           optname,
                           (void *) &data->value,
-                          &optlen);
+                          (socklen_t *) &optlen);
 }
 
 static int
index 09658d4..cb2fb6f 100644 (file)
@@ -323,7 +323,7 @@ camel_tcp_stream_ssl_enable_ssl (CamelTcpStreamSSL *ssl)
                        return -1;
                }
 
-               if (SSL_ForceHandshake (fd) == -1) {
+               if (SSL_ForceHandshake (fd) == SECFailure) {
                        set_errno (PR_GetError ());
                        return -1;
                }
@@ -658,7 +658,7 @@ cert_fingerprint(CERTCertificate *cert)
        int i;
        const char tohex[16] = "0123456789abcdef";
 
-       md5_get_digest (cert->derCert.data, cert->derCert.len, md5sum);
+       md5_get_digest ((const char *) cert->derCert.data, cert->derCert.len, md5sum);
        for (i=0,f = fingerprint; i<16; i++) {
                unsigned int c = md5sum[i];
 
@@ -676,7 +676,7 @@ cert_fingerprint(CERTCertificate *cert)
 
        fingerprint[47] = 0;
 
-       return g_strdup(fingerprint);
+       return g_strdup((char*) fingerprint);
 }
 
 /* lookup a cert uses fingerprint to index an on-disk file */
@@ -794,7 +794,7 @@ camel_certdb_nss_cert_set(CamelCertDB *certdb, CamelCert *ccert, CERTCertificate
 
        stream = camel_stream_fs_new_with_name (path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
        if (stream != NULL) {
-               if (camel_stream_write (stream, ccert->rawcert->data, ccert->rawcert->len) == -1) {
+               if (camel_stream_write (stream, (const char *) ccert->rawcert->data, ccert->rawcert->len) == -1) {
                        g_warning ("Could not save cert: %s: %s", path, strerror (errno));
                        g_unlink (path);
                }
@@ -1041,6 +1041,7 @@ enable_ssl (CamelTcpStreamSSL *ssl, PRFileDesc *fd)
                return NULL;
 
        SSL_OptionSet (ssl_fd, SSL_SECURITY, PR_TRUE);
+
        if (ssl->priv->flags & CAMEL_TCP_STREAM_SSL_ENABLE_SSL2) {
                SSL_OptionSet (ssl_fd, SSL_ENABLE_SSL2, PR_TRUE);
                SSL_OptionSet (ssl_fd, SSL_V2_COMPATIBLE_HELLO, PR_TRUE);
@@ -1048,10 +1049,12 @@ enable_ssl (CamelTcpStreamSSL *ssl, PRFileDesc *fd)
                SSL_OptionSet (ssl_fd, SSL_ENABLE_SSL2, PR_FALSE);
                SSL_OptionSet (ssl_fd, SSL_V2_COMPATIBLE_HELLO, PR_FALSE);
        }
+
        if (ssl->priv->flags & CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
                SSL_OptionSet (ssl_fd, SSL_ENABLE_SSL3, PR_TRUE);
        else
                SSL_OptionSet (ssl_fd, SSL_ENABLE_SSL3, PR_FALSE);
+
        if (ssl->priv->flags & CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
                SSL_OptionSet (ssl_fd, SSL_ENABLE_TLS, PR_TRUE);
        else
index f261613..9a9f06e 100644 (file)
@@ -1468,8 +1468,8 @@ text_index_name_add_buffer(CamelIndexName *idn, const char *buffer, size_t len)
        CamelTextIndexNamePrivate *p = CIN_PRIVATE(idn);
        const unsigned char *ptr, *ptrend;
        guint32 c;
-       unsigned char utf8[8];
-       size_t utf8len;
+       char utf8[8];
+       int utf8len;
 
        if (buffer == NULL) {
                if (p->buffer->len) {
@@ -1479,8 +1479,8 @@ text_index_name_add_buffer(CamelIndexName *idn, const char *buffer, size_t len)
                return 0;
        }
 
-       ptr = buffer;
-       ptrend = buffer+len;
+       ptr = (const unsigned char *) buffer;
+       ptrend = (const unsigned char *) buffer+len;
        while ((c = camel_utf8_next(&ptr, ptrend))) {
                if (g_unichar_isalnum(c)) {
                        c = g_unichar_tolower(c);
index 90c1d25..220c162 100644 (file)
@@ -38,7 +38,7 @@
 G_BEGIN_DECLS
 
 enum {
-       CAMEL_TRANSPORT_ARG_FIRST  = CAMEL_SERVICE_ARG_FIRST + 100,
+       CAMEL_TRANSPORT_ARG_FIRST  = CAMEL_SERVICE_ARG_FIRST + 100
 };
 
 struct _CamelTransport
index 45182f3..352e4cd 100644 (file)
@@ -138,7 +138,7 @@ enum {
        IS_SPACE        = (1 << 4),
        IS_SPECIAL      = (1 << 5),
        IS_DOMAIN       = (1 << 6),
-       IS_URLSAFE      = (1 << 7),
+       IS_URLSAFE      = (1 << 7)
 };
 
 #define is_ctrl(x) ((url_scanner_table[(unsigned char)(x)] & IS_CTRL) != 0)
index 457ab05..530ad63 100644 (file)
@@ -338,7 +338,7 @@ camel_url_to_string (CamelURL *url, guint32 flags)
 #ifdef G_OS_WIN32
        if (url->protocol && !strcmp(url->protocol, "file"))
                return g_filename_to_uri(url->path, url->host, NULL);
-#endif
+#endif /* G_OS_WIN32 */
 
        str = g_string_sized_new (20);
 
@@ -727,7 +727,7 @@ camel_url_copy(const CamelURL *in)
 
        g_return_val_if_fail (in != NULL, NULL);
 
-       out = g_malloc(sizeof(*out));
+       out = g_malloc0(sizeof(*out));
        out->protocol = g_strdup(in->protocol);
        out->user = g_strdup(in->user);
        out->authmech = g_strdup(in->authmech);
index a972631..9513ffe 100644 (file)
@@ -177,7 +177,7 @@ g_string_append_u(GString *out, guint32 c)
 
        camel_utf8_putc(&p, c);
        *p = 0;
-       g_string_append(out, (gchar *) buffer);
+       g_string_append(out, (const char *) buffer);
 }
 
 static const char utf7_alphabet[] =
index 5380200..f77e9d0 100644 (file)
@@ -379,16 +379,17 @@ camel_vee_folder_hash_folder(CamelFolder *folder, char buffer[8])
 {
        MD5Context ctx;
        unsigned char digest[16];
-       unsigned int state = 0, save = 0;
+       int state = 0, save = 0;
        char *tmp;
        int i;
 
        md5_init(&ctx);
        tmp = camel_service_get_url((CamelService *)folder->parent_store);
-       md5_update(&ctx, tmp, strlen(tmp));
+       md5_update(&ctx, (unsigned char*) tmp, strlen(tmp));
        g_free(tmp);
-       md5_update(&ctx, folder->full_name, strlen(folder->full_name));
+       md5_update(&ctx, (unsigned char*)folder->full_name, strlen(folder->full_name));
        md5_final(&ctx, digest);
+
        g_base64_encode_step(digest, 6, FALSE, buffer, &state, &save);
        g_base64_encode_close(FALSE, buffer, &state, &save);
 
@@ -1337,6 +1338,7 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
                        g_hash_table_insert(matches_hash, matches_changed->pdata[i], matches_changed->pdata[i]);
                }
                dd(printf("\n"));
+
                for (i=0;i<changed->len;i++) {
                        uid = changed->pdata[i];
                        if (strlen(uid)+9 > vuidlen) {
index 8143358..d50f50f 100644 (file)
@@ -147,7 +147,7 @@ change_folder(CamelStore *store, const char *name, guint32 flags, int count)
        const char *tmp;
        CamelURL *url;
 
-       fi = g_malloc0(sizeof(*fi));
+       fi = camel_folder_info_new ();
        fi->full_name = g_strdup(name);
        tmp = strrchr(name, '/');
        if (tmp == NULL)
@@ -276,7 +276,7 @@ vee_get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExce
                        if ((flags & CAMEL_STORE_FOLDER_INFO_FAST) == 0)
                                camel_folder_refresh_info((CamelFolder *)folder, NULL);
 
-                       info = g_malloc0(sizeof(*info));
+                       info = camel_folder_info_new();
                        url = camel_url_new("vfolder:", NULL);
                        camel_url_set_path(url, ((CamelService *)((CamelFolder *)folder)->parent_store)->url->path);
                        camel_url_set_fragment(url, ((CamelFolder *)folder)->full_name);
@@ -334,7 +334,7 @@ vee_get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExce
 
        /* and always add UNMATCHED, if scanning from top/etc */
        if (top == NULL || top[0] == 0 || strncmp(top, CAMEL_UNMATCHED_NAME, strlen(CAMEL_UNMATCHED_NAME)) == 0) {
-               info = g_malloc0(sizeof(*info));
+               info = camel_folder_info_new ();
                url = camel_url_new("vfolder:", NULL);
                camel_url_set_path(url, ((CamelService *)store)->url->path);
                camel_url_set_fragment(url, CAMEL_UNMATCHED_NAME);
index 62910b1..1a3aa42 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-14  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Merge a bunch of compiler warning fixes and cosmetic
+          cleanups from camel-lite.
+
 2007-09-29  Kjartan Maraas  <kmaraas@gnome.org>
 
        * camel-groupwise-folder.c: (gw_update_cache), (gw_update_summary),
index 7c6295f..e4add09 100644 (file)
@@ -435,7 +435,7 @@ groupwise_build_folder_info(CamelGroupwiseStore *gw_store, const char *parent_na
        CamelFolderInfo *fi;
        CamelGroupwiseStorePrivate *priv = gw_store->priv;
 
-       fi = g_malloc0(sizeof(*fi));
+       fi = camel_folder_info_new();
 
        fi->unread = -1;
        fi->total = -1;
@@ -805,7 +805,7 @@ convert_to_folder_info (CamelGroupwiseStore *store, EGwContainer *container, con
        id = e_gw_container_get_id (container);
        type = e_gw_container_get_container_type (container);
 
-       fi = g_new0 (CamelFolderInfo, 1);
+       fi = camel_folder_info_new ();
 
        if (type == E_GW_CONTAINER_TYPE_INBOX)
                fi->flags |= CAMEL_FOLDER_TYPE_INBOX;
index 17738d6..5e1aab6 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-14  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Merge a bunch of compiler warning fixes and cosmetic
+          cleanups from camel-lite.
+
 2007-11-12  Milan Crha  <mcrha@redhat.com>
 
        ** Fix for bug #495086
index 1b4d3e9..d2a5b8f 100644 (file)
@@ -41,7 +41,7 @@ G_BEGIN_DECLS
 struct _CamelImapFolder {
        CamelDiscoFolder parent_object;
 
-        struct _CamelImapFolderPrivate *priv;
+       struct _CamelImapFolderPrivate *priv;
 
        CamelFolderSearch *search;
        CamelImapMessageCache *cache;
index 3da6442..4f29526 100644 (file)
@@ -421,6 +421,7 @@ camel_imap_message_cache_get (CamelImapMessageCache *cache, const char *uid,
 #endif
        path = g_strdup_printf ("%s/%s.%s", cache->path, uid, part_spec);
        key = strrchr (path, '/') + 1;
+
        stream = g_hash_table_lookup (cache->parts, key);
        if (stream) {
                camel_stream_reset (CAMEL_STREAM (stream));
index 997d5a3..d33a4e2 100644 (file)
@@ -180,13 +180,13 @@ hash_match(char hash[17], int argc, struct _ESExpResult **argv)
 {
        MD5Context ctx;
        unsigned char digest[16];
-       unsigned int state = 0, save = 0;
+       int state = 0, save = 0;
        int i;
 
        md5_init(&ctx);
        for (i=0;i<argc;i++) {
                if (argv[i]->type == ESEXP_RES_STRING)
-                       md5_update(&ctx, argv[i]->value.string, strlen(argv[i]->value.string));
+                       md5_update(&ctx, (const guchar *) argv[i]->value.string, strlen(argv[i]->value.string));
        }
        md5_final(&ctx, digest);
 
@@ -330,7 +330,7 @@ sync_match(CamelImapSearch *is, struct _match_record *mr)
        /* TODO: Handle multiple search terms */
 
        /* This handles multiple search words within a single term */
-       words = camel_search_words_split (mr->terms[0]);
+       words = camel_search_words_split ((const unsigned char *) mr->terms[0]);
        search = g_string_new ("");
        g_string_append_printf (search, "UID %d:%d", mr->lastuid + 1, is->lastuid);
        for (i = 0; i < words->len; i++) {
index ea5c5d8..90607d3 100644 (file)
@@ -39,7 +39,7 @@ typedef struct _CamelImapStoreInfo CamelImapStoreInfo;
 
 enum {
        CAMEL_IMAP_STORE_INFO_FULL_NAME = CAMEL_STORE_INFO_LAST,
-       CAMEL_IMAP_STORE_INFO_LAST,
+       CAMEL_IMAP_STORE_INFO_LAST
 };
 
 struct _CamelImapStoreInfo {
index 885df2b..9261b67 100644 (file)
@@ -207,8 +207,7 @@ camel_imap_store_finalize (CamelObject *object)
                disco->diary = NULL;
        }
 
-       if (imap_store->custom_headers)
-               g_free (imap_store->custom_headers);
+       g_free (imap_store->custom_headers);
 }
 
 static void
@@ -555,7 +554,7 @@ imap_get_capability (CamelService *service, CamelException *ex)
 enum {
        MODE_CLEAR,
        MODE_SSL,
-       MODE_TLS,
+       MODE_TLS
 };
 
 #ifdef HAVE_SSL
@@ -576,21 +575,20 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam
 
        if (ssl_mode != MODE_CLEAR) {
 #ifdef HAVE_SSL
-               if (ssl_mode == MODE_TLS) {
+               if (ssl_mode == MODE_TLS)
                        tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
-               } else {
+               else
                        tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
-               }
 #else
                camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-                                     _("Could not connect to %s: %s"),
-                                     service->url->host, _("SSL unavailable"));
+                       _("Could not connect to %s: %s"),
+                       service->url->host, _("SSL unavailable"));
 
                return FALSE;
+
 #endif /* HAVE_SSL */
-       } else {
+       } else
                tcp_stream = camel_tcp_stream_raw_new ();
-       }
 
        if (camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai) == -1) {
                if (errno == EINTR)
@@ -703,8 +701,8 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam
 #ifdef HAVE_SSL
        if (!(store->capabilities & IMAP_CAPABILITY_STARTTLS)) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     _("Failed to connect to IMAP server %s in secure mode: %s"),
-                                     service->url->host, _("STARTTLS not supported"));
+                       _("Failed to connect to IMAP server %s in secure mode: %s"),
+                       service->url->host, _("STARTTLS not supported"));
 
                goto exception;
        }
@@ -757,13 +755,14 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam
        if (store->capabilities & IMAP_CAPABILITY_LOGINDISABLED ) {
                clean_quit = TRUE;
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                               _("Failed to connect to IMAP server %s in secure mode: %s"), service->url->host, _("Unknown error"));
+                       _("Failed to connect to IMAP server %s in secure mode: %s"),
+                       service->url->host, _("Unknown error"));
                goto exception;
        }
 
        return TRUE;
 
- exception:
+exception:
 
        if (clean_quit && store->connected) {
                /* try to disconnect cleanly */
@@ -910,6 +909,7 @@ connect_to_server_process (CamelService *service, const char *cmd, CamelExceptio
                store->connected = FALSE;
                return FALSE;
        }
+
        if (!strncmp(buf, "* PREAUTH", 9))
                store->preauthed = TRUE;
        g_free (buf);
@@ -965,6 +965,7 @@ connect_to_server_wrapper (CamelService *service, CamelException *ex)
            && (command = camel_url_get_param(service->url, "command")))
                return connect_to_server_process(service, command, ex);
 #endif
+
        if ((ssl_mode = camel_url_get_param (service->url, "use_ssl"))) {
                for (i = 0; ssl_options[i].value; i++)
                        if (!strcmp (ssl_options[i].value, ssl_mode))
@@ -1046,8 +1047,7 @@ imap_build_folder_info(CamelImapStore *imap_store, const char *folder_name)
        const char *name;
        CamelFolderInfo *fi;
 
-       fi = g_malloc0(sizeof(*fi));
-
+       fi = camel_folder_info_new ();
        fi->full_name = g_strdup(folder_name);
        fi->unread = -1;
        fi->total = -1;
@@ -1334,10 +1334,10 @@ imap_auth_loop (CamelService *service, CamelException *ex)
        if (service->url->authmech) {
                if (!g_hash_table_lookup (store->authtypes, service->url->authmech)) {
                        camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
-                                             _("IMAP server %s does not support requested "
-                                               "authentication type %s"),
-                                             service->url->host,
-                                             service->url->authmech);
+                               _("IMAP server %s does not support requested "
+                                 "authentication type %s"),
+                               service->url->host,
+                               service->url->authmech);
                        return FALSE;
                }
 
@@ -1368,28 +1368,28 @@ imap_auth_loop (CamelService *service, CamelException *ex)
                        char *prompt;
 
                        prompt = g_strdup_printf (_("%sPlease enter the IMAP "
-                                                   "password for %s@%s"),
-                                                 errbuf ? errbuf : "",
-                                                 service->url->user,
-                                                 service->url->host);
+                               "password for %s@%s"),
+                               errbuf ? errbuf : "",
+                               service->url->user,
+                               service->url->host);
+
                        service->url->passwd =
                                camel_session_get_password (session, service, auth_domain,
-                                                           prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
+                                       prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
                        g_free (prompt);
                        g_free (errbuf);
                        errbuf = NULL;
 
                        if (!service->url->passwd) {
                                camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
-                                                    _("You did not enter a password."));
+                                       _("You did not enter a password."));
                                return FALSE;
                        }
                }
 
                if (!store->connected) {
                        /* Some servers (eg, courier) will disconnect on
-                        * a bad password. So reconnect here.
-                        */
+                        * a bad password. So reconnect here. */
                        if (!connect_to_server_wrapper (service, ex))
                                return FALSE;
                }
@@ -1411,8 +1411,8 @@ imap_auth_loop (CamelService *service, CamelException *ex)
                                return FALSE;
 
                        errbuf = g_strdup_printf (_("Unable to authenticate "
-                                                   "to IMAP server.\n%s\n\n"),
-                                                 camel_exception_get_description (ex));
+                               "to IMAP server.\n%s\n\n"),
+                               camel_exception_get_description (ex));
                        camel_exception_clear (ex);
                }
        }
@@ -1509,9 +1509,10 @@ imap_connect_online (CamelService *service, CamelException *ex)
                        imap_parse_list_response (store, result, NULL, &store->dir_sep, NULL);
                        g_free (result);
                }
-               if (!store->dir_sep) {
+
+               if (!store->dir_sep)
                        store->dir_sep = '/';   /* Guess */
-               }
+
        }
 
        /* canonicalize the namespace to end with dir_sep */
@@ -1554,11 +1555,11 @@ imap_connect_online (CamelService *service, CamelException *ex)
                                goto done;
                        get_folders_sync(store, "INBOX", ex);
                }
+
                store->refresh_stamp = time(NULL);
        }
 
-
- done:
+done:
        /* save any changes we had */
        camel_store_summary_save((CamelStoreSummary *)store->summary);
 
@@ -1580,6 +1581,7 @@ imap_connect_offline (CamelService *service, CamelException *ex)
                return FALSE;
 
        store->connected = !camel_exception_is_set (ex);
+
        return store->connected;
 }
 
@@ -1875,6 +1877,7 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca
                camel_object_unref (imap_store->current_folder);
                imap_store->current_folder = NULL;
        }
+
        response = camel_imap_command (imap_store, NULL, ex, "SELECT %F", folder_name);
        if (!response) {
                char *folder_real, *parent_name, *parent_real;
@@ -2426,7 +2429,7 @@ parse_list_response_as_folder_info (CamelImapStore *imap_store,
 
        flags = (flags & ~CAMEL_FOLDER_SUBSCRIBED) | (si->info.flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED);
 
-       fi = g_new0 (CamelFolderInfo, 1);
+       fi = camel_folder_info_new ();
        fi->full_name = g_strdup(camel_store_info_path(imap_store->summary, si));
        if (!g_ascii_strcasecmp(fi->full_name, "inbox")) {
                flags |= CAMEL_FOLDER_SYSTEM|CAMEL_FOLDER_TYPE_INBOX;
@@ -2526,6 +2529,7 @@ get_folders_sync(CamelImapStore *imap_store, const char *pattern, CamelException
        /* We do a LIST followed by LSUB, and merge the results.  LSUB may not be a strict
           subset of LIST for some servers, so we can't use either or separately */
        present = g_hash_table_new(folder_hash, folder_eq);
+
        for (j=0;j<2;j++) {
                response = camel_imap_command (imap_store, NULL, ex,
                                               "%s \"\" %G", j==1 ? "LSUB" : "LIST",
@@ -2539,7 +2543,7 @@ get_folders_sync(CamelImapStore *imap_store, const char *pattern, CamelException
                        if (fi) {
                                hfi = g_hash_table_lookup(present, fi->full_name);
                                if (hfi == NULL) {
-                                       if (j==1) {
+                                       if (j == 1) {
                                                fi->flags |= CAMEL_STORE_INFO_FOLDER_SUBSCRIBED;
                                                if ((fi->flags & (CAMEL_IMAP_FOLDER_MARKED | CAMEL_IMAP_FOLDER_UNMARKED)))
                                                        imap_store->capabilities |= IMAP_CAPABILITY_useful_lsub;
@@ -2559,6 +2563,7 @@ get_folders_sync(CamelImapStore *imap_store, const char *pattern, CamelException
 
        /* FIXME: we need to emit folder_create/subscribed/etc events for any new folders */
        count = camel_store_summary_count((CamelStoreSummary *)imap_store->summary);
+
        for (i=0;i<count;i++) {
                si = camel_store_summary_index((CamelStoreSummary *)imap_store->summary, i);
                if (si == NULL)
@@ -2814,8 +2819,7 @@ get_folder_info_offline (CamelStore *store, const char *top,
        /* folder_info_build will insert parent nodes as necessary and mark
         * them as noselect, which is information we actually don't have at
         * the moment. So let it do the right thing by bailing out if it's
-        * not a folder we're explicitly interested in.
-        */
+        * not a folder we're explicitly interested in. */
 
        for (i=0;i<camel_store_summary_count((CamelStoreSummary *)imap_store->summary);i++) {
                CamelStoreInfo *si = camel_store_summary_index((CamelStoreSummary *)imap_store->summary, i);
@@ -2829,6 +2833,7 @@ get_folder_info_offline (CamelStore *store, const char *top,
                    && ((imap_store->parameters & IMAP_PARAM_SUBSCRIPTIONS) == 0
                        || (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED) == 0
                        || (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED))) {
+
                        fi = imap_build_folder_info(imap_store, camel_store_info_path((CamelStoreSummary *)imap_store->summary, si));
                        fi->unread = si->unread;
                        fi->total = si->total;
@@ -3027,7 +3032,7 @@ camel_imap_store_readline (CamelImapStore *store, char **dest, CamelException *e
 
        ba = g_byte_array_new ();
        while ((nread = camel_stream_buffer_gets (stream, linebuf, sizeof (linebuf))) > 0) {
-               g_byte_array_append (ba, linebuf, nread);
+               g_byte_array_append (ba, (const guint8 *) linebuf, nread);
                if (linebuf[nread - 1] == '\n')
                        break;
        }
index 33179df..5bb3fae 100644 (file)
@@ -66,7 +66,7 @@ enum {
        CAMEL_IMAP_STORE_ARG_CHECK_ALL,
        CAMEL_IMAP_STORE_ARG_FILTER_INBOX,
        CAMEL_IMAP_STORE_ARG_FILTER_JUNK,
-       CAMEL_IMAP_STORE_ARG_FILTER_JUNK_INBOX,
+       CAMEL_IMAP_STORE_ARG_FILTER_JUNK_INBOX
 };
 
 #define CAMEL_IMAP_STORE_NAMESPACE           (CAMEL_IMAP_STORE_ARG_NAMESPACE | CAMEL_ARG_STR)
index f7332e8..3e976d1 100644 (file)
@@ -125,7 +125,7 @@ imap_namespace_decode (const char **in, struct _namespace **namespace)
                        }
 
                        /* decode IMAP's modified UTF-7 into UTF-8 */
-                       node->prefix = imap_mailbox_decode (astring, len);
+                       node->prefix = imap_mailbox_decode ((const unsigned char *) astring, len);
                        g_free (astring);
                        if (!node->prefix) {
                                g_free (node);
@@ -385,7 +385,7 @@ imap_parse_list_response (CamelImapStore *store, const char *buf, int *flags, ch
 
                *folder = astring;
 
-               mailbox = imap_mailbox_decode (astring, strlen (astring));
+               mailbox = imap_mailbox_decode ((const unsigned char *) astring, strlen (astring));
                g_free (astring);
                if (!mailbox)
                        return FALSE;
@@ -967,6 +967,7 @@ imap_body_decode (const char **in, CamelMessageContentInfo *ci, CamelFolder *fol
 
                /* size */
                size = strtoul ((const char *) inptr, &p, 10);
+
                /* check if the size wasn't negative */
                if (p) {
                        while (inptr < p && *inptr != '-')
index b00460b..c3a50a7 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-14  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Merge a bunch of compiler warning fixes and cosmetic
+          cleanups from camel-lite.
+
 2007-06-04  Jeffrey Stedfast  <fejj@gnome.org>
 
        * camel-imap4-summary.c (imap4_fetch_all_update): Don't iterate
index 60e3c21..42e46a1 100644 (file)
@@ -354,7 +354,7 @@ store_info_to_folder_info (CamelStoreSummary *s, CamelStoreInfo *si)
        CamelFolderInfo *fi;
        const char *name;
 
-       fi = g_malloc0 (sizeof (CamelFolderInfo));
+       fi = camel_folder_info_new ();
        fi->full_name = g_strdup (camel_store_info_path (s, si));
        fi->uri = g_strdup (camel_store_info_uri (s, si));
        fi->flags = si->flags;
index 9e900d2..3f67f04 100644 (file)
@@ -873,7 +873,7 @@ imap4_folder_create (CamelStore *store, const char *folder_name, const char *sub
 
                c = strrchr (folder_name, '/');
 
-               fi = g_malloc0 (sizeof (CamelFolderInfo));
+               fi = camel_folder_info_new ();
                fi->full_name = g_strdup (folder_name);
                fi->name = g_strdup (c ? c + 1: folder_name);
                fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
@@ -1048,7 +1048,7 @@ imap4_delete_folder (CamelStore *store, const char *folder_name, CamelException
 
                p = strrchr (folder_name, '/');
 
-               fi = g_malloc0 (sizeof (CamelFolderInfo));
+               fi = camel_folder_info_new ();
                fi->full_name = g_strdup (folder_name);
                fi->name = g_strdup (p ? p + 1: folder_name);
                fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
@@ -1278,7 +1278,7 @@ imap4_build_folder_info (CamelStore *store, const char *top, guint32 flags, GPtr
 
        for (i = 0; i < array->len; i++) {
                list = array->pdata[i];
-               fi = g_malloc0 (sizeof (CamelFolderInfo));
+               fi = camel_folder_info_new ();
 
                p = name = camel_utf7_utf8 (list->name);
                while (*p != '\0') {
@@ -1551,7 +1551,7 @@ imap4_subscribe_folder (CamelStore *store, const char *folder_name, CamelExcepti
 
                p = strrchr (folder_name, '/');
 
-               fi = g_malloc0 (sizeof (CamelFolderInfo));
+               fi = camel_folder_info_new ();
                fi->full_name = g_strdup (folder_name);
                fi->name = g_strdup (p ? p + 1: folder_name);
                fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
@@ -1623,7 +1623,7 @@ imap4_unsubscribe_folder (CamelStore *store, const char *folder_name, CamelExcep
 
                p = strrchr (folder_name, '/');
 
-               fi = g_malloc0 (sizeof (CamelFolderInfo));
+               fi = camel_folder_info_new ();
                fi->full_name = g_strdup (folder_name);
                fi->name = g_strdup (p ? p + 1: folder_name);
                fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
index 99546ce..22c5b8a 100644 (file)
@@ -129,7 +129,6 @@ camel_imap4_summary_init (CamelIMAP4Summary *summary, CamelIMAP4SummaryClass *kl
 static void
 camel_imap4_summary_finalize (CamelObject *object)
 {
-       ;
 }
 
 
index 50b2ee3..403e9e8 100644 (file)
@@ -560,7 +560,7 @@ folders_build_info(CamelURL *base, struct _list_info *li)
        sprintf(path, "/%s", full_name);
        camel_url_set_path(base, path);
 
-       fi = g_malloc0(sizeof(*fi));
+       fi = camel_folder_info_new();
        fi->uri = camel_url_to_string(base, CAMEL_URL_HIDE_ALL);
        fi->name = g_strdup(name);
        fi->full_name = full_name;
@@ -721,7 +721,7 @@ imap_get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExc
                CamelURL *uri = camel_url_copy(((CamelService *)store)->url);
 
                camel_url_set_path(uri, "/INBOX");
-               fi = g_malloc0(sizeof(*fi));
+               fi = camel_folder_info_new();
                fi->url = camel_url_to_string(uri, CAMEL_URL_HIDE_ALL);
                camel_url_free(uri);
                fi->name = g_strdup("INBOX");
index 2fb9d1a..3452f30 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-14  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Merge a bunch of compiler warning fixes and cosmetic
+          cleanups from camel-lite.
+
 2007-09-07  Kjartan Maraas  <kmaraas@gnome.org>
 
        * camel-maildir-summary.c: (maildir_summary_next_uid_string),
index 9f063c7..2880c39 100644 (file)
@@ -149,9 +149,8 @@ local_finalize(CamelObject * object)
                folder->summary = NULL;
        }
 
-       if (local_folder->search) {
+       if (local_folder->search)
                camel_object_unref((CamelObject *)local_folder->search);
-       }
 
        if (local_folder->index)
                camel_object_unref((CamelObject *)local_folder->index);
@@ -308,7 +307,7 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con
                url = camel_url_copy (((CamelService *) parent_store)->url);
                camel_url_set_fragment (url, full_name);
 
-               fi = g_new0 (CamelFolderInfo, 1);
+               fi = camel_folder_info_new ();
                fi->full_name = g_strdup (full_name);
                fi->name = g_strdup (name);
                fi->uri = camel_url_to_string (url, 0);
index 44333b3..1a9830f 100644 (file)
@@ -44,7 +44,7 @@ enum {
 };
 
 enum {
-       CAMEL_LOCAL_FOLDER_INDEX_BODY = CAMEL_LOCAL_FOLDER_ARG_INDEX_BODY | CAMEL_ARG_BOO,
+       CAMEL_LOCAL_FOLDER_INDEX_BODY = CAMEL_LOCAL_FOLDER_ARG_INDEX_BODY | CAMEL_ARG_BOO
 };
 
 typedef struct {
index 7151e7c..2f16247 100644 (file)
@@ -45,7 +45,7 @@
 #include "camel-local-folder.h"
 #include "camel-local-store.h"
 
-#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
+#define d(x)
 
 /* Returns the class for a CamelLocalStore */
 #define CLOCALS_CLASS(so) CAMEL_LOCAL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
@@ -402,7 +402,7 @@ rename_folder(CamelStore *store, const char *old, const char *new, CamelExceptio
        g_free(oldibex);
 
        if (folder)
-               camel_object_unref(folder);
+               camel_object_unref (folder);
 
        return;
 
@@ -500,7 +500,7 @@ delete_folder(CamelStore *store, const char *folder_name, CamelException *ex)
        g_free (str);
        g_free (name);
 
-       fi = g_new0 (CamelFolderInfo, 1);
+       fi = camel_folder_info_new ();
        fi->full_name = g_strdup (folder_name);
        fi->name = g_path_get_basename (folder_name);
        fi->uri = g_strdup_printf ("%s:%s#%s", ((CamelService *) store)->url->protocol,
index eff3621..56676b8 100644 (file)
@@ -39,7 +39,7 @@ typedef struct _CamelLocalSummaryClass CamelLocalSummaryClass;
 enum {
        CAMEL_MESSAGE_FOLDER_NOXEV = 1<<17,
        CAMEL_MESSAGE_FOLDER_XEVCHANGE = 1<<18,
-       CAMEL_MESSAGE_FOLDER_NOTSEEN = 1<<19, /* have we seen this in processing this loop? */
+       CAMEL_MESSAGE_FOLDER_NOTSEEN = 1<<19 /* have we seen this in processing this loop? */
 };
 
 typedef struct _CamelLocalMessageInfo CamelLocalMessageInfo;
index 25d73a2..1dbfb36 100644 (file)
@@ -229,7 +229,8 @@ maildir_append_message (CamelFolder *folder, CamelMimeMessage *message, const Ca
        g_free (dest);
 }
 
-static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex)
+static CamelMimeMessage *
+maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex)
 {
        CamelLocalFolder *lf = (CamelLocalFolder *)folder;
        CamelStream *message_stream = NULL;
index e3fc54b..605cebf 100644 (file)
@@ -366,13 +366,15 @@ static CamelFolderInfo *scan_fi(CamelStore *store, guint32 flags, CamelURL *url,
        char *tmp, *cur, *new;
        struct stat st;
 
-       fi = g_malloc0(sizeof(*fi));
+       fi = camel_folder_info_new();
        fi->full_name = g_strdup(full);
        fi->name = g_strdup(name);
        camel_url_set_fragment(url, fi->full_name);
        fi->uri = camel_url_to_string(url, 0);
+
        fi->unread = -1;
        fi->total = -1;
+
        /* we only calculate nochildren properly if we're recursive */
        if (((flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) != 0))
                fi->flags = CAMEL_FOLDER_NOCHILDREN;
index 7b74802..a173a82 100644 (file)
@@ -159,7 +159,8 @@ camel_maildir_summary_finalise(CamelObject *obj)
  *
  * Return value: A new #CamelMaildirSummary object.
  **/
-CamelMaildirSummary    *camel_maildir_summary_new(struct _CamelFolder *folder, const char *filename, const char *maildirdir, CamelIndex *index)
+CamelMaildirSummary
+*camel_maildir_summary_new(struct _CamelFolder *folder, const char *filename, const char *maildirdir, CamelIndex *index)
 {
        CamelMaildirSummary *o = (CamelMaildirSummary *)camel_object_new(camel_maildir_summary_get_type ());
 
@@ -196,6 +197,7 @@ char *camel_maildir_summary_info_to_name(const CamelMaildirMessageInfo *info)
                if (info->info.info.flags & flagbits[i].flagbit)
                        *p++ = flagbits[i].flag;
        }
+
        *p = 0;
 
        return g_strdup(buf);
@@ -209,12 +211,13 @@ int camel_maildir_summary_name_to_info(CamelMaildirMessageInfo *info, const char
        /*guint32 all = 0;*/    /* all flags */
        int i;
 
-       p = strstr(name, ":2,");
+       p = strstr (name, ":2,");
+
        if (p) {
                p+=3;
                while ((c = *p++)) {
                        /* we could assume that the flags are in order, but its just as easy not to require */
-                       for (i=0;i<sizeof(flagbits)/sizeof(flagbits[0]);i++) {
+                       for (i=0; i < sizeof(flagbits)/sizeof(flagbits[0]);i++) {
                                if (flagbits[i].flag == c && (info->info.info.flags & flagbits[i].flagbit) == 0) {
                                        set |= flagbits[i].flagbit;
                                }
@@ -249,7 +252,8 @@ static char *maildir_summary_encode_x_evolution(CamelLocalSummary *cls, const Ca
 /* FIXME:
    both 'new' and 'add' will try and set the filename, this is not ideal ...
 */
-static CamelMessageInfo *maildir_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *changes, CamelException *ex)
+static CamelMessageInfo *
+maildir_summary_add (CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *changes, CamelException *ex)
 {
        CamelMaildirMessageInfo *mi;
 
@@ -327,7 +331,8 @@ static CamelMessageInfo *message_info_new_from_header(CamelFolderSummary * s, st
 }
 
 
-static void message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
+static void
+message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
 {
 #if !defined (DOEPOOLV) && !defined (DOESTRV)
        CamelMaildirMessageInfo *mdi = (CamelMaildirMessageInfo *)mi;
@@ -422,8 +427,8 @@ static int maildir_summary_load(CamelLocalSummary *cls, int forceindex, CamelExc
        dir = opendir(cur);
        if (dir == NULL) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     _("Cannot open maildir directory path: %s: %s"),
-                                     cls->folder_path, g_strerror (errno));
+                       _("Cannot open maildir directory path: %s: %s"),
+                       cls->folder_path, g_strerror (errno));
                g_free(cur);
                return -1;
        }
@@ -460,7 +465,8 @@ static int maildir_summary_load(CamelLocalSummary *cls, int forceindex, CamelExc
        return ret;
 }
 
-static int camel_maildir_summary_add(CamelLocalSummary *cls, const char *name, int forceindex)
+static int
+camel_maildir_summary_add (CamelLocalSummary *cls, const char *name, int forceindex)
 {
        CamelMaildirSummary *maildirs = (CamelMaildirSummary *)cls;
        char *filename = g_strdup_printf("%s/cur/%s", cls->folder_path, name);
@@ -553,8 +559,8 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca
        dir = opendir(cur);
        if (dir == NULL) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     _("Cannot open maildir directory path: %s: %s"),
-                                     cls->folder_path, g_strerror (errno));
+                       _("Cannot open maildir directory path: %s: %s"),
+                       cls->folder_path, g_strerror (errno));
                g_free(cur);
                g_free(new);
                camel_operation_end(NULL);
@@ -606,7 +612,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca
                info = camel_folder_summary_uid((CamelFolderSummary *)cls, uid);
                if (info == NULL) {
                        /* must be a message incorporated by another client, this is not a 'recent' uid */
-                       if (camel_maildir_summary_add(cls, d->d_name, forceindex) == 0)
+                       if (camel_maildir_summary_add (cls, d->d_name, forceindex) == 0)
                                if (changes)
                                        camel_folder_change_info_add_uid(changes, uid);
                } else {
@@ -689,7 +695,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca
                        /* FIXME: This should probably use link/unlink */
 
                        if (rename(src, dest) == 0) {
-                               camel_maildir_summary_add(cls, destfilename, forceindex);
+                               camel_maildir_summary_add (cls, destfilename, forceindex);
                                if (changes) {
                                        camel_folder_change_info_add_uid(changes, destname);
                                        camel_folder_change_info_recent_uid(changes, destname);
index 6770d3c..7bcd9a2 100644 (file)
@@ -41,7 +41,7 @@ typedef struct _CamelMaildirMessageContentInfo {
 
 enum {
        CAMEL_MAILDIR_INFO_FILENAME = CAMEL_MESSAGE_INFO_LAST,
-       CAMEL_MAILDIR_INFO_LAST,
+       CAMEL_MAILDIR_INFO_LAST
 };
 
 typedef struct _CamelMaildirMessageInfo {
index 7d00cfd..53e04ee 100644 (file)
@@ -332,7 +332,7 @@ delete_folder(CamelStore *store, const char *folder_name, CamelException *ex)
        g_free(path);
        g_free(name);
 
-       fi = g_new0(CamelFolderInfo, 1);
+       fi = camel_folder_info_new ();
        fi->full_name = g_strdup(folder_name);
        fi->name = g_path_get_basename(folder_name);
        fi->uri = g_strdup_printf("mbox:%s#%s",((CamelService *) store)->url->path, folder_name);
@@ -713,7 +713,7 @@ scan_dir(CamelStore *store, CamelURL *url, GHashTable *visited, CamelFolderInfo
                                fi->flags &= ~CAMEL_FOLDER_NOSELECT;
                        }
                } else {
-                       fi = g_new0(CamelFolderInfo, 1);
+                       fi = camel_folder_info_new ();
                        fi->parent = parent;
 
                        camel_url_set_fragment (url, full_name);
@@ -822,7 +822,7 @@ get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExceptio
        url = camel_url_copy (((CamelService *) store)->url);
        camel_url_set_fragment (url, top);
 
-       fi = g_new0(CamelFolderInfo, 1);
+       fi = camel_folder_info_new ();
        fi->parent = NULL;
        fi->uri = camel_url_to_string (url, 0);
        fi->name = basename;
index 2d2c55f..a484dbe 100644 (file)
@@ -406,7 +406,7 @@ message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
        io(printf("saving mbox message info\n"));
 
        if (((CamelFolderSummaryClass *)camel_mbox_summary_parent)->message_info_save(s, out, mi) == -1
-           || camel_file_util_encode_off_t(out, mbi->frompos) == -1)
+           || camel_file_util_encode_off_t (out, mbi->frompos) == -1)
                return -1;
 
        return 0;
@@ -1012,7 +1012,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
                        }
 #endif
                        if (len == -1) {
-                               d(printf("Writing to temporary mailbox failed\n"));
+                               d(printf("Error writing to temporary mailbox\n"));
                                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
                                                      _("Writing to temporary mailbox failed: %s"),
                                                      g_strerror (errno));
index 40159e6..3aab29c 100644 (file)
@@ -108,7 +108,7 @@ enum {
        UPDATE_NONE,
        UPDATE_ADD,
        UPDATE_REMOVE,
-       UPDATE_RENAME,
+       UPDATE_RENAME
 };
 
 /* update the .folders file if it exists, or create it if it doesn't */
@@ -358,7 +358,7 @@ folder_info_new (CamelStore *store, CamelURL *url, const char *root, const char
        camel_url_set_fragment (url, path);
 
        /* Build the folder info structure. */
-       fi = g_malloc0(sizeof(*fi));
+       fi = camel_folder_info_new();
        fi->uri = camel_url_to_string (url, 0);
        fi->full_name = g_strdup(path);
        fi->name = g_strdup(base?base+1:path);
index bbe0559..da89eb1 100644 (file)
@@ -32,7 +32,7 @@
 G_BEGIN_DECLS
 
 enum {
-       CAMEL_MH_DOTFOLDERS = (1<<0), /* update/use .folders file */
+       CAMEL_MH_DOTFOLDERS = (1<<0) /* update/use .folders file */
 };
 
 typedef struct {
index 20f1a9d..bcfff6b 100644 (file)
@@ -279,7 +279,7 @@ spool_new_fi(CamelStore *store, CamelFolderInfo *parent, CamelFolderInfo **fip,
        else
                name = full;
 
-       fi = g_malloc0(sizeof(*fi));
+       fi = camel_folder_info_new();
        url = camel_url_copy(((CamelService *)store)->url);
        camel_url_set_fragment(url, full);
        fi->uri = camel_url_to_string(url, 0);
index 3ba1c1b..1198dd5 100644 (file)
@@ -34,7 +34,7 @@ G_BEGIN_DECLS
 
 typedef enum _camel_spool_store_t {
        CAMEL_SPOOL_STORE_MBOX, /* a single mbox */
-       CAMEL_SPOOL_STORE_ELM,  /* elm/pine/etc tree of mbox files in folders */
+       CAMEL_SPOOL_STORE_ELM   /* elm/pine/etc tree of mbox files in folders */
 } camel_spool_store_t;
 
 typedef struct {
index 4197605..4c01a2f 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-14  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Merge a bunch of compiler warning fixes and cosmetic
+          cleanups from camel-lite.
+
 2007-05-14  Jules Colding  <colding@omesc.com>
 
        * camel-nntp-newsrc.c (camel_nntp_newsrc_read_for_server): Fix file descriptor leak
index 624a08a..9834836 100644 (file)
@@ -41,7 +41,7 @@ typedef struct _CamelNNTPStoreInfo CamelNNTPStoreInfo;
 
 enum {
        CAMEL_NNTP_STORE_INFO_FULL_NAME = CAMEL_STORE_INFO_LAST,
-       CAMEL_NNTP_STORE_INFO_LAST,
+       CAMEL_NNTP_STORE_INFO_LAST
 };
 
 struct _CamelNNTPStoreInfo {
index cddf8af..7b8e55f 100644 (file)
@@ -119,7 +119,7 @@ xover_setup(CamelNNTPStore *store, CamelException *ex)
 
        /* supported command */
        while ((ret = camel_nntp_stream_line(store->stream, (unsigned char **)&line, &len)) > 0) {
-               p = line;
+               p = (unsigned char *) line;
                xover = g_malloc0(sizeof(*xover));
                last->next = xover;
                last = xover;
@@ -129,7 +129,7 @@ xover_setup(CamelNNTPStore *store, CamelException *ex)
                                for (i=0;i<sizeof(headers)/sizeof(headers[0]);i++) {
                                        if (strcmp(line, headers[i].name) == 0) {
                                                xover->name = headers[i].name;
-                                               if (strncmp(p, "full", 4) == 0)
+                                               if (strncmp((char *) p, "full", 4) == 0)
                                                        xover->skip = strlen(xover->name)+1;
                                                else
                                                        xover->skip = 0;
@@ -150,7 +150,7 @@ xover_setup(CamelNNTPStore *store, CamelException *ex)
 enum {
        MODE_CLEAR,
        MODE_SSL,
-       MODE_TLS,
+       MODE_TLS
 };
 
 #ifdef HAVE_SSL
@@ -223,7 +223,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam
                goto fail;
        }
 
-       len = strtoul (buf, (char **) &buf, 10);
+       len = strtoul ((char *) buf, (char **) &buf, 10);
        if (len != 200 && len != 201) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
                                      _("NNTP server %s returned error code %d: %s"),
@@ -468,10 +468,11 @@ static CamelFolderInfo *
 nntp_folder_info_from_store_info (CamelNNTPStore *store, gboolean short_notation, CamelStoreInfo *si)
 {
        CamelURL *base_url = ((CamelService *) store)->url;
-       CamelFolderInfo *fi = g_malloc0(sizeof(*fi));
+       CamelFolderInfo *fi;
        CamelURL *url;
        char *path;
 
+       fi = camel_folder_info_new ();
        fi->full_name = g_strdup (si->path);
 
        if (short_notation)
@@ -494,11 +495,12 @@ nntp_folder_info_from_store_info (CamelNNTPStore *store, gboolean short_notation
 static CamelFolderInfo *
 nntp_folder_info_from_name (CamelNNTPStore *store, gboolean short_notation, const char *name)
 {
-       CamelFolderInfo *fi = g_malloc0(sizeof(*fi));
        CamelURL *base_url = ((CamelService *)store)->url;
+       CamelFolderInfo *fi;
        CamelURL *url;
        char *path;
 
+       fi = camel_folder_info_new ();
        fi->full_name = g_strdup (name);
 
        if (short_notation)
@@ -713,7 +715,7 @@ nntp_get_date(CamelNNTPStore *nntp_store, CamelException *ex)
        nntp_store->summary->last_newslist[0] = 0;
 
        if (ret == 111) {
-               ptr = line + 3;
+               ptr = (char *) line + 3;
                while (*ptr == ' ' || *ptr == '\t')
                        ptr++;
 
@@ -778,7 +780,7 @@ nntp_store_get_folder_info_all(CamelNNTPStore *nntp_store, const char *top, guin
                        }
 
                        while ((ret = camel_nntp_stream_line (nntp_store->stream, &line, &len)) > 0)
-                               nntp_store_info_update(nntp_store, line);
+                               nntp_store_info_update(nntp_store, (char *) line);
                } else {
                        GHashTable *all;
                        int i;
@@ -802,7 +804,7 @@ nntp_store_get_folder_info_all(CamelNNTPStore *nntp_store, const char *top, guin
                                g_hash_table_insert(all, si->info.path, si);
 
                        while ((ret = camel_nntp_stream_line(nntp_store->stream, &line, &len)) > 0) {
-                               si = nntp_store_info_update(nntp_store, line);
+                               si = nntp_store_info_update(nntp_store, (char *) line);
                                g_hash_table_remove(all, si->info.path);
                        }
 
@@ -1203,12 +1205,14 @@ camel_nntp_raw_commandv (CamelNNTPStore *store, CamelException *ex, char **line,
 
        camel_nntp_stream_set_mode(store->stream, CAMEL_NNTP_STREAM_LINE);
 
-       ps = p = fmt;
+       p = (const unsigned char *) fmt;
+       ps = (const unsigned char *) p;
+
        while ((c = *p++)) {
                switch (c) {
                case '%':
                        c = *p++;
-                       camel_stream_write ((CamelStream *) store->mem, ps, p - ps - (c == '%' ? 1 : 2));
+                       camel_stream_write ((CamelStream *) store->mem, (const char *) ps, p - ps - (c == '%' ? 1 : 2));
                        ps = p;
                        switch (c) {
                        case 's':
@@ -1242,11 +1246,11 @@ camel_nntp_raw_commandv (CamelNNTPStore *store, CamelException *ex, char **line,
                }
        }
 
-       camel_stream_write ((CamelStream *) store->mem, ps, p-ps-1);
+       camel_stream_write ((CamelStream *) store->mem, (const char *) ps, p-ps-1);
        dd(printf("NNTP_COMMAND: '%.*s'\n", (int)store->mem->buffer->len, store->mem->buffer->data));
        camel_stream_write ((CamelStream *) store->mem, "\r\n", 2);
 
-       if (camel_stream_write((CamelStream *) store->stream, store->mem->buffer->data, store->mem->buffer->len) == -1)
+       if (camel_stream_write((CamelStream *) store->stream, (const char *) store->mem->buffer->data, store->mem->buffer->len) == -1)
                goto ioerror;
 
        /* FIXME: hack */
index 77695fe..fe89182 100644 (file)
@@ -54,7 +54,7 @@ typedef struct _CamelNNTPStoreClass CamelNNTPStoreClass;
 typedef enum _xover_t {
        XOVER_STRING = 0,
        XOVER_MSGID,
-       XOVER_SIZE,
+       XOVER_SIZE
 } xover_t;
 
 struct _xover_header {
index 72ee834..e7d81ca 100644 (file)
@@ -58,7 +58,7 @@ stream_fill(CamelNNTPStream *is)
                memcpy(is->buf, is->ptr, left);
                is->end = is->buf + left;
                is->ptr = is->buf;
-               left = camel_stream_read(is->source, is->end, CAMEL_NNTP_STREAM_SIZE - (is->end - is->buf));
+               left = camel_stream_read(is->source, (char *) is->end, CAMEL_NNTP_STREAM_SIZE - (is->end - is->buf));
                if (left > 0) {
                        is->end += left;
                        is->end[0] = '\n';
index ae1746a..5d58b19 100644 (file)
@@ -35,7 +35,7 @@ typedef struct _CamelNNTPStream CamelNNTPStream;
 typedef enum {
        CAMEL_NNTP_STREAM_LINE,
        CAMEL_NNTP_STREAM_DATA,
-       CAMEL_NNTP_STREAM_EOD,  /* end of data, acts as if end of stream */
+       CAMEL_NNTP_STREAM_EOD   /* end of data, acts as if end of stream */
 } camel_nntp_stream_mode_t;
 
 struct _CamelNNTPStream {
index 1f928b4..dcfaaad 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-14  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Merge a bunch of compiler warning fixes and cosmetic
+          cleanups from camel-lite.
+
 2007-09-27  Matthew Barnes  <mbarnes@redhat.com>
 
        ** Fixes part of bug #474000
index ceadce2..d5e51e3 100644 (file)
@@ -108,7 +108,7 @@ read_greeting (CamelPOP3Engine *pe)
 
        /* first, read the greeting */
        if (camel_pop3_stream_line (pe->stream, &line, &len) == -1
-           || strncmp ((char *) line, (char *) "+OK", 3) != 0)
+           || strncmp ((char *) line, "+OK", 3) != 0)
                return -1;
 
        if ((apop = (unsigned char *) strchr ((char *) line + 3, '<'))
@@ -205,7 +205,7 @@ cmd_capa(CamelPOP3Engine *pe, CamelPOP3Stream *stream, void *data)
                                        next = (unsigned char *) strchr((char *) tok, ' ');
                                        if (next)
                                                *next++ = 0;
-                                       auth = camel_sasl_authtype((const char *)tok);
+                                       auth = camel_sasl_authtype((const char *) tok);
                                        if (auth) {
                                                dd(printf("got auth type '%s'\n", tok));
                                                pe->auth = g_list_prepend(pe->auth, auth);
@@ -257,24 +257,24 @@ engine_command_queue(CamelPOP3Engine *pe, CamelPOP3Command *pc)
            && pe->current != NULL) {
                e_dlist_addtail(&pe->queue, (EDListNode *)pc);
                return FALSE;
-       } else {
-               /* ??? */
-               if (camel_stream_write((CamelStream *)pe->stream, pc->data, strlen(pc->data)) == -1) {
-                       e_dlist_addtail(&pe->queue, (EDListNode *)pc);
-                       return FALSE;
-               }
+       }
+
+       /* ??? */
+       if (camel_stream_write((CamelStream *)pe->stream, pc->data, strlen(pc->data)) == -1) {
+               e_dlist_addtail(&pe->queue, (EDListNode *)pc);
+               return FALSE;
+       }
 
-               pe->sentlen += strlen(pc->data);
+       pe->sentlen += strlen(pc->data);
 
-               pc->state = CAMEL_POP3_COMMAND_DISPATCHED;
+       pc->state = CAMEL_POP3_COMMAND_DISPATCHED;
 
-               if (pe->current == NULL)
-                       pe->current = pc;
-               else
-                       e_dlist_addtail(&pe->active, (EDListNode *)pc);
+       if (pe->current == NULL)
+               pe->current = pc;
+       else
+               e_dlist_addtail(&pe->active, (EDListNode *)pc);
 
-               return TRUE;
-       }
+       return TRUE;
 }
 
 /* returns -1 on error (sets errno), 0 when no work to do, or >0 if work remaining */
@@ -335,6 +335,7 @@ camel_pop3_engine_iterate(CamelPOP3Engine *pe, CamelPOP3Command *pcwait)
        /* check the queue for sending any we can now send also */
        pw = (CamelPOP3Command *)pe->queue.head;
        pn = pw->next;
+
        while (pn) {
                if (((pe->capa & CAMEL_POP3_CAP_PIPE) == 0 || (pe->sentlen + strlen(pw->data)) > CAMEL_POP3_SEND_LIMIT)
                    && pe->current != NULL)
index c12832d..6f3269d 100644 (file)
@@ -40,7 +40,7 @@ typedef enum {
        CAMEL_POP3_ENGINE_DISCONNECT = 0,
        CAMEL_POP3_ENGINE_AUTH,
        CAMEL_POP3_ENGINE_TRANSACTION,
-       CAMEL_POP3_ENGINE_UPDATE,
+       CAMEL_POP3_ENGINE_UPDATE
 } camel_pop3_engine_t;
 
 /* state of a command */
@@ -51,13 +51,13 @@ typedef enum {
        /* completion codes */
        CAMEL_POP3_COMMAND_OK,  /* plain ok response */
        CAMEL_POP3_COMMAND_DATA, /* processing command response */
-       CAMEL_POP3_COMMAND_ERR, /* error response */
+       CAMEL_POP3_COMMAND_ERR  /* error response */
 } camel_pop3_command_t;
 
 /* flags for command types */
 enum {
        CAMEL_POP3_COMMAND_SIMPLE = 0, /* dont expect multiline response */
-       CAMEL_POP3_COMMAND_MULTI = 1, /* expect multiline response */
+       CAMEL_POP3_COMMAND_MULTI = 1 /* expect multiline response */
 };
 
 /* flags for server options */
index eefa754..c679469 100644 (file)
@@ -252,9 +252,8 @@ pop3_refresh_info (CamelFolder *folder, CamelException *ex)
        pop3_folder->uids_id = g_hash_table_new(NULL, NULL);
 
        pcl = camel_pop3_engine_command_new(pop3_store->engine, CAMEL_POP3_COMMAND_MULTI, cmd_list, folder, "LIST\r\n");
-       if (pop3_store->engine->capa & CAMEL_POP3_CAP_UIDL) {
+       if (pop3_store->engine->capa & CAMEL_POP3_CAP_UIDL)
                pcu = camel_pop3_engine_command_new(pop3_store->engine, CAMEL_POP3_COMMAND_MULTI, cmd_uidl, folder, "UIDL\r\n");
-       }
        while ((i = camel_pop3_engine_iterate(pop3_store->engine, NULL)) > 0)
                ;
 
@@ -303,8 +302,7 @@ pop3_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
        pop3_folder = CAMEL_POP3_FOLDER (folder);
        pop3_store = CAMEL_POP3_STORE (folder->parent_store);
 
-       if(pop3_store->delete_after && !expunge)
-       {
+       if (pop3_store->delete_after && !expunge) {
                d(printf("%s(%d): pop3_store->delete_after = [%d], expunge=[%d]\n",
                         __FILE__, __LINE__, pop3_store->delete_after, expunge));
                camel_operation_start(NULL, _("Expunging old messages"));
@@ -431,7 +429,6 @@ camel_pop3_delete_old(CamelFolder *folder, int days_to_delete,      CamelException *e
        camel_pop3_store_expunge (pop3_store, ex);
 
        return 0;
-
 }
 
 static void
@@ -582,14 +579,14 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
                                camel_exception_setv(ex, CAMEL_EXCEPTION_USER_CANCEL, _("User canceled"));
                        else
                                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                                     _("Cannot get message %s: %s"),
-                                                     uid, g_strerror (fi->err));
+                                       _("Cannot get message %s: %s"),
+                                       uid, g_strerror (fi->err));
                        goto done;
                }
 
                if (camel_stream_read(stream, buffer, 1) != 1 || buffer[0] != '#') {
                        camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
-                                            _("Cannot get message %s: %s"), uid, _("Unknown reason"));
+                                       _("Cannot get message %s: %s"), uid, _("Unknown reason"));
                        goto done;
                }
        }
@@ -600,8 +597,8 @@ pop3_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
                        camel_exception_setv(ex, CAMEL_EXCEPTION_USER_CANCEL, _("User canceled"));
                else
                        camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                             _("Cannot get message %s: %s"),
-                                             uid, g_strerror (errno));
+                               _("Cannot get message %s: %s"),
+                               uid, g_strerror (errno));
                camel_object_unref((CamelObject *)message);
                message = NULL;
        }
index 2ad77ad..8616be9 100644 (file)
@@ -139,7 +139,7 @@ finalize (CamelObject *object)
 enum {
        MODE_CLEAR,
        MODE_SSL,
-       MODE_TLS,
+       MODE_TLS
 };
 
 #ifdef HAVE_SSL
@@ -167,24 +167,23 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam
                }
 #else
                camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-                                     _("Could not connect to %s: %s"),
-                                     service->url->host, _("SSL unavailable"));
+                               _("Could not connect to %s: %s"),
+                               service->url->host, _("SSL unavailable"));
 
                return FALSE;
 #endif /* HAVE_SSL */
-       } else {
+       } else
                tcp_stream = camel_tcp_stream_raw_new ();
-       }
 
        if ((ret = camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai)) == -1) {
                if (errno == EINTR)
                        camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
-                                            _("Connection canceled"));
+                               _("Connection canceled"));
                else
                        camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
-                                             _("Could not connect to %s: %s"),
-                                             service->url->host,
-                                             g_strerror (errno));
+                               _("Could not connect to %s: %s"),
+                               service->url->host,
+                               g_strerror (errno));
 
                camel_object_unref (tcp_stream);
 
@@ -205,8 +204,8 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam
 
        if (!(store->engine = camel_pop3_engine_new (tcp_stream, flags))) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     _("Failed to read a valid greeting from POP server %s"),
-                                     service->url->host);
+                       _("Failed to read a valid greeting from POP server %s"),
+                       service->url->host);
                camel_object_unref (tcp_stream);
                return FALSE;
        }
@@ -219,8 +218,8 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam
 #ifdef HAVE_SSL
        if (!(store->engine->capa & CAMEL_POP3_CAP_STLS)) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     _("Failed to connect to POP server %s in secure mode: %s"),
-                                     service->url->host, _("STLS not supported by server"));
+                       _("Failed to connect to POP server %s in secure mode: %s"),
+                       service->url->host, _("STLS not supported by server"));
                goto stls_exception;
        }
 
@@ -236,8 +235,8 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam
 
        if (ret == FALSE) {
                camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                                     _("Failed to connect to POP server %s in secure mode: %s"),
-                                     service->url->host, store->engine->line);
+                       _("Failed to connect to POP server %s in secure mode: %s"),
+                       service->url->host, store->engine->line);
                goto stls_exception;
        }
 
@@ -252,15 +251,15 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam
        }
 #else
        camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-                             _("Failed to connect to POP server %s in secure mode: %s"),
-                             service->url->host, _("TLS is not available in this build"));
+               _("Failed to connect to POP server %s in secure mode: %s"),
+               service->url->host, _("TLS is not available in this build"));
        goto stls_exception;
 #endif /* HAVE_SSL */
 
        camel_object_unref (tcp_stream);
 
        /* rfc2595, section 4 states that after a successful STLS
-           command, the client MUST discard prior CAPA responses */
+          command, the client MUST discard prior CAPA responses */
        camel_pop3_engine_reget_capabilities (store->engine);
 
        return TRUE;
@@ -350,7 +349,7 @@ query_auth_types (CamelService *service, CamelException *ex)
        CamelPOP3Store *store = CAMEL_POP3_STORE (service);
        GList *types = NULL;
 
-        types = CAMEL_SERVICE_CLASS (parent_class)->query_auth_types (service, ex);
+       types = CAMEL_SERVICE_CLASS (parent_class)->query_auth_types (service, ex);
        if (camel_exception_is_set (ex))
                return NULL;
 
@@ -412,9 +411,9 @@ try_sasl(CamelPOP3Store *store, const char *mech, CamelException *ex)
        while (1) {
                if (camel_pop3_stream_line(stream, &line, &len) == -1)
                        goto ioerror;
-               if (strncmp((char *) line, (char *) "+OK", 3) == 0)
+               if (strncmp((char *) line, "+OK", 3) == 0)
                        break;
-               if (strncmp((char *) line, (char *) "-ERR", 4) == 0) {
+               if (strncmp((char *) line, "-ERR", 4) == 0) {
                        camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
                                              _("SASL `%s' Login failed for POP server %s: %s"),
                                              mech, CAMEL_SERVICE (store)->url->host, line);
@@ -422,7 +421,7 @@ try_sasl(CamelPOP3Store *store, const char *mech, CamelException *ex)
                }
                /* If we dont get continuation, or the sasl object's run out of work, or we dont get a challenge,
                   its a protocol error, so fail, and try reset the server */
-               if (strncmp((char *) line, (char *) "+ ", 2) != 0
+               if (strncmp((char *) line, "+ ", 2) != 0
                    || camel_sasl_authenticated(sasl)
                    || (resp = (unsigned char *) camel_sasl_challenge_base64(sasl, (const char *) line+2, ex)) == NULL) {
                        camel_stream_printf((CamelStream *)stream, "*\r\n");
@@ -561,7 +560,7 @@ pop3_try_authenticate (CamelService *service, gboolean reprompt, const char *err
                                      CAMEL_SERVICE (store)->url->host,
                                      store->engine->line ? (char *)store->engine->line : _("Unknown error"));
 
-       camel_pop3_engine_command_free(store->engine, pcp);
+       camel_pop3_engine_command_free (store->engine, pcp);
 
        if (pcu)
                camel_pop3_engine_command_free(store->engine, pcu);
index b69cad8..bebf0d5 100644 (file)
@@ -57,7 +57,7 @@ stream_fill(CamelPOP3Stream *is)
                memcpy(is->buf, is->ptr, left);
                is->end = is->buf + left;
                is->ptr = is->buf;
-               left = camel_stream_read(is->source, is->end, CAMEL_POP3_STREAM_SIZE - (is->end - is->buf));
+               left = camel_stream_read(is->source, (char *) is->end, CAMEL_POP3_STREAM_SIZE - (is->end - is->buf));
                if (left > 0) {
                        is->end += left;
                        is->end[0] = '\n';
index 9790cad..459c4ce 100644 (file)
@@ -38,7 +38,7 @@ typedef struct _CamelPOP3Stream CamelPOP3Stream;
 typedef enum {
        CAMEL_POP3_STREAM_LINE,
        CAMEL_POP3_STREAM_DATA,
-       CAMEL_POP3_STREAM_EOD,  /* end of data, acts as if end of stream */
+       CAMEL_POP3_STREAM_EOD   /* end of data, acts as if end of stream */
 } camel_pop3_stream_mode_t;
 
 struct _CamelPOP3Stream {
index 1321459..3e49e97 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-14  Matthew Barnes  <mbarnes@redhat.com>
+
+       ** Merge a bunch of compiler warning fixes and cosmetic
+          cleanups from camel-lite.
+
 2007-03-26  Matthew Barnes  <mbarnes@redhat.com>
 
        * camel-smtp-transport.c (smtp_auth):
index 38c5fd2..ce776dd 100644 (file)
@@ -223,7 +223,7 @@ smtp_error_string (int error)
 enum {
        MODE_CLEAR,
        MODE_SSL,
-       MODE_TLS,
+       MODE_TLS
 };
 
 #ifdef HAVE_SSL
@@ -527,7 +527,7 @@ smtp_connect (CamelService *service, CamelException *ex)
                                                          service->url->host);
 
                                service->url->passwd = camel_session_get_password (session, service, NULL,
-                                                                                  prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
+                                               prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
 
                                g_free (prompt);
                                g_free (errbuf);
@@ -623,7 +623,7 @@ esmtp_get_authtypes (const unsigned char *buffer)
                while (*end && !isspace ((int) *end))
                        end++;
 
-               type = g_strndup (start, end - start);
+               type = g_strndup ((gchar*) start, end - start);
                g_hash_table_insert (table, type, type);
 
                /* advance to the next token */
@@ -795,7 +795,8 @@ smtp_decode_status_code (const char *in, size_t len)
        const unsigned char *inend;
        char *outbuf;
 
-       outptr = outbuf = g_malloc (len + 1);
+       outbuf = (char *) g_malloc (len + 1);
+       outptr = (unsigned char *) outbuf;
 
        inptr = (unsigned char *) in;
        inend = inptr + len;
@@ -980,7 +981,7 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
                                                g_hash_table_destroy (transport->authtypes);
                                        }
 
-                                       transport->authtypes = esmtp_get_authtypes (token);
+                                       transport->authtypes = esmtp_get_authtypes ((const unsigned char *) token);
                                }
                        }
                }
@@ -1401,6 +1402,7 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex)
                        return FALSE;
                }
        } while (*(respbuf+3) == '-'); /* if we got "221-" then loop again */
+
        g_free (respbuf);
 
        return TRUE;