[evolution-data-server] Fix compiler warnings in camel.



commit 9f9118ac2cd355ec363632d30036faca173e31d5
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Jun 1 12:03:11 2009 -0400

    Fix compiler warnings in camel.
---
 addressbook/backends/file/e-book-backend-file.c    |    8 +-
 .../backends/google/e-book-backend-google.c        |   18 +-
 .../backends/groupwise/e-book-backend-groupwise.c  |   44 ++--
 addressbook/backends/ldap/e-book-backend-ldap.c    |   54 ++--
 addressbook/backends/ldap/openldap-extract.h       |   50 ++--
 .../backends/webdav/e-book-backend-webdav.c        |    4 +-
 addressbook/libebook/e-book-query.c                |    4 +-
 addressbook/libebook/e-book.c                      |    2 +-
 addressbook/libebook/e-contact.c                   |    2 +-
 addressbook/libebook/e-contact.h                   |    4 +-
 addressbook/libebook/e-destination.c               |    6 +-
 addressbook/libebook/e-name-western.c              |    6 +-
 addressbook/libebook/e-vcard.c                     |   10 +-
 addressbook/libedata-book/e-book-backend-cache.c   |    2 +-
 .../libedata-book/e-book-backend-db-cache.c        |   16 +-
 addressbook/tests/ebook/test-query.c               |    2 +-
 calendar/backends/caldav/e-cal-backend-caldav.c    |    6 +-
 calendar/backends/file/e-cal-backend-file.c        |    4 +-
 .../groupwise/e-cal-backend-groupwise-utils.c      |    2 +-
 .../backends/groupwise/e-cal-backend-groupwise.c   |    2 +-
 calendar/backends/weather/e-cal-backend-weather.c  |    2 +-
 calendar/backends/weather/e-weather-source-ccf.c   |    6 +-
 calendar/libecal/e-cal-check-timezones.c           |   10 +-
 calendar/libecal/e-cal-component.c                 |    2 +-
 calendar/libecal/e-cal-recur.c                     |    2 +-
 calendar/libecal/e-cal-system-timezone.c           |    4 +-
 calendar/libecal/e-cal-time-util.h                 |    8 +-
 calendar/libedata-cal/e-cal-backend-sexp.c         |    6 +-
 calendar/libedata-cal/e-data-cal-factory.c         |    4 +-
 calendar/libedata-cal/e-data-cal-view.c            |    2 +-
 camel/Makefile.am                                  |    1 -
 camel/camel-address.h                              |   14 +-
 camel/camel-arg.c                                  |    6 +-
 camel/camel-arg.h                                  |   10 +-
 camel/camel-block-file.c                           |   36 +-
 camel/camel-block-file.h                           |   12 +-
 camel/camel-certdb.c                               |    6 +-
 camel/camel-charset-map.c                          |   10 +-
 camel/camel-cipher-context.c                       |    8 +-
 camel/camel-cipher-context.h                       |    2 +-
 camel/camel-data-wrapper.c                         |   18 +-
 camel/camel-data-wrapper.h                         |    8 +-
 camel/camel-db.c                                   |   56 ++--
 camel/camel-db.h                                   |    6 +-
 camel/camel-debug.c                                |    2 +-
 camel/camel-digest-store.c                         |    4 +-
 camel/camel-disco-diary.c                          |    4 +-
 camel/camel-disco-folder.c                         |    4 +-
 camel/camel-disco-store.c                          |    4 +-
 camel/camel-file-utils.c                           |   44 ++--
 camel/camel-file-utils.h                           |   16 +-
 camel/camel-filter-driver.c                        |   10 +-
 camel/camel-filter-search.c                        |    4 +-
 camel/camel-folder-search.c                        |    8 +-
 camel/camel-folder-summary.c                       |  120 ++++---
 camel/camel-folder-summary.h                       |   12 +-
 camel/camel-folder-thread.c                        |   12 +-
 camel/camel-folder.c                               |    6 +-
 camel/camel-gpg-context.c                          |  102 +++---
 camel/camel-http-stream.c                          |   38 ++-
 camel/camel-iconv.c                                |   10 +-
 camel/camel-index-control.c                        |   18 +-
 camel/camel-index.c                                |    4 +-
 camel/camel-index.h                                |   20 +-
 camel/camel-internet-address.c                     |    8 +-
 camel/camel-internet-address.h                     |    6 +-
 camel/camel-mime-filter-basic.c                    |   30 +-
 camel/camel-mime-filter-bestenc.c                  |    6 +-
 camel/camel-mime-filter-canon.c                    |   16 +-
 camel/camel-mime-filter-charset.c                  |   24 +-
 camel/camel-mime-filter-crlf.c                     |   18 +-
 camel/camel-mime-filter-enriched.c                 |   34 +-
 camel/camel-mime-filter-from.c                     |   12 +-
 camel/camel-mime-filter-gzip.c                     |   28 +-
 camel/camel-mime-filter-html.c                     |   10 +-
 camel/camel-mime-filter-index.c                    |   10 +-
 camel/camel-mime-filter-linewrap.c                 |   21 +-
 camel/camel-mime-filter-pgp.c                      |   18 +-
 camel/camel-mime-filter-progress.c                 |   16 +-
 camel/camel-mime-filter-progress.h                 |    6 +-
 camel/camel-mime-filter-save.c                     |   20 +-
 camel/camel-mime-filter-tohtml.c                   |   31 +-
 camel/camel-mime-filter-windows.c                  |   10 +-
 camel/camel-mime-filter-yenc.c                     |   38 +-
 camel/camel-mime-filter-yenc.h                     |    6 +-
 camel/camel-mime-filter.c                          |   32 +-
 camel/camel-mime-filter.h                          |   28 +-
 camel/camel-mime-message.c                         |   22 +-
 camel/camel-mime-parser.c                          |   30 +-
 camel/camel-mime-parser.h                          |   10 +-
 camel/camel-mime-part-utils.c                      |    2 +-
 camel/camel-mime-part.c                            |  117 +++++--
 camel/camel-mime-part.h                            |    4 +-
 camel/camel-mime-utils.c                           |  203 ++++++------
 camel/camel-mime-utils.h                           |   50 ++--
 camel/camel-movemail.c                             |   20 +-
 camel/camel-msgport.c                              |    4 +-
 camel/camel-multipart-signed.c                     |   22 +-
 camel/camel-multipart.c                            |   16 +-
 camel/camel-multipart.h                            |    2 +-
 camel/camel-net-utils.c                            |   12 +-
 camel/camel-net-utils.h                            |    2 +-
 camel/camel-nntp-address.c                         |    4 +-
 camel/camel-nntp-address.h                         |    2 +-
 camel/camel-object.c                               |   27 +-
 camel/camel-object.h                               |   10 +-
 camel/camel-offline-folder.c                       |    4 +-
 camel/camel-operation.c                            |    2 +-
 camel/camel-partition-table.c                      |    4 +-
 camel/camel-provider.c                             |    6 +-
 camel/camel-provider.h                             |   14 +-
 camel/camel-sasl-digest-md5.c                      |   10 +-
 camel/camel-sasl-ntlm.c                            |    4 +-
 camel/camel-search-private.c                       |    8 +-
 camel/camel-search-sql-sexp.c                      |    4 +-
 camel/camel-search-sql.c                           |   82 ++---
 camel/camel-seekable-stream.c                      |    4 +-
 camel/camel-seekable-stream.h                      |    2 +-
 camel/camel-seekable-substream.c                   |   24 +-
 camel/camel-service.c                              |    4 +-
 camel/camel-service.h                              |    6 +-
 camel/camel-session.c                              |    2 +-
 camel/camel-smime-context.c                        |   16 +-
 camel/camel-store-summary.c                        |   10 +-
 camel/camel-store-summary.h                        |    4 +-
 camel/camel-store.c                                |   12 +-
 camel/camel-stream-buffer.c                        |   38 +-
 camel/camel-stream-filter.c                        |   44 ++--
 camel/camel-stream-fs.c                            |   20 +-
 camel/camel-stream-mem.c                           |   22 +-
 camel/camel-stream-mem.h                           |    4 +-
 camel/camel-stream-null.c                          |    4 +-
 camel/camel-stream-null.h                          |    2 +-
 camel/camel-stream-process.c                       |   20 +-
 camel/camel-stream-vfs.c                           |   16 +-
 camel/camel-stream.c                               |   28 +-
 camel/camel-stream.h                               |   16 +-
 camel/camel-string-utils.c                         |    2 +-
 camel/camel-tcp-stream-openssl.c                   |   38 +-
 camel/camel-tcp-stream-raw.c                       |   56 ++--
 camel/camel-tcp-stream-ssl.c                       |   30 +-
 camel/camel-tcp-stream.c                           |    6 +-
 camel/camel-tcp-stream.h                           |    6 +-
 camel/camel-text-index.c                           |   31 +-
 camel/camel-transport.c                            |    4 +-
 camel/camel-trie.c                                 |    4 +-
 camel/camel-uid-cache.h                            |    4 +-
 camel/camel-url-scanner.c                          |   18 +-
 camel/camel-url-scanner.h                          |    6 +-
 camel/camel-url.c                                  |    8 +-
 camel/camel-vee-folder.c                           |   12 +-
 camel/camel-vee-store.c                            |   10 +-
 camel/camel-vtrash-folder.c                        |  351 +-------------------
 camel/db-scrap-tools/db.c                          |    8 +-
 camel/providers/groupwise/camel-groupwise-folder.c |   65 ++--
 camel/providers/groupwise/camel-groupwise-folder.h |    4 +-
 .../providers/groupwise/camel-groupwise-journal.c  |   10 +-
 .../providers/groupwise/camel-groupwise-provider.c |    2 +-
 .../groupwise/camel-groupwise-store-summary.c      |   57 ++--
 .../groupwise/camel-groupwise-store-summary.h      |   16 +-
 camel/providers/groupwise/camel-groupwise-store.c  |    9 +-
 .../providers/groupwise/camel-groupwise-summary.c  |   60 ++--
 .../providers/groupwise/camel-groupwise-summary.h  |   20 +-
 .../groupwise/camel-groupwise-transport.h          |    2 +-
 camel/providers/groupwise/camel-groupwise-utils.c  |    6 +-
 camel/providers/hula/camel-hula-provider.c         |    2 +-
 camel/providers/imap/camel-imap-command.c          |   10 +-
 camel/providers/imap/camel-imap-command.h          |    2 +-
 camel/providers/imap/camel-imap-folder.c           |   49 ++--
 camel/providers/imap/camel-imap-journal.c          |    6 +-
 camel/providers/imap/camel-imap-provider.c         |    4 +-
 camel/providers/imap/camel-imap-search.c           |    4 +-
 camel/providers/imap/camel-imap-store-summary.c    |   15 +-
 camel/providers/imap/camel-imap-store.c            |   27 +-
 camel/providers/imap/camel-imap-store.h            |    4 +-
 camel/providers/imap/camel-imap-summary.c          |   22 +-
 camel/providers/imap/camel-imap-utils.c            |   52 ++--
 camel/providers/imap/camel-imap-utils.h            |    8 +-
 camel/providers/imap/camel-imap-wrapper.c          |    4 +-
 camel/providers/imap4/Makefile.am                  |    2 -
 camel/providers/imap4/camel-imap4-command.c        |   20 +-
 camel/providers/imap4/camel-imap4-command.h        |    4 +-
 camel/providers/imap4/camel-imap4-engine.c         |   30 +-
 camel/providers/imap4/camel-imap4-engine.h         |    4 +-
 camel/providers/imap4/camel-imap4-folder.c         |   12 +-
 camel/providers/imap4/camel-imap4-journal.c        |    6 +-
 camel/providers/imap4/camel-imap4-provider.c       |    4 +-
 camel/providers/imap4/camel-imap4-search.c         |    6 +-
 camel/providers/imap4/camel-imap4-specials.h       |   12 +-
 camel/providers/imap4/camel-imap4-store-summary.c  |   10 +-
 camel/providers/imap4/camel-imap4-store.c          |   12 +-
 camel/providers/imap4/camel-imap4-stream.c         |   40 ++--
 camel/providers/imap4/camel-imap4-stream.h         |    8 +-
 camel/providers/imap4/camel-imap4-summary.c        |   40 ++--
 camel/providers/imap4/camel-imap4-utils.c          |   26 +-
 camel/providers/imap4/camel-imap4-utils.h          |    2 +-
 camel/providers/imapp/Makefile.am                  |    2 -
 camel/providers/imapp/camel-imapp-driver.c         |    8 +-
 camel/providers/imapp/camel-imapp-engine.c         |   22 +-
 camel/providers/imapp/camel-imapp-engine.h         |    6 +-
 camel/providers/imapp/camel-imapp-fetch-stream.c   |   16 +-
 camel/providers/imapp/camel-imapp-store-summary.c  |   12 +-
 camel/providers/imapp/camel-imapp-store.c          |    4 +-
 camel/providers/imapp/camel-imapp-stream.c         |   22 +-
 camel/providers/imapp/camel-imapp-stream.h         |   14 +-
 camel/providers/imapp/camel-imapp-summary.c        |    6 +-
 camel/providers/imapp/camel-imapp-utils.c          |   18 +-
 camel/providers/local/Makefile.am                  |    1 -
 camel/providers/local/camel-local-folder.c         |    9 +-
 camel/providers/local/camel-local-provider.c       |    4 +-
 camel/providers/local/camel-local-summary.c        |   18 +-
 camel/providers/local/camel-maildir-folder.c       |    2 +-
 camel/providers/local/camel-maildir-store.c        |    2 +-
 camel/providers/local/camel-maildir-summary.c      |    8 +-
 camel/providers/local/camel-mbox-folder.c          |    4 +-
 camel/providers/local/camel-mbox-store.c           |    4 +-
 camel/providers/local/camel-mbox-summary.c         |   58 ++--
 camel/providers/local/camel-mbox-summary.h         |    2 +-
 camel/providers/local/camel-mh-summary.c           |    4 +-
 camel/providers/local/camel-spool-folder.c         |    2 +-
 camel/providers/local/camel-spool-store.c          |    1 -
 camel/providers/local/camel-spool-summary.c        |    8 +-
 camel/providers/nntp/Makefile.am                   |    2 -
 camel/providers/nntp/camel-nntp-grouplist.c        |    4 +-
 camel/providers/nntp/camel-nntp-newsrc.c           |   12 +-
 camel/providers/nntp/camel-nntp-newsrc.h           |    4 +-
 camel/providers/nntp/camel-nntp-store-summary.c    |   13 +-
 camel/providers/nntp/camel-nntp-store.c            |   27 +-
 camel/providers/nntp/camel-nntp-stream.c           |   28 +-
 camel/providers/nntp/camel-nntp-stream.h           |    4 +-
 camel/providers/nntp/camel-nntp-summary.c          |   23 +-
 camel/providers/nntp/camel-nntp-utils.c            |    2 +-
 camel/providers/pop3/Makefile.am                   |    1 -
 camel/providers/pop3/camel-pop3-engine.c           |   10 +-
 camel/providers/pop3/camel-pop3-engine.h           |    2 +-
 camel/providers/pop3/camel-pop3-folder.c           |    2 +-
 camel/providers/pop3/camel-pop3-store.c            |   16 +-
 camel/providers/pop3/camel-pop3-stream.c           |   32 +-
 camel/providers/pop3/camel-pop3-stream.h           |    4 +-
 camel/providers/sendmail/Makefile.am               |    1 -
 camel/providers/smtp/Makefile.am                   |    1 -
 camel/providers/smtp/camel-smtp-transport.c        |   24 +-
 camel/tests/folder/Makefile.am                     |    1 -
 camel/tests/folder/test11.c                        |    2 +-
 camel/tests/lib/Makefile.am                        |    2 -
 camel/tests/lib/folders.c                          |    2 +-
 camel/tests/lib/messages.c                         |    2 +-
 camel/tests/message/Makefile.am                    |    1 -
 camel/tests/message/test2.c                        |    2 +-
 camel/tests/mime-filter/Makefile.am                |    1 -
 camel/tests/mime-filter/test-charset.c             |    4 +-
 camel/tests/mime-filter/test-crlf.c                |    4 +-
 camel/tests/misc/Makefile.am                       |    1 -
 camel/tests/misc/split.c                           |    2 +-
 camel/tests/smime/Makefile.am                      |    1 -
 camel/tests/stream/Makefile.am                     |    1 -
 docs/reference/camel/tmpl/camel-file-utils.sgml    |   20 --
 docs/reference/camel/tmpl/camel-unused.sgml        |   18 +
 libebackend/e-db3-utils.c                          |    6 +-
 libedataserver/e-account.h                         |    2 +-
 libedataserver/e-data-server-util.c                |   14 +-
 libedataserver/e-data-server-util.h                |    6 +-
 libedataserver/e-iconv.c                           |    4 +-
 libedataserver/e-iconv.h                           |    2 +-
 libedataserver/e-memory.c                          |    8 +-
 libedataserver/e-msgport.c                         |   12 +-
 libedataserver/e-msgport.h                         |    2 +-
 libedataserver/e-sexp.c                            |   22 +-
 libedataserver/e-sexp.h                            |   12 +-
 libedataserver/e-source-list.c                     |    6 +-
 libedataserver/e-time-utils.c                      |   32 +-
 libedataserver/e-time-utils.h                      |   18 +-
 libedataserver/e-trie.c                            |    6 +-
 libedataserver/e-trie.h                            |    2 +-
 libedataserver/e-uid.c                             |    4 +-
 libedataserver/e-url.c                             |    2 +-
 libedataserver/e-xml-utils.c                       |    6 +-
 libedataserver/test-source-list.c                  |    4 +-
 libedataserverui/e-name-selector-dialog.c          |    2 +-
 libedataserverui/e-name-selector-entry.c           |    8 +-
 libedataserverui/e-name-selector-list.c            |    2 +-
 libedataserverui/e-source-selector.c               |    2 +-
 libedataserverui/e-tree-model-generator.c          |    6 +-
 libedataserverui/test-source-combo-box.c           |    2 +-
 libedataserverui/test-source-selector.c            |    2 +-
 servers/exchange/lib/e2k-action.h                  |   20 +-
 servers/exchange/lib/e2k-autoconfig.c              |    2 +-
 servers/exchange/lib/e2k-global-catalog.c          |   16 +-
 servers/exchange/lib/e2k-global-catalog.h          |    2 +-
 servers/exchange/lib/e2k-properties.c              |    2 +-
 servers/exchange/lib/e2k-properties.h              |    2 +-
 servers/exchange/lib/e2k-rule-xml.c                |    6 +-
 servers/exchange/lib/e2k-security-descriptor.c     |    2 +-
 servers/exchange/lib/e2k-sid.c                     |    2 +-
 servers/exchange/lib/e2k-uri.c                     |    4 +-
 servers/exchange/lib/e2k-utils.c                   |    2 +-
 servers/exchange/lib/ebrowse.c                     |    6 +-
 servers/exchange/lib/gctest.c                      |    4 +-
 servers/exchange/storage/e-folder-exchange.c       |    2 +-
 servers/exchange/storage/e-folder-exchange.h       |    2 +-
 servers/exchange/storage/exchange-account.c        |    8 +-
 servers/exchange/storage/exchange-account.h        |    4 +-
 servers/exchange/storage/exchange-esource.c        |    4 +-
 servers/exchange/storage/exchange-folder-size.c    |   26 +-
 .../exchange/storage/exchange-hierarchy-foreign.c  |   12 +-
 .../exchange/storage/exchange-hierarchy-webdav.c   |    4 +-
 servers/exchange/storage/exchange-hierarchy.h      |    2 +-
 servers/exchange/xntlm/xntlm.c                     |    6 +-
 servers/groupwise/e-gw-connection.c                |   76 +++---
 servers/groupwise/e-gw-connection.h                |   22 +-
 servers/groupwise/e-gw-container.c                 |   80 +++---
 servers/groupwise/e-gw-container.h                 |   16 +-
 servers/groupwise/e-gw-item.c                      |    6 +-
 servers/groupwise/e-gw-item.h                      |   34 +-
 servers/groupwise/e-gw-message.c                   |    2 +-
 servers/groupwise/e-gw-message.h                   |    2 +-
 servers/groupwise/e-gw-sendoptions.c               |   16 +-
 servers/groupwise/soup-soap-message.c              |    2 +-
 servers/groupwise/soup-soap-message.h              |    2 +-
 319 files changed, 2225 insertions(+), 2542 deletions(-)

diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index 739a414..09e6e54 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -1106,8 +1106,8 @@ e_book_backend_file_load_source (EBookBackend           *backend,
 		env->set_errcall (env, file_errcall);
 
 		/* Set the allocation routines to the non-aborting GLib functions */
-		env->set_alloc (env, (gpointer (*)(size_t))g_try_malloc,
-				(gpointer (*)(gpointer , size_t))g_try_realloc,
+		env->set_alloc (env, (gpointer (*)(gsize))g_try_malloc,
+				(gpointer (*)(gpointer , gsize))g_try_realloc,
 				g_free);
 
 		db_error = (*env->open) (env, NULL, DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_THREAD, 0);
@@ -1450,7 +1450,7 @@ e_book_backend_file_finalize (GObject *object)
  * prototype that db_env_set_func_open() wants for the open method.
  */
 
-static int
+static gint
 my_open (const gchar *name, gint oflag, ...)
 {
 	gint mode = 0;
@@ -1458,7 +1458,7 @@ my_open (const gchar *name, gint oflag, ...)
 	if (oflag & O_CREAT) {
 		va_list arg;
 		va_start (arg, oflag);
-		mode = va_arg (arg, int);
+		mode = va_arg (arg, gint);
 		va_end (arg);
 	}
 
diff --git a/addressbook/backends/google/e-book-backend-google.c b/addressbook/backends/google/e-book-backend-google.c
index 802b48c..afe0e4c 100644
--- a/addressbook/backends/google/e-book-backend-google.c
+++ b/addressbook/backends/google/e-book-backend-google.c
@@ -54,7 +54,7 @@ static EBookBackendSyncStatus
 e_book_backend_google_create_contact (EBookBackendSync	*backend,
 				      EDataBook		*book,
 				      guint32		opid,
-				      const char	*vcard_str,
+				      const gchar	*vcard_str,
 				      EContact		**out_contact)
 {
     EBookBackendGooglePrivate *priv;
@@ -132,7 +132,7 @@ static EBookBackendSyncStatus
 e_book_backend_google_modify_contact (EBookBackendSync	*backend,
 				      EDataBook		*book,
 				      guint32		opid,
-				      const char	*vcard_str,
+				      const gchar	*vcard_str,
 				      EContact		**out_contact)
 {
     EBookBackendGooglePrivate *priv;
@@ -168,8 +168,8 @@ static EBookBackendSyncStatus
 e_book_backend_google_get_contact (EBookBackendSync	*backend,
 				   EDataBook		*book,
 				   guint32		opid,
-				   const char		*uid,
-				   char		**vcard_str)
+				   const gchar		*uid,
+				   gchar		**vcard_str)
 {
     EBookBackendGooglePrivate *priv;
     EBookBackendSyncStatus status = GNOME_Evolution_Addressbook_OtherError;
@@ -196,7 +196,7 @@ static EBookBackendSyncStatus
 e_book_backend_google_get_contact_list (EBookBackendSync *backend,
 					EDataBook	 *book,
 					guint32	 opid,
-					const char	 *query,
+					const gchar	 *query,
 					GList		 **contacts)
 {
     EBookBackendGooglePrivate *priv;
@@ -344,9 +344,9 @@ static EBookBackendSyncStatus
 e_book_backend_google_authenticate_user (EBookBackendSync *backend,
 					 EDataBook	  *book,
 					 guint32	  opid,
-					 const char	  *username,
-					 const char	  *password,
-					 const char	  *auth_method)
+					 const gchar	  *username,
+					 const gchar	  *password,
+					 const gchar	  *auth_method)
 {
     EBookBackendGooglePrivate *priv;
     EBookBackendSyncStatus status = GNOME_Evolution_Addressbook_Success;
@@ -471,7 +471,7 @@ static EBookBackendSyncStatus
 e_book_backend_google_get_changes (EBookBackendSync	*backend,
 				   EDataBook		*book,
 				   guint32		opid,
-				   const char		*change_id,
+				   const gchar		*change_id,
 				   GList		**changes_out)
 {
     __debug__ (G_STRFUNC);
diff --git a/addressbook/backends/groupwise/e-book-backend-groupwise.c b/addressbook/backends/groupwise/e-book-backend-groupwise.c
index 04789ef..6258bc7 100644
--- a/addressbook/backends/groupwise/e-book-backend-groupwise.c
+++ b/addressbook/backends/groupwise/e-book-backend-groupwise.c
@@ -312,7 +312,7 @@ set_im_changes (EGwItem *new_item, EGwItem *old_item)
 	if (old_ims && new_ims) {
 
 		old_ims_copy = g_list_copy (old_ims);
-		for ( ; new_ims != NULL; new_ims = g_list_next (new_ims)) {
+		for (; new_ims != NULL; new_ims = g_list_next (new_ims)) {
 
 			im1 = new_ims->data;
 			temp = old_ims;
@@ -511,7 +511,7 @@ static void
 populate_birth_date (EContact *contact, gpointer data)
 {
 	EGwItem *item;
-	gchar *value ;
+	gchar *value;
 	EContactDate *date;
 
 	item = E_GW_ITEM (data);
@@ -578,7 +578,7 @@ populate_emails (EContact *contact, gpointer data)
 	item = E_GW_ITEM (data);
 	email_list = e_gw_item_get_email_list(item);
 
-	for (i =0 ; i < 3 && email_list; i++, email_list = g_list_next (email_list)) {
+	for (i =0; i < 3 && email_list; i++, email_list = g_list_next (email_list)) {
 		if (email_list->data)
 			e_contact_set (contact, email_fields[i], email_list->data);
 	}
@@ -595,7 +595,7 @@ set_emails_in_gw_item (EGwItem *item, gpointer data)
 
 	contact = E_CONTACT (data);
 	email_list = NULL;
-	for (i =0 ; i < 3; i++) {
+	for (i =0; i < 3; i++) {
 		email = e_contact_get (contact, email_fields[i]);
 		if(email)
 			email_list = g_list_append (email_list, g_strdup (email));
@@ -612,7 +612,7 @@ compare_string_lists ( GList *old_list, GList *new_list, GList **additions, GLis
 
 	if (old_list && new_list) {
 		old_list_copy = g_list_copy (old_list);
-		for ( ; new_list != NULL; new_list = g_list_next (new_list)) {
+		for (; new_list != NULL; new_list = g_list_next (new_list)) {
 
 			string1 = new_list->data;
 			temp = old_list;
@@ -656,7 +656,7 @@ static void
 populate_full_name (EContact *contact, gpointer data)
 {
 	EGwItem *item;
-	FullName  *full_name ;
+	FullName  *full_name;
 	gchar *full_name_string;
 
 	item = E_GW_ITEM(data);
@@ -827,7 +827,7 @@ set_members_in_gw_item (EGwItem  *item, EContact *contact, EBookBackendGroupwise
 	emails_without_ids = NULL;
 	dest_without_ids = NULL;
 
-	for ( ;temp != NULL; temp = g_list_next (temp)) {
+	for (;temp != NULL; temp = g_list_next (temp)) {
 		EVCardAttribute *attr = temp->data;
 		EDestination *dest;
 		id = email = NULL;
@@ -915,9 +915,9 @@ set_members_in_gw_item (EGwItem  *item, EContact *contact, EBookBackendGroupwise
 	 * arbitrary contacts and then add them as members to the group.
 	 */
 
-	temp = emails_without_ids ;
+	temp = emails_without_ids;
 	dtemp = dest_without_ids;
-	for (; temp != NULL && dtemp != NULL ; temp = g_list_next (temp), dtemp = g_list_next(dtemp)) {
+	for (; temp != NULL && dtemp != NULL; temp = g_list_next (temp), dtemp = g_list_next(dtemp)) {
 		EContact *new_contact = e_contact_new ();
 		EGwItem *new_item = e_gw_item_new_empty ();
 		FullName *full_name;
@@ -994,19 +994,19 @@ set_members_in_gw_item (EGwItem  *item, EContact *contact, EBookBackendGroupwise
 static void
 set_member_changes (EGwItem *new_item, EGwItem *old_item, EBookBackendGroupwise *egwb)
 {
-	GList *old_members, *new_members ;
+	GList *old_members, *new_members;
 	GList *old_ids,  *new_ids,  *additions, *deletions;
 
 	old_ids = new_ids = additions = deletions = NULL;
 	old_members = e_gw_item_get_member_list (old_item);
 	new_members = e_gw_item_get_member_list (new_item);
 
-	for ( ;old_members != NULL; old_members = g_list_next (old_members)) {
+	for (;old_members != NULL; old_members = g_list_next (old_members)) {
 		EGroupMember *member;
 		member = (EGroupMember *)old_members->data;
 		old_ids = g_list_append (old_ids, member->id);
 	}
-	for ( ;new_members != NULL; new_members = g_list_next (new_members)) {
+	for (;new_members != NULL; new_members = g_list_next (new_members)) {
 		EGroupMember *member;
 		member = (EGroupMember *)new_members->data;
 		new_ids = g_list_append (new_ids, member->id);
@@ -1106,7 +1106,7 @@ set_categories_changes (EGwItem *new_item, EGwItem *old_item)
 	if (old_category_list && new_category_list) {
 		old_categories_copy = g_list_copy (old_category_list);
 
-		for ( ; new_category_list != NULL; new_category_list = g_list_next (new_category_list)) {
+		for (; new_category_list != NULL; new_category_list = g_list_next (new_category_list)) {
 			category1  = new_category_list->data;
 			temp = old_category_list;
 			categories_matched  = FALSE;
@@ -1299,7 +1299,7 @@ e_book_backend_groupwise_remove_contacts (EBookBackend *backend,
 			return;
 		}
 
-		for ( ; id_list != NULL; id_list = g_list_next (id_list)) {
+		for (; id_list != NULL; id_list = g_list_next (id_list)) {
 			id = (gchar *) id_list->data;
 			e_gw_connection_remove_item (ebgw->priv->cnc, ebgw->priv->container_id, id);
 			deleted_ids =  g_list_append (deleted_ids, id);
@@ -1455,7 +1455,7 @@ e_book_backend_groupwise_get_contact (EBookBackend *backend,
 				      const gchar   *id)
 {
 	EBookBackendGroupwise *gwb;
-	gint status ;
+	gint status;
 	EGwItem *item;
 	EContact *contact;
 	gchar *vcard;
@@ -2137,7 +2137,7 @@ book_view_thread (gpointer data)
 	gboolean is_auto_completion = FALSE;
 	gchar *search_string = NULL;
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 
 	gwb  = closure->bg;
 	gw_items = NULL;
@@ -2637,7 +2637,7 @@ build_cache (EBookBackendGroupwise *ebgw)
 	gchar *status_msg;
 	GTimeVal start, end;
 	GTimeVal tstart, tend;
-	unsigned long diff;
+	gulong diff;
 
 	if(!ebgw)
 		return NULL;
@@ -2744,7 +2744,7 @@ build_summary (EBookBackendGroupwise *ebgw)
 	gchar *query_string;
 	GList *contacts, *temp_list = NULL;
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 
 	if (enable_debug) {
 		g_get_current_time(&start);
@@ -2792,7 +2792,7 @@ update_cache (EBookBackendGroupwise *ebgw)
 	EDataBookView *book_view;
 	GroupwiseBackendSearchClosure *closure;
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 
 	if (!ebgw)
 		return FALSE;
@@ -2903,7 +2903,7 @@ update_address_book_deltas (EBookBackendGroupwise *ebgw)
 	EBookBackendGroupwisePrivate *priv;
 
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 	gchar *cache_file_name;
 	struct stat buf;
 	time_t mod_time;
@@ -3303,7 +3303,7 @@ e_book_backend_groupwise_authenticate_user (EBookBackend *backend,
 
 		if (!ebgw->priv->file_db) {
 				e_data_book_respond_authenticate_user (book, opid, GNOME_Evolution_Addressbook_OtherError);
-				return ;
+				return;
 		}
 		if (e_book_backend_db_cache_is_populated (ebgw->priv->file_db)) {
 			if (enable_debug)
@@ -3410,7 +3410,7 @@ e_book_backend_groupwise_get_supported_fields (EBookBackend *backend,
 	if (enable_debug)
 		printf ("\ne_book_backend_groupwise_get_supported_fields...\n");
 
-	for (i = 0; i < G_N_ELEMENTS (mappings) ; i ++)
+	for (i = 0; i < G_N_ELEMENTS (mappings); i ++)
 		fields = g_list_append (fields, g_strdup (e_contact_field_name (mappings[i].field_id)));
 	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_2)));
 	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_3)));
diff --git a/addressbook/backends/ldap/e-book-backend-ldap.c b/addressbook/backends/ldap/e-book-backend-ldap.c
index ad42edc..0ea7cbc 100644
--- a/addressbook/backends/ldap/e-book-backend-ldap.c
+++ b/addressbook/backends/ldap/e-book-backend-ldap.c
@@ -566,7 +566,7 @@ add_oc_attributes_to_supported_fields (EBookBackendLDAP *bl, LDAPObjectClass *oc
 	GHashTable *attr_hash = g_hash_table_new (g_str_hash, g_str_equal);
 
 	for (i = 0; i < num_prop_infos; i ++)
-		g_hash_table_insert (attr_hash, (gpointer) prop_info[i].ldap_attr, (gchar*)e_contact_field_name (prop_info[i].field_id));
+		g_hash_table_insert (attr_hash, (gpointer) prop_info[i].ldap_attr, (gchar *)e_contact_field_name (prop_info[i].field_id));
 
 	if (oc->oc_at_oids_must)
 		add_to_supported_fields (bl, oc->oc_at_oids_must, attr_hash);
@@ -712,7 +712,7 @@ get_ldap_library_info (void)
 }
 #endif
 
-static int
+static gint
 query_ldap_root_dse (EBookBackendLDAP *bl)
 {
 #define MAX_DSE_ATTRS 20
@@ -830,7 +830,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl)
 	EBookBackendLDAPPrivate *blpriv = bl->priv;
 	gint protocol_version = LDAP_VERSION3;
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 #ifdef SUNLDAP
 	gint ldap_flag;
 #endif
@@ -1030,7 +1030,7 @@ static gboolean
 e_book_backend_ldap_reconnect (EBookBackendLDAP *bl, EDataBookView *book_view, gint ldap_status)
 {
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 
 	if (enable_debug) {
 		printf ("e_book_backend_ldap_reconnect ... \n");
@@ -1172,7 +1172,7 @@ ldap_op_change_id (LDAPOp *op, gint msg_id)
 	g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
 }
 
-static int
+static gint
 ldap_error_to_response (gint ldap_error)
 {
 	if (ldap_error == LDAP_SUCCESS)
@@ -2137,7 +2137,7 @@ get_contact_handler (LDAPOp *op, LDAPMessage *res)
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (op->backend);
 	gint msg_type;
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 
 	if (enable_debug) {
 		printf ("get_contact_handler ... \n");
@@ -2249,7 +2249,7 @@ e_book_backend_ldap_get_contact (EBookBackend *backend,
 	EDataBookView *book_view;
 	gint ldap_error;
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 
 	switch (bl->priv->mode) {
 
@@ -2346,7 +2346,7 @@ contact_list_handler (LDAPOp *op, LDAPMessage *res)
 	LDAPMessage *e;
 	gint msg_type;
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 
 	if (enable_debug) {
 		printf ("contact_list_handler ...\n");
@@ -2469,7 +2469,7 @@ e_book_backend_ldap_get_contact_list (EBookBackend *backend,
 	gint ldap_error;
 	gchar *ldap_query;
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 
 	if (enable_debug) {
 		printf ("e_book_backend_ldap_get_contact_list ... \n");
@@ -3491,7 +3491,7 @@ func_and(struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
 
 		ldap_data->list = g_list_prepend(ldap_data->list, g_strjoinv(" ", strings));
 
-		for (i = 0 ; i < argc + 2; i ++)
+		for (i = 0; i < argc + 2; i ++)
 			g_free (strings[i]);
 
 		g_free (strings);
@@ -3528,7 +3528,7 @@ func_or(struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
 
 		ldap_data->list = g_list_prepend(ldap_data->list, g_strjoinv(" ", strings));
 
-		for (i = 0 ; i < argc + 2; i ++)
+		for (i = 0; i < argc + 2; i ++)
 			g_free (strings[i]);
 
 		g_free (strings);
@@ -3864,7 +3864,7 @@ e_book_backend_ldap_build_query (EBookBackendLDAP *bl, const gchar *query)
 				strings[2] = data.list->data;
 				strings[3] = g_strdup (")");
 				retval =  g_strjoinv (" ", strings);
-				for (i = 0 ; i < 4; i ++)
+				for (i = 0; i < 4; i ++)
 					g_free (strings[i]);
 				g_free (strings);
 			}
@@ -4020,15 +4020,15 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 								do {
 									g_static_rec_mutex_lock (&eds_ldap_handler_lock);
 									if ((ldap_error = ldap_search_ext_s (bl->priv->ldap,
-						    						        values[j],
-						    						        LDAP_SCOPE_BASE,
-						    						        NULL,
-						    						        (gchar **) grpattrs, 0,
-												        NULL,
-												        NULL,
-												        NULL,
-												        view_limit,
-											    	        &result)) == LDAP_SUCCESS) {
+													values[j],
+													LDAP_SCOPE_BASE,
+													NULL,
+													(gchar **) grpattrs, 0,
+													NULL,
+													NULL,
+													NULL,
+													view_limit,
+													&result)) == LDAP_SUCCESS) {
 										/* find the e-mail ids of members */
 										cn_values = ldap_get_values (bl->priv->ldap, result, "cn");
 										email_values = ldap_get_values (bl->priv->ldap, result, "mail");
@@ -4162,7 +4162,7 @@ ldap_search_handler (LDAPOp *op, LDAPMessage *res)
 	LDAPMessage *e;
 	gint msg_type;
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 
 	d(printf ("ldap_search_handler (%p)\n", view));
 	if (enable_debug)
@@ -4269,7 +4269,7 @@ e_book_backend_ldap_search (EBookBackendLDAP *bl,
 	GList *contacts;
 	GList *l;
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 
 	if (enable_debug) {
 		printf ("e_book_backend_ldap_search ... \n");
@@ -4437,7 +4437,7 @@ generate_cache_handler (LDAPOp *op, LDAPMessage *res)
 	gint msg_type;
 	EDataBookView *book_view;
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 
 	if (enable_debug) {
 		printf ("generate_cache_handler ... \n");
@@ -4530,7 +4530,7 @@ generate_cache (EBookBackendLDAP *book_backend_ldap)
 	gint contact_list_msgid;
 	gint ldap_error;
 	GTimeVal start, end;
-	unsigned long diff;
+	gulong diff;
 
 	if (enable_debug) {
 		printf ("generating offline cache ... \n");
@@ -4672,7 +4672,7 @@ e_book_backend_ldap_authenticate_user (EBookBackend *backend,
 			if (status != GNOME_Evolution_Addressbook_Success) {
 				e_data_book_respond_authenticate_user (book,
 								       opid, status);
-				return ;
+				return;
 			}
 		}
 
@@ -4710,7 +4710,7 @@ e_book_backend_ldap_authenticate_user (EBookBackend *backend,
 			if (status != GNOME_Evolution_Addressbook_Success) {
 				e_data_book_respond_authenticate_user (book,
 								       opid, status);
-				return ;
+				return;
 			}
 		}
 		ldap_error = ldap_sasl_bind_s (bl->priv->ldap,
diff --git a/addressbook/backends/ldap/openldap-extract.h b/addressbook/backends/ldap/openldap-extract.h
index 7888a24..9ef2653 100644
--- a/addressbook/backends/ldap/openldap-extract.h
+++ b/addressbook/backends/ldap/openldap-extract.h
@@ -162,7 +162,7 @@ struct token {
 	gchar *sval;
 };
 
-static int
+static gint
 get_token( const gchar ** sp, gchar ** token_val )
 {
 	gint kind;
@@ -759,7 +759,7 @@ ldap_str2objectclass( LDAP_CONST gchar * s,
 
 static gchar *ldap_utf8_strchr( const gchar *str, const gchar *chr )
 {
-	for( ; *str != '\0'; LDAP_UTF8_INCR(str) ) {
+	for(; *str != '\0'; LDAP_UTF8_INCR(str) ) {
 		if( ldap_x_utf8_to_ucs4( str ) == ldap_x_utf8_to_ucs4( chr ) ) {
 			return (gchar *) str;
 		}
@@ -768,7 +768,7 @@ static gchar *ldap_utf8_strchr( const gchar *str, const gchar *chr )
 	return NULL;
 }
 
-static size_t ldap_utf8_strcspn( const gchar *str, const gchar *set )
+static gsize ldap_utf8_strcspn( const gchar *str, const gchar *set )
 {
 	const gchar *cstr;
 	const gchar *cset;
@@ -784,7 +784,7 @@ static size_t ldap_utf8_strcspn( const gchar *str, const gchar *set )
 	return cstr - str;
 }
 
-static size_t ldap_utf8_strspn( const gchar *str, const gchar *set )
+static gsize ldap_utf8_strspn( const gchar *str, const gchar *set )
 {
 	const gchar *cstr;
 	const gchar *cset;
@@ -859,15 +859,15 @@ static gchar *ldap_utf8_strtok(gchar *str, const gchar *sep, gchar **last)
 
 typedef struct ldap_url_desc {
 	struct ldap_url_desc *lud_next;
-	char	*lud_scheme;
-	char	*lud_host;
-	int		lud_port;
-	char	*lud_dn;
-	char	**lud_attrs;
-	int		lud_scope;
-	char	*lud_filter;
-	char	**lud_exts;
-	int		lud_crit_exts;
+	gchar	*lud_scheme;
+	gchar	*lud_host;
+	gint		lud_port;
+	gchar	*lud_dn;
+	gchar	**lud_attrs;
+	gint		lud_scope;
+	gchar	*lud_filter;
+	gchar	**lud_exts;
+	gint		lud_crit_exts;
 } LDAPURLDesc;
 
 /* from url.c */
@@ -995,7 +995,7 @@ ldap_free_urldesc( LDAPURLDesc *ludp )
 	LDAP_FREE( ludp );
 }
 
-static int
+static gint
 ldap_int_unhex( gint c )
 {
 	return( c >= '0' && c <= '9' ? c - '0'
@@ -1010,7 +1010,7 @@ ldap_pvt_hex_unescape( gchar *s )
 	 * Remove URL hex escapes from s... done in place.  The basic concept for
 	 * this routine is borrowed from the WWW library HTUnEscape() routine.
 	 */
-	char	*p;
+	gchar	*p;
 
 	for ( p = s; *s != '\0'; ++s ) {
 		if ( *s == '%' ) {
@@ -1033,10 +1033,10 @@ ldap_pvt_hex_unescape( gchar *s )
 static gchar **
 ldap_str2charray( const gchar *str_in, const gchar *brkstr )
 {
-	char	**res;
-	char	*str, *s;
-	char	*lasts;
-	int	i;
+	gchar	**res;
+	gchar	*str, *s;
+	gchar	*lasts;
+	gint	i;
 
 	/* protect the input string from strtok */
 	str = LDAP_STRDUP( str_in );
@@ -1067,7 +1067,7 @@ ldap_str2charray( const gchar *str_in, const gchar *brkstr )
 		res[i] = LDAP_STRDUP( s );
 
 		if(res[i] == NULL) {
-			for( --i ; i >= 0 ; i-- ) {
+			for( --i; i >= 0; i-- ) {
 				LDAP_FREE( res[i] );
 			}
 			LDAP_FREE( res );
@@ -1084,7 +1084,7 @@ ldap_str2charray( const gchar *str_in, const gchar *brkstr )
 	return( res );
 }
 
-static int
+static gint
 ldap_url_parse_ext( LDAP_CONST gchar *url_in, LDAPURLDesc **ludpp )
 {
 /*
@@ -1092,8 +1092,8 @@ ldap_url_parse_ext( LDAP_CONST gchar *url_in, LDAPURLDesc **ludpp )
  */
 
 	LDAPURLDesc	*ludp;
-	char	*p, *q, *r;
-	int		i, enclosed;
+	gchar	*p, *q, *r;
+	gint		i, enclosed;
 	const gchar *scheme = NULL;
 	const gchar *url_tmp;
 	gchar *url;
@@ -1178,7 +1178,7 @@ ldap_url_parse_ext( LDAP_CONST gchar *url_in, LDAPURLDesc **ludpp )
 	}
 
 	if ( q != NULL ) {
-		char	*next;
+		gchar	*next;
 
 		*q++ = '\0';
 		ldap_pvt_hex_unescape( q );
@@ -1408,7 +1408,7 @@ ldap_url_parse_ext( LDAP_CONST gchar *url_in, LDAPURLDesc **ludpp )
 	return LDAP_URL_SUCCESS;
 }
 
-static int
+static gint
 ldap_url_parse( LDAP_CONST gchar *url_in, LDAPURLDesc **ludpp )
 {
 	gint rc = ldap_url_parse_ext( url_in, ludpp );
diff --git a/addressbook/backends/webdav/e-book-backend-webdav.c b/addressbook/backends/webdav/e-book-backend-webdav.c
index c6aaef5..c87ff74 100644
--- a/addressbook/backends/webdav/e-book-backend-webdav.c
+++ b/addressbook/backends/webdav/e-book-backend-webdav.c
@@ -694,9 +694,9 @@ download_contacts(EBookBackendWebdav *webdav, EFlag *running,
 			break;
 
 		if (book_view != NULL) {
-			float percent = 100.0 / count * i;
+			gfloat percent = 100.0 / count * i;
 			gchar buf[100];
-			snprintf(buf, sizeof(buf), "Loading Contacts (%d%%)", (int)percent);
+			snprintf(buf, sizeof(buf), "Loading Contacts (%d%%)", (gint)percent);
 			e_data_book_view_notify_status_message(book_view, buf);
 		}
 
diff --git a/addressbook/libebook/e-book-query.c b/addressbook/libebook/e-book-query.c
index bdf58b1..2e9e5cb 100644
--- a/addressbook/libebook/e-book-query.c
+++ b/addressbook/libebook/e-book-query.c
@@ -660,8 +660,8 @@ e_book_query_to_string    (EBookQuery *q)
 {
 	GString *str = g_string_new ("(");
 	GString *encoded = g_string_new ("");
-	int i;
-	char *s = NULL;
+	gint i;
+	gchar *s = NULL;
 	const gchar *cs;
 
 	switch (q->type) {
diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c
index c4d6f09..e8d75ca 100644
--- a/addressbook/libebook/e-book.c
+++ b/addressbook/libebook/e-book.c
@@ -3248,7 +3248,7 @@ activate_factories_for_uri (EBook *book, const gchar *uri)
 {
 	CORBA_Environment ev;
 	Bonobo_ServerInfoList *info_list = NULL;
-	int i;
+	gint i;
 	const gchar *query;
 	GList *factories = NULL;
 
diff --git a/addressbook/libebook/e-contact.c b/addressbook/libebook/e-contact.c
index d790449..df66ae2 100644
--- a/addressbook/libebook/e-contact.c
+++ b/addressbook/libebook/e-contact.c
@@ -1432,7 +1432,7 @@ e_contact_get (EContact *contact, EContactField field_id)
 
 		if (attr) {
 			GList *v = e_vcard_attribute_get_values (attr);
-			rv = v && v->data && !g_ascii_strcasecmp ((char*)v->data, "true");
+			rv = v && v->data && !g_ascii_strcasecmp ((gchar *)v->data, "true");
 			return rv ? (gpointer) "1" : NULL;
 		}
 	}
diff --git a/addressbook/libebook/e-contact.h b/addressbook/libebook/e-contact.h
index e7484c7..c335042 100644
--- a/addressbook/libebook/e-contact.h
+++ b/addressbook/libebook/e-contact.h
@@ -234,8 +234,8 @@ typedef struct {
 } EContactName;
 
 typedef struct {
-	double latitude;
-	double longitude;
+	gdouble latitude;
+	gdouble longitude;
 } EContactGeo;
 
 typedef enum {
diff --git a/addressbook/libebook/e-destination.c b/addressbook/libebook/e-destination.c
index 5bb1842..50587dd 100644
--- a/addressbook/libebook/e-destination.c
+++ b/addressbook/libebook/e-destination.c
@@ -1118,7 +1118,7 @@ e_destination_get_textrepv (EDestination **destv)
 
 	/* Q: Please tell me this is only for assertion
            reasons. If this is considered to be ok behavior then you
-           shouldn't use g_return's. Just a reminder ;-)
+           shouldn't use g_return's. Just a reminder;-)
 
 	   A: Yes, this is just an assertion.  (Though it does find the
 	   length of the vector in the process...)
@@ -1131,8 +1131,8 @@ e_destination_get_textrepv (EDestination **destv)
 	strv = g_new0 (gchar *, len + 1);
 	for (i = 0, j = 0; destv[i]; i++) {
 		if (!e_destination_empty (destv[i])) {
-			const char *addr = e_destination_get_address (destv[i]);
-			strv[j++] = addr ? (char *) addr : (gchar *) "";
+			const gchar *addr = e_destination_get_address (destv[i]);
+			strv[j++] = addr ? (gchar *) addr : (gchar *) "";
 		}
 	}
 
diff --git a/addressbook/libebook/e-name-western.c b/addressbook/libebook/e-name-western.c
index cb046df..182aa27 100644
--- a/addressbook/libebook/e-name-western.c
+++ b/addressbook/libebook/e-name-western.c
@@ -27,7 +27,7 @@ typedef struct {
 	gint suffix_idx;
 } ENameWesternIdxs;
 
-static int
+static gint
 e_name_western_str_count_words (const gchar *str)
 {
 	gint word_count;
@@ -105,7 +105,7 @@ e_name_western_get_words_at_idx (gchar *str, gint idx, gint num_words)
 	return g_string_free (words, FALSE);
 }
 
-static int
+static gint
 e_name_western_max (const gint a, const gint b)
 {
 	if (a > b)
@@ -419,7 +419,7 @@ e_name_western_extract_nickname (ENameWestern *name, ENameWesternIdxs *idxs)
 	idxs->nick_idx = start_idx;
 }
 
-static int
+static gint
 e_name_western_last_get_max_idx (ENameWestern *name, ENameWesternIdxs *idxs)
 {
 	gint max_idx = -1;
diff --git a/addressbook/libebook/e-vcard.c b/addressbook/libebook/e-vcard.c
index 3ff2fe9..a99d9b5 100644
--- a/addressbook/libebook/e-vcard.c
+++ b/addressbook/libebook/e-vcard.c
@@ -198,7 +198,7 @@ skip_to_next_line (gchar **p)
 /* skip forward until we hit a character in @s, CRLF, or \0.  leave *p
    pointing at the character that causes us to stop */
 static void
-skip_until (char **p, const char *s)
+skip_until (gchar **p, const gchar *s)
 {
 	gchar *lp;
 
@@ -206,7 +206,7 @@ skip_until (char **p, const char *s)
 
 	while (*lp != '\r' && *lp != '\0') {
 		gboolean s_matches = FALSE;
-		const char *ls;
+		const gchar *ls;
 		for (ls = s; *ls; ls = g_utf8_next_char (ls)) {
 			if (g_utf8_get_char (ls) == g_utf8_get_char (lp)) {
 				s_matches = TRUE;
@@ -420,7 +420,7 @@ read_attribute_params (EVCardAttribute *attr, gchar **p, gboolean *quoted_printa
 			}
 			else {
 				if (str->len > 0) {
-					const char *param_name;
+					const gchar *param_name;
 					if (!g_ascii_strcasecmp (str->str,
 								 "quoted-printable")) {
 						param_name = "ENCODING";
@@ -630,7 +630,7 @@ make_valid_utf8 (const gchar *name)
 static void
 parse (EVCard *evc, const gchar *str)
 {
-	gchar *buf ;
+	gchar *buf;
 	gchar *p;
 	EVCardAttribute *attr;
 
@@ -913,7 +913,7 @@ e_vcard_to_string_vcard_30 (EVCard *evc)
 			g_string_append (attr_str, escaped_value);
 			if (v->next) {
 				/* XXX toshok - i hate you, rfc 2426.
-				   why doesn't CATEGORIES use a ; like
+				   why doesn't CATEGORIES use a; like
 				   a normal list attribute? */
 				if (!g_ascii_strcasecmp (attr->name, "CATEGORIES"))
 					g_string_append_c (attr_str, ',');
diff --git a/addressbook/libedata-book/e-book-backend-cache.c b/addressbook/libedata-book/e-book-backend-cache.c
index b4424e7..96eb5f9 100644
--- a/addressbook/libedata-book/e-book-backend-cache.c
+++ b/addressbook/libedata-book/e-book-backend-cache.c
@@ -390,7 +390,7 @@ e_book_backend_cache_get_contacts (EBookBackendCache *cache, const gchar *query)
 
         lcache = l = e_file_cache_get_objects (E_FILE_CACHE (cache));
 
-        for ( ; l != NULL; l = g_slist_next (l)) {
+        for (; l != NULL; l = g_slist_next (l)) {
                 vcard_str = l->data;
                 if (vcard_str && !strncmp (vcard_str, "BEGIN:VCARD", 11)) {
                         contact = e_contact_new_from_vcard (vcard_str);
diff --git a/addressbook/libedata-book/e-book-backend-db-cache.c b/addressbook/libedata-book/e-book-backend-db-cache.c
index adf25d7..3314ae0 100644
--- a/addressbook/libedata-book/e-book-backend-db-cache.c
+++ b/addressbook/libedata-book/e-book-backend-db-cache.c
@@ -132,7 +132,7 @@ EContact *
 e_book_backend_db_cache_get_contact (DB *db, const gchar *uid)
 {
 	DBT	uid_dbt, vcard_dbt;
-	int	db_error;
+	gint	db_error;
 	EContact *contact = NULL;
 
 	g_return_val_if_fail (uid != NULL, NULL);
@@ -166,8 +166,8 @@ e_book_backend_db_cache_add_contact (DB *db,
 				     EContact *contact)
 {
 	DBT	uid_dbt, vcard_dbt;
-	int	db_error;
-	char	*vcard_str;
+	gint	db_error;
+	gchar	*vcard_str;
 	const gchar *uid;
 
 	uid = e_contact_get_const (contact, E_CONTACT_UID);
@@ -211,7 +211,7 @@ e_book_backend_db_cache_remove_contact (DB *db,
 
 {
 	DBT	uid_dbt;
-	int	db_error;
+	gint	db_error;
 
 	g_return_val_if_fail (uid != NULL, FALSE);
 
@@ -240,7 +240,7 @@ gboolean
 e_book_backend_db_cache_check_contact (DB *db, const gchar *uid)
 {
 	DBT	uid_dbt, vcard_dbt;
-	int	db_error;
+	gint	db_error;
 
 	g_return_val_if_fail (uid != NULL, FALSE);
 
@@ -273,7 +273,7 @@ e_book_backend_db_cache_get_contacts (DB *db, const gchar *query)
 {
 	DBC	*dbc;
 	DBT	uid_dbt, vcard_dbt;
-	int	db_error;
+	gint	db_error;
 	GList *list = NULL;
 	EBookBackendSExp *sexp = NULL;
 	EContact *contact;
@@ -382,7 +382,7 @@ void
 e_book_backend_db_cache_set_populated (DB *db)
 {
 	DBT	uid_dbt, vcard_dbt;
-	int	db_error;
+	gint	db_error;
 
 	string_to_dbt ("populated", &uid_dbt);
 	string_to_dbt ("TRUE", &vcard_dbt);
@@ -405,7 +405,7 @@ gboolean
 e_book_backend_db_cache_is_populated (DB *db)
 {
 	DBT	uid_dbt, vcard_dbt;
-	int	db_error;
+	gint	db_error;
 
 	string_to_dbt ("populated", &uid_dbt);
 	memset(&vcard_dbt, 0, sizeof(vcard_dbt));
diff --git a/addressbook/tests/ebook/test-query.c b/addressbook/tests/ebook/test-query.c
index a81738a..daa0616 100644
--- a/addressbook/tests/ebook/test-query.c
+++ b/addressbook/tests/ebook/test-query.c
@@ -4,7 +4,7 @@
 #define QUERY_STRING1
 #define QUERY_STRING2
 
-static const gchar* queries[] = {
+static const gchar * queries[] = {
 	"(exists \"full_name\")",
 	"(contains \"full_name\" \"Miguel\")"
 
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index 347bca1..c4f3be8 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -641,7 +641,7 @@ xp_object_get_status (xmlXPathObjectPtr result)
 }
 
 #if 0
-static int
+static gint
 xp_object_get_number (xmlXPathObjectPtr result)
 {
 	gint ret = -1;
@@ -1482,7 +1482,7 @@ synchronize_cache (ECalBackendCalDAV *cbdav)
 	GList                    *cobjs, *created = NULL, *modified = NULL, *put_to_cache = NULL;
 	GList                    *citer;
 	gboolean                  res;
-	int			  len;
+	gint			  len;
 	gint                       i;
 
 	priv   = E_CAL_BACKEND_CALDAV_GET_PRIVATE (cbdav);
@@ -1741,7 +1741,7 @@ initialize_backend (ECalBackendCalDAV *cbdav)
 	ECalBackendSyncStatus     result;
 	ECalBackendCalDAVPrivate *priv;
 	ESource                  *source;
-	const char		 *os_val;
+	const gchar		 *os_val;
 	const gchar               *uri;
 	gsize                     len;
 	const gchar               *refresh;
diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c
index c511b66..29284f7 100644
--- a/calendar/backends/file/e-cal-backend-file.c
+++ b/calendar/backends/file/e-cal-backend-file.c
@@ -172,7 +172,7 @@ save_file_when_idle (gpointer user_data)
 	}
 
 	buf = icalcomponent_as_ical_string_r (priv->icalcomp);
-	g_output_stream_write_all (G_OUTPUT_STREAM (stream), buf, strlen (buf) * sizeof (char), NULL, NULL, &e);
+	g_output_stream_write_all (G_OUTPUT_STREAM (stream), buf, strlen (buf) * sizeof (gchar), NULL, NULL, &e);
 	g_free (buf);
 
 	if (e) {
@@ -2481,7 +2481,7 @@ fetch_attachments (ECalBackendSync *backend, ECalComponent *comp)
 	attach_store = g_build_filename (g_get_home_dir (),
 			".evolution/calendar/local/system", NULL);
 
-	for (l = attach_list; l ; l = l->next) {
+	for (l = attach_list; l; l = l->next) {
 		gchar *sfname = (gchar *)l->data;
 		gchar *filename, *new_filename;
 		GMappedFile *mapped_file;
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c b/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
index 34fcdb3..9756220 100644
--- a/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
+++ b/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
@@ -483,7 +483,7 @@ set_attendees_to_item (EGwItem *item, ECalComponent *comp, icaltimezone *default
 
 }
 
-static int
+static gint
 get_actual_count (ECalComponent *comp, ECalBackendGroupwise *cbgw)
 {
 	gint count = 0;
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise.c b/calendar/backends/groupwise/e-cal-backend-groupwise.c
index 834ba04..aec0661 100644
--- a/calendar/backends/groupwise/e-cal-backend-groupwise.c
+++ b/calendar/backends/groupwise/e-cal-backend-groupwise.c
@@ -266,7 +266,7 @@ populate_cache (ECalBackendGroupwise *cbgw)
 
 				/* Show the progress information */
 				num++;
-				percent = ((float) num/total) * 100;
+				percent = ((gfloat) num/total) * 100;
 
 				/* FIXME The total obtained from the server is wrong. Sometimes the num can
 				be greater than the total. The following makes sure that the percentage is not >= 100 */
diff --git a/calendar/backends/weather/e-cal-backend-weather.c b/calendar/backends/weather/e-cal-backend-weather.c
index f7ec0e2..a8c7e69 100644
--- a/calendar/backends/weather/e-cal-backend-weather.c
+++ b/calendar/backends/weather/e-cal-backend-weather.c
@@ -278,7 +278,7 @@ create_weather (ECalBackendWeather *cbw, WeatherInfo *report, gboolean is_foreca
 	icalcomponent             *ical_comp;
 	struct icaltimetype        itt;
 	ECalComponentDateTime      dt;
-	char			  *uid;
+	gchar			  *uid;
 	GSList                    *text_list = NULL;
 	ECalComponentText         *description;
 	ESource                   *source;
diff --git a/calendar/backends/weather/e-weather-source-ccf.c b/calendar/backends/weather/e-weather-source-ccf.c
index b66d2d2..215b2c5 100644
--- a/calendar/backends/weather/e-weather-source-ccf.c
+++ b/calendar/backends/weather/e-weather-source-ccf.c
@@ -212,7 +212,7 @@ decodeConditions (gchar code)
 	}
 }
 
-static int
+static gint
 decodePOP (gchar data)
 {
 	gint ret;
@@ -234,7 +234,7 @@ decodePOP (gchar data)
 }
 
 static void
-decodeSnowfall (gchar *data, float *low, float *high)
+decodeSnowfall (gchar *data, gfloat *low, gfloat *high)
 {
 	gchar num[3];
 	num[2] = '\0';
@@ -251,7 +251,7 @@ ftoc (gchar *data)
 	gint fahrenheit = atoi(data);
 	if (fahrenheit >= 900)
 		fahrenheit = (fahrenheit - 900) * -1;
-	return ((float)(fahrenheit-32)) * 5.0f / 9.0f;
+	return ((gfloat)(fahrenheit-32)) * 5.0f / 9.0f;
 }
 
 static void
diff --git a/calendar/libecal/e-cal-check-timezones.c b/calendar/libecal/e-cal-check-timezones.c
index 2ce1467..5fc75e5 100644
--- a/calendar/libecal/e-cal-check-timezones.c
+++ b/calendar/libecal/e-cal-check-timezones.c
@@ -35,7 +35,7 @@ static const gchar *e_cal_match_location(const gchar *location)
 {
     icaltimezone *icomp;
     const gchar *tail;
-    size_t len;
+    gsize len;
     gchar *buffer;
 
     icomp = icaltimezone_get_builtin_timezone (location);
@@ -70,8 +70,8 @@ const gchar *e_cal_match_tzid(const gchar *tzid)
 {
     const gchar *location;
     const gchar *systzid;
-    size_t len = strlen(tzid);
-    ssize_t eostr;
+    gsize len = strlen(tzid);
+    gssize eostr;
 
     /*
      * Try without any trailing spaces/digits: they might have been added
@@ -314,8 +314,8 @@ gboolean e_cal_check_timezones(icalcomponent *comp,
 
                         if (counter) {
                             gchar *fulltzid = g_strdup_printf("TZID:%s", value);
-                            size_t baselen = strlen("TZID:") + strlen(tzid);
-                            size_t fulllen = strlen(fulltzid);
+                            gsize baselen = strlen("TZID:") + strlen(tzid);
+                            gsize fulllen = strlen(fulltzid);
                             gchar *tzidprop;
                             /*
                              * Map TZID with counter suffix back to basename.
diff --git a/calendar/libecal/e-cal-component.c b/calendar/libecal/e-cal-component.c
index d3c7e7d..53ec4d7 100644
--- a/calendar/libecal/e-cal-component.c
+++ b/calendar/libecal/e-cal-component.c
@@ -3845,7 +3845,7 @@ e_cal_component_has_recurrences (ECalComponent *comp)
 }
 
 /* Counts the elements in the by_xxx fields of an icalrecurrencetype */
-static int
+static gint
 count_by_xxx (short *field, gint max_elements)
 {
 	gint i;
diff --git a/calendar/libecal/e-cal-recur.c b/calendar/libecal/e-cal-recur.c
index 1785fb0..9742de2 100644
--- a/calendar/libecal/e-cal-recur.c
+++ b/calendar/libecal/e-cal-recur.c
@@ -914,7 +914,7 @@ array_to_list (short *array, gint max_elements)
 	l = NULL;
 
 	for (i = 0; i < max_elements && array[i] != ICAL_RECURRENCE_ARRAY_MAX; i++)
-		l = g_list_prepend (l, GINT_TO_POINTER ((int) (array[i])));
+		l = g_list_prepend (l, GINT_TO_POINTER ((gint) (array[i])));
 	return g_list_reverse (l);
 }
 
diff --git a/calendar/libecal/e-cal-system-timezone.c b/calendar/libecal/e-cal-system-timezone.c
index 5104248..3ca2724 100644
--- a/calendar/libecal/e-cal-system-timezone.c
+++ b/calendar/libecal/e-cal-system-timezone.c
@@ -332,9 +332,9 @@ static gchar *
 system_timezone_read_etc_localtime_content (void)
 {
 	struct stat  stat_localtime;
-	char	*localtime_content = NULL;
+	gchar	*localtime_content = NULL;
 	gsize	localtime_content_len = -1;
-	char	*retval;
+	gchar	*retval;
 
 	if (g_stat (ETC_LOCALTIME, &stat_localtime) != 0)
 		return NULL;
diff --git a/calendar/libecal/e-cal-time-util.h b/calendar/libecal/e-cal-time-util.h
index 42e387f..6f36eee 100644
--- a/calendar/libecal/e-cal-time-util.h
+++ b/calendar/libecal/e-cal-time-util.h
@@ -24,16 +24,16 @@ G_BEGIN_DECLS
 
 /* Returns the number of days in the month. Year is the normal year, e.g. 2001.
    Month is 0 (Jan) to 11 (Dec). */
-int	time_days_in_month	(gint year, gint month);
+gint	time_days_in_month	(gint year, gint month);
 
 /* Returns the 1-based day number within the year of the specified date.
    Year is the normal year, e.g. 2001. Month is 0 to 11. */
-int	time_day_of_year	(gint day, gint month, gint year);
+gint	time_day_of_year	(gint day, gint month, gint year);
 
 /* Returns the day of the week for the specified date, 0 (Sun) to 6 (Sat).
    For the days that were removed on the Gregorian reformation, it returns
    Thursday. Year is the normal year, e.g. 2001. Month is 0 to 11. */
-int	time_day_of_week	(gint day, gint month, gint year);
+gint	time_day_of_week	(gint day, gint month, gint year);
 
 /* Returns whether the specified year is a leap year. Year is the normal year,
    e.g. 2001. */
@@ -41,7 +41,7 @@ gboolean time_is_leap_year	(gint year);
 
 /* Returns the number of leap years since year 1 up to (but not including) the
    specified year. Year is the normal year, e.g. 2001. */
-int	time_leap_years_up_to	(gint year);
+gint	time_leap_years_up_to	(gint year);
 
 /* Convert to or from an ISO 8601 representation of a time, in UTC,
    e.g. "20010708T183000Z". */
diff --git a/calendar/libedata-cal/e-cal-backend-sexp.c b/calendar/libedata-cal/e-cal-backend-sexp.c
index 09624b0..3e7d475 100644
--- a/calendar/libedata-cal/e-cal-backend-sexp.c
+++ b/calendar/libedata-cal/e-cal-backend-sexp.c
@@ -404,7 +404,7 @@ func_due_in_time_range (ESExp *esexp, gint argc, ESExpResult **argv, gpointer da
 	ESExpResult *result;
 	icaltimezone *zone;
 	ECalComponentDateTime dt;
-	time_t due_t ;
+	time_t due_t;
 	gboolean retval;
 
 	/* Check argument types */
@@ -637,7 +637,7 @@ matches_priority (ECalComponent *comp ,const gchar *pr)
 	else if (g_str_equal (pr, "LOW") && *priority > 5)
 		return TRUE;
 	else if (g_str_equal (pr, "UNDEFINED") && (!priority || !*priority))
-		return TRUE ;
+		return TRUE;
 
 	return FALSE;
 }
@@ -645,7 +645,7 @@ matches_priority (ECalComponent *comp ,const gchar *pr)
 static gboolean
 matches_status (ECalComponent *comp ,const gchar *str)
 {
-	icalproperty_status status ;
+	icalproperty_status status;
 
 	if (!*str)
 		return FALSE;
diff --git a/calendar/libedata-cal/e-data-cal-factory.c b/calendar/libedata-cal/e-data-cal-factory.c
index 25c8ccf..2c4da5b 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -116,7 +116,7 @@ backend_last_client_gone_cb (ECalBackend *backend, gpointer data)
 
 	uristr = e_cal_backend_get_uri (backend);
 	g_assert (uristr != NULL);
-	uri = g_strdup_printf("%s:%d", uristr, (int)e_cal_backend_get_kind(backend));
+	uri = g_strdup_printf("%s:%d", uristr, (gint)e_cal_backend_get_kind(backend));
 
 	g_mutex_lock (priv->backends_mutex);
 
@@ -186,7 +186,7 @@ impl_CalFactory_getCal (PortableServer_Servant servant,
 		return CORBA_OBJECT_NIL;
 	}
 
-	uri_type_string = g_strdup_printf ("%s:%d", str_uri, (int)calobjtype_to_icalkind (type));
+	uri_type_string = g_strdup_printf ("%s:%d", str_uri, (gint)calobjtype_to_icalkind (type));
 	g_free(str_uri);
 
 	/* Find the associated backend factory (if any) */
diff --git a/calendar/libedata-cal/e-data-cal-view.c b/calendar/libedata-cal/e-data-cal-view.c
index 303fab1..d6540f0 100644
--- a/calendar/libedata-cal/e-data-cal-view.c
+++ b/calendar/libedata-cal/e-data-cal-view.c
@@ -111,7 +111,7 @@ add_object_to_cache (EDataCalView *query, const gchar *calobj)
 
 	if (e_cal_component_is_instance (comp)) {
 		gchar *str;
-		str = e_cal_component_get_recurid_as_string (comp)	;
+		str = e_cal_component_get_recurid_as_string (comp);
 		real_uid = g_strdup_printf ("%s %s", uid, str);
 		g_free (str);
 	} else
diff --git a/camel/Makefile.am b/camel/Makefile.am
index 9029721..6e2f611 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -33,7 +33,6 @@ camellibexec_PROGRAMS =	$(LOCK_HELPER) camel-index-control-1.2
 lib_LTLIBRARIES = libcamel-1.2.la libcamel-provider-1.2.la
 
 INCLUDES = -I.. -I$(srcdir)/.. 			 	\
-	-I$(top_srcdir)/intl			 	\
 	-DCAMEL_LIBEXECDIR=\""$(camellibexecdir)"\"	\
 	-DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\" 	\
 	-DG_LOG_DOMAIN=\"camel\"			\
diff --git a/camel/camel-address.h b/camel/camel-address.h
index 23e1968..6bd17b6 100644
--- a/camel/camel-address.h
+++ b/camel/camel-address.h
@@ -58,15 +58,15 @@ struct _CamelAddressClass {
 CamelType	camel_address_get_type	(void);
 CamelAddress   *camel_address_new	(void);
 CamelAddress   *camel_address_new_clone	(const CamelAddress *addr);
-int		camel_address_length	(CamelAddress *addr);
+gint		camel_address_length	(CamelAddress *addr);
 
-int		camel_address_decode	(CamelAddress *addr, const gchar *raw);
-char	       *camel_address_encode	(CamelAddress *addr);
-int		camel_address_unformat	(CamelAddress *addr, const gchar *raw);
-char	       *camel_address_format	(CamelAddress *addr);
+gint		camel_address_decode	(CamelAddress *addr, const gchar *raw);
+gchar	       *camel_address_encode	(CamelAddress *addr);
+gint		camel_address_unformat	(CamelAddress *addr, const gchar *raw);
+gchar	       *camel_address_format	(CamelAddress *addr);
 
-int		camel_address_cat	(CamelAddress *dest, const CamelAddress *source);
-int		camel_address_copy	(CamelAddress *dest, const CamelAddress *source);
+gint		camel_address_cat	(CamelAddress *dest, const CamelAddress *source);
+gint		camel_address_copy	(CamelAddress *dest, const CamelAddress *source);
 
 void		camel_address_remove	(CamelAddress *addr, gint index);
 
diff --git a/camel/camel-arg.c b/camel/camel-arg.c
index 4c0af6c..5e98d78 100644
--- a/camel/camel-arg.c
+++ b/camel/camel-arg.c
@@ -50,7 +50,7 @@ gint camel_argv_build(CamelArgV *tv)
 			a->ca_object = va_arg(tv->ap, gpointer );
 			break;
 		case CAMEL_ARG_INT:
-			a->ca_int = va_arg(tv->ap, int);
+			a->ca_int = va_arg(tv->ap, gint);
 			break;
 		case CAMEL_ARG_DBL:
 			a->ca_double = va_arg(tv->ap, double);
@@ -62,7 +62,7 @@ gint camel_argv_build(CamelArgV *tv)
 			a->ca_ptr = va_arg(tv->ap, gpointer );
 			break;
 		case CAMEL_ARG_BOO:
-			a->ca_int = va_arg(tv->ap, int) != 0;
+			a->ca_int = va_arg(tv->ap, gint) != 0;
 			break;
 		default:
 			printf("Error, unknown type, truncating result\n");
@@ -105,7 +105,7 @@ gint camel_arggetv_build(CamelArgGetV *tv)
 			*a->ca_int = 0;
 			break;
 		case CAMEL_ARG_DBL:
-			a->ca_double = va_arg(tv->ap, double *);
+			a->ca_double = va_arg(tv->ap, gdouble *);
 			*a->ca_double = 0.0;
 			break;
 		case CAMEL_ARG_STR:
diff --git a/camel/camel-arg.h b/camel/camel-arg.h
index 5bc1b4c..0c60f15 100644
--- a/camel/camel-arg.h
+++ b/camel/camel-arg.h
@@ -39,7 +39,7 @@ enum camel_arg_t {
 
 	CAMEL_ARG_OBJ = 0x00000000, /* object */
 	CAMEL_ARG_INT = 0x10000000, /* gint */
-	CAMEL_ARG_DBL = 0x20000000, /* double */
+	CAMEL_ARG_DBL = 0x20000000, /* gdouble */
 	CAMEL_ARG_STR = 0x30000000, /* c string */
 	CAMEL_ARG_PTR = 0x40000000, /* ptr */
 	CAMEL_ARG_BOO = 0x50000000  /* bool */
@@ -56,7 +56,7 @@ struct _CamelArg {
 	union {
 		gpointer ca_object;
 		gint ca_int;
-		double ca_double;
+		gdouble ca_double;
 		gchar *ca_str;
 		gpointer ca_ptr;
 	} u;
@@ -66,7 +66,7 @@ struct _CamelArgGet {
 	union {
 		gpointer *ca_object;
 		gint *ca_int;
-		double *ca_double;
+		gdouble *ca_double;
 		gchar **ca_str;
 		gpointer *ca_ptr;
 	} u;
@@ -105,8 +105,8 @@ typedef struct _CamelProperty CamelProperty;
 
 struct _CamelProperty {
 	guint32 tag;
-	gchar *name;
-	gchar *description;
+	const gchar *name;
+	const gchar *description;
 };
 
 G_END_DECLS
diff --git a/camel/camel-block-file.c b/camel/camel-block-file.c
index 3939570..a626d58 100644
--- a/camel/camel-block-file.c
+++ b/camel/camel-block-file.c
@@ -80,7 +80,7 @@ static gint block_file_threshhold = 10;
 static gint sync_nolock(CamelBlockFile *bs);
 static gint sync_block_nolock(CamelBlockFile *bs, CamelBlock *bl);
 
-static int
+static gint
 block_file_validate_root(CamelBlockFile *bs)
 {
 	CamelBlockRoot *br;
@@ -95,9 +95,9 @@ block_file_validate_root(CamelBlockFile *bs)
 	d(printf("version: %.8s (%.8s)\n", bs->root->version, bs->version));
 	d(printf("block size: %d (%d)%s\n", br->block_size, bs->block_size,
 		br->block_size != bs->block_size ? " BAD":" OK"));
-	d(printf("free: %ld (%d add size < %ld)%s\n", (long)br->free, br->free / bs->block_size * bs->block_size, (long)st.st_size,
+	d(printf("free: %ld (%d add size < %ld)%s\n", (glong)br->free, br->free / bs->block_size * bs->block_size, (glong)st.st_size,
 		(br->free > st.st_size) || (br->free % bs->block_size) != 0 ? " BAD":" OK"));
-	d(printf("last: %ld (%d and size: %ld)%s\n", (long)br->last, br->last / bs->block_size * bs->block_size, (long)st.st_size,
+	d(printf("last: %ld (%d and size: %ld)%s\n", (glong)br->last, br->last / bs->block_size * bs->block_size, (glong)st.st_size,
 		(br->last != st.st_size) || ((br->last % bs->block_size) != 0) ? " BAD": " OK"));
 	d(printf("flags: %s\n", (br->flags & CAMEL_BLOCK_FILE_SYNC)?"SYNC":"unSYNC"));
 
@@ -116,9 +116,9 @@ block_file_validate_root(CamelBlockFile *bs)
 			g_warning("version: %.8s (%.8s)", bs->root->version, bs->version);
 			g_warning("block size: %d (%d)%s", br->block_size, bs->block_size,
 				  br->block_size != bs->block_size ? " BAD":" OK");
-			g_warning("free: %ld (%d add size < %ld)%s", (long)br->free, br->free / bs->block_size * bs->block_size, (long)st.st_size,
+			g_warning("free: %ld (%d add size < %ld)%s", (glong)br->free, br->free / bs->block_size * bs->block_size, (glong)st.st_size,
 				  (br->free > st.st_size) || (br->free % bs->block_size) != 0 ? " BAD":" OK");
-			g_warning("last: %ld (%d and size: %ld)%s", (long)br->last, br->last / bs->block_size * bs->block_size, (long)st.st_size,
+			g_warning("last: %ld (%d and size: %ld)%s", (glong)br->last, br->last / bs->block_size * bs->block_size, (glong)st.st_size,
 				  (br->last != st.st_size) || ((br->last % bs->block_size) != 0) ? " BAD": " OK");
 			g_warning("flags: %s", (br->flags & CAMEL_BLOCK_FILE_SYNC)?"SYNC":"unSYNC");
 		}
@@ -129,7 +129,7 @@ block_file_validate_root(CamelBlockFile *bs)
 	return 0;
 }
 
-static int
+static gint
 block_file_init_root(CamelBlockFile *bs)
 {
 	CamelBlockRoot *br = bs->root;
@@ -258,7 +258,7 @@ camel_block_file_get_type(void)
 }
 
 /* 'use' a block file for io */
-static int
+static gint
 block_file_use(CamelBlockFile *bs)
 {
 	struct _CamelBlockFilePrivate *nw, *nn, *p = bs->priv;
@@ -282,8 +282,9 @@ block_file_use(CamelBlockFile *bs)
 		CAMEL_BLOCK_FILE_UNLOCK(bs, io_lock);
 		errno = ENOENT;
 		return -1;
-	} else
+	} else {
 		d(printf("Turning block file online: %s\n", bs->path));
+	}
 
 	if ((bs->fd = g_open(bs->path, bs->flags|O_BINARY, 0600)) == -1) {
 		err = errno;
@@ -362,7 +363,7 @@ camel_cache_remove(c, key);
  *
  * Return value: The new block file, or NULL if it could not be created.
  **/
-CamelBlockFile *camel_block_file_new(const gchar *path, gint flags, const gchar version[8], size_t block_size)
+CamelBlockFile *camel_block_file_new(const gchar *path, gint flags, const gchar version[8], gsize block_size)
 {
 	CamelBlockFile *bs;
 
@@ -692,7 +693,7 @@ void camel_block_file_unref_block(CamelBlockFile *bs, CamelBlock *bl)
 	CAMEL_BLOCK_FILE_UNLOCK(bs, cache_lock);
 }
 
-static int
+static gint
 sync_block_nolock(CamelBlockFile *bs, CamelBlock *bl)
 {
 	d(printf("Sync block %08x: %s\n", bl->id, (bl->flags & CAMEL_BLOCK_DIRTY)?"dirty":"clean"));
@@ -708,7 +709,7 @@ sync_block_nolock(CamelBlockFile *bs, CamelBlock *bl)
 	return 0;
 }
 
-static int
+static gint
 sync_nolock(CamelBlockFile *bs)
 {
 	CamelBlock *bl, *bn;
@@ -877,13 +878,13 @@ camel_key_file_get_type(void)
 }
 
 /* 'use' a key file for io */
-static int
+static gint
 key_file_use(CamelKeyFile *bs)
 {
 	struct _CamelKeyFilePrivate *nw, *nn, *p = bs->priv;
 	CamelKeyFile *bf;
 	gint err, fd;
-	gchar *flag;
+	const gchar *flag;
 
 	/* We want to:
 	    remove file from active list
@@ -904,8 +905,9 @@ key_file_use(CamelKeyFile *bs)
 		CAMEL_KEY_FILE_UNLOCK(bs, lock);
 		errno = ENOENT;
 		return -1;
-	} else
+	} else {
 		d(printf("Turning key file online: '%s'\n", bs->path));
+	}
 
 	if ((bs->flags & O_ACCMODE) == O_RDONLY)
 		flag = "rb";
@@ -1085,7 +1087,7 @@ camel_key_file_delete(CamelKeyFile *kf)
  * Return value: -1 on io error.  The key file will remain unchanged.
  **/
 gint
-camel_key_file_write(CamelKeyFile *kf, camel_block_t *parent, size_t len, camel_key_t *records)
+camel_key_file_write(CamelKeyFile *kf, camel_block_t *parent, gsize len, camel_key_t *records)
 {
 	camel_block_t next;
 	guint32 size;
@@ -1140,10 +1142,10 @@ camel_key_file_write(CamelKeyFile *kf, camel_block_t *parent, size_t len, camel_
  * Return value: -1 on io error.
  **/
 gint
-camel_key_file_read(CamelKeyFile *kf, camel_block_t *start, size_t *len, camel_key_t **records)
+camel_key_file_read(CamelKeyFile *kf, camel_block_t *start, gsize *len, camel_key_t **records)
 {
 	guint32 size;
-	long pos = *start;
+	glong pos = *start;
 	camel_block_t next;
 	gint ret = -1;
 
diff --git a/camel/camel-block-file.h b/camel/camel-block-file.h
index 244e808..318a028 100644
--- a/camel/camel-block-file.h
+++ b/camel/camel-block-file.h
@@ -79,7 +79,7 @@ struct _CamelBlockFile {
 	gint flags;
 
 	gint fd;
-	size_t block_size;
+	gsize block_size;
 
 	CamelBlockRoot *root;
 	CamelBlock *root_block;
@@ -100,7 +100,7 @@ struct _CamelBlockFileClass {
 
 CamelType camel_block_file_get_type(void);
 
-CamelBlockFile *camel_block_file_new(const gchar *path, gint flags, const gchar version[8], size_t block_size);
+CamelBlockFile *camel_block_file_new(const gchar *path, gint flags, const gchar version[8], gsize block_size);
 gint camel_block_file_rename(CamelBlockFile *bs, const gchar *path);
 gint camel_block_file_delete(CamelBlockFile *kf);
 
@@ -137,11 +137,11 @@ struct _CamelKeyFileClass {
 CamelType      camel_key_file_get_type(void);
 
 CamelKeyFile * camel_key_file_new(const gchar *path, gint flags, const gchar version[8]);
-int	       camel_key_file_rename(CamelKeyFile *kf, const gchar *path);
-int	       camel_key_file_delete(CamelKeyFile *kf);
+gint	       camel_key_file_rename(CamelKeyFile *kf, const gchar *path);
+gint	       camel_key_file_delete(CamelKeyFile *kf);
 
-gint            camel_key_file_write(CamelKeyFile *kf, camel_block_t *parent, size_t len, camel_key_t *records);
-gint            camel_key_file_read(CamelKeyFile *kf, camel_block_t *start, size_t *len, camel_key_t **records);
+gint            camel_key_file_write(CamelKeyFile *kf, camel_block_t *parent, gsize len, camel_key_t *records);
+gint            camel_key_file_read(CamelKeyFile *kf, camel_block_t *start, gsize *len, camel_key_t **records);
 
 G_END_DECLS
 
diff --git a/camel/camel-certdb.c b/camel/camel-certdb.c
index 7a571de..dca9278 100644
--- a/camel/camel-certdb.c
+++ b/camel/camel-certdb.c
@@ -213,7 +213,7 @@ camel_certdb_set_filename (CamelCertDB *certdb, const gchar *filename)
 }
 
 
-static int
+static gint
 certdb_header_load (CamelCertDB *certdb, FILE *istream)
 {
 	if (camel_file_util_decode_uint32 (istream, &certdb->version) == -1)
@@ -298,7 +298,7 @@ camel_certdb_load (CamelCertDB *certdb)
 	return -1;
 }
 
-static int
+static gint
 certdb_header_save (CamelCertDB *certdb, FILE *ostream)
 {
 	if (camel_file_util_encode_uint32 (ostream, certdb->version) == -1)
@@ -309,7 +309,7 @@ certdb_header_save (CamelCertDB *certdb, FILE *ostream)
 	return 0;
 }
 
-static int
+static gint
 certdb_cert_save (CamelCertDB *certdb, CamelCert *cert, FILE *ostream)
 {
 	if (camel_file_util_encode_string (ostream, cert->issuer) == -1)
diff --git a/camel/camel-charset-map.c b/camel/camel-charset-map.c
index 51f802a..b8f0664 100644
--- a/camel/camel-charset-map.c
+++ b/camel/camel-charset-map.c
@@ -121,7 +121,7 @@ block_hash (gconstpointer v)
 	return h;
 }
 
-static int
+static gint
 block_equal (gconstpointer v1, gconstpointer v2)
 {
 	return !memcmp (v1, v2, 256);
@@ -132,7 +132,7 @@ gint main (gint argc, gchar **argv)
 	guchar *block = NULL;
 	guint bit = 0x01;
 	GHashTable *table_hash;
-	size_t inleft, outleft;
+	gsize inleft, outleft;
 	gchar *inbuf, *outbuf;
 	guint32 out[128], c;
 	gchar in[128];
@@ -176,7 +176,7 @@ gint main (gint argc, gchar **argv)
 	}
 
 	/* Mutibyte tables */
-	for ( ; tables[j].name && tables[j].multibyte; j++) {
+	for (; tables[j].name && tables[j].multibyte; j++) {
 		cd = iconv_open (tables[j].name, UCS);
 		if (cd == (iconv_t) -1)
 			continue;
@@ -187,7 +187,7 @@ gint main (gint argc, gchar **argv)
 			outbuf = in;
 			outleft = sizeof (in);
 
-			if (iconv (cd, &inbuf, &inleft, &outbuf, &outleft) != (size_t) -1) {
+			if (iconv (cd, &inbuf, &inleft, &outbuf, &outleft) != (gsize) -1) {
 				/* this is a legal character in charset table[j].name */
 				iconv (cd, NULL, NULL, &outbuf, &outleft);
 				encoding_map[i++] |= bit;
@@ -310,7 +310,7 @@ gint main (gint argc, gchar **argv)
 void
 camel_charset_init (CamelCharset *c)
 {
-	c->mask = (unsigned int) ~0;
+	c->mask = (guint) ~0;
 	c->level = 0;
 }
 
diff --git a/camel/camel-cipher-context.c b/camel/camel-cipher-context.c
index d0884d1..beea62b 100644
--- a/camel/camel-cipher-context.c
+++ b/camel/camel-cipher-context.c
@@ -94,7 +94,7 @@ camel_cipher_context_construct (CamelCipherContext *context, CamelSession *sessi
 	context->session = session;
 }
 
-static int
+static gint
 cipher_sign (CamelCipherContext *ctx, const gchar *userid, CamelCipherHash hash,
 	     struct _CamelMimePart *ipart, struct _CamelMimePart *opart, CamelException *ex)
 {
@@ -181,7 +181,7 @@ camel_cipher_verify (CamelCipherContext *context, struct _CamelMimePart *ipart,
 	return valid;
 }
 
-static int
+static gint
 cipher_encrypt (CamelCipherContext *context, const gchar *userid, GPtrArray *recipients,
 		struct _CamelMimePart *ipart, struct _CamelMimePart *opart, CamelException *ex)
 {
@@ -264,7 +264,7 @@ camel_cipher_decrypt(CamelCipherContext *context, struct _CamelMimePart *ipart,
 	return valid;
 }
 
-static int
+static gint
 cipher_import_keys (CamelCipherContext *context, struct _CamelStream *istream, CamelException *ex)
 {
 	camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -293,7 +293,7 @@ camel_cipher_import_keys (CamelCipherContext *context, struct _CamelStream *istr
 	return CCC_CLASS (context)->import_keys (context, istream, ex);
 }
 
-static int
+static gint
 cipher_export_keys (CamelCipherContext *context, GPtrArray *keys,
 		    struct _CamelStream *ostream, CamelException *ex)
 {
diff --git a/camel/camel-cipher-context.h b/camel/camel-cipher-context.h
index 251e6f4..828076c 100644
--- a/camel/camel-cipher-context.h
+++ b/camel/camel-cipher-context.h
@@ -178,7 +178,7 @@ void		     camel_cipher_validity_envelope(CamelCipherValidity *parent, CamelCiph
 void                 camel_cipher_validity_free (CamelCipherValidity *validity);
 
 /* utility functions */
-int		     camel_cipher_canonical_to_stream(CamelMimePart *part, guint32 flags, CamelStream *ostream);
+gint		     camel_cipher_canonical_to_stream(CamelMimePart *part, guint32 flags, CamelStream *ostream);
 
 G_END_DECLS
 
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
index 927fe6e..e9145d4 100644
--- a/camel/camel-data-wrapper.c
+++ b/camel/camel-data-wrapper.c
@@ -43,8 +43,8 @@ static CamelObjectClass *parent_class = NULL;
 #define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
 
 static gint construct_from_stream(CamelDataWrapper *, CamelStream *);
-static ssize_t write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static ssize_t decode_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
+static gssize write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
+static gssize decode_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
 static void set_mime_type (CamelDataWrapper *data_wrapper, const gchar *mime_type);
 static gchar *get_mime_type (CamelDataWrapper *data_wrapper);
 static CamelContentType *get_mime_type_field (CamelDataWrapper *data_wrapper);
@@ -129,10 +129,10 @@ camel_data_wrapper_new (void)
 	return (CamelDataWrapper *) camel_object_new (CAMEL_DATA_WRAPPER_TYPE);
 }
 
-static ssize_t
+static gssize
 write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
 {
-	ssize_t ret;
+	gssize ret;
 
 	if (data_wrapper->stream == NULL) {
 		return -1;
@@ -164,7 +164,7 @@ write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
  *
  * Returns: the number of bytes written, or %-1 on fail
  **/
-ssize_t
+gssize
 camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
 				    CamelStream *stream)
 {
@@ -175,12 +175,12 @@ camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper,
 }
 
 
-static ssize_t
+static gssize
 decode_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
 {
 	CamelMimeFilter *filter;
 	CamelStream *fstream;
-	ssize_t ret;
+	gssize ret;
 
 	fstream = (CamelStream *) camel_stream_filter_new_with_stream (stream);
 
@@ -228,7 +228,7 @@ decode_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
  *
  * Returns: the number of bytes written, or %-1 on fail
  **/
-ssize_t
+gssize
 camel_data_wrapper_decode_to_stream (CamelDataWrapper *data_wrapper,
 				     CamelStream *stream)
 {
@@ -239,7 +239,7 @@ camel_data_wrapper_decode_to_stream (CamelDataWrapper *data_wrapper,
 }
 
 
-static int
+static gint
 construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
 {
 	if (data_wrapper->stream)
diff --git a/camel/camel-data-wrapper.h b/camel/camel-data-wrapper.h
index 993a789..acef9d6 100644
--- a/camel/camel-data-wrapper.h
+++ b/camel/camel-data-wrapper.h
@@ -61,10 +61,10 @@ typedef struct {
 	void                (*set_mime_type_field)    (CamelDataWrapper *data_wrapper,
 						       CamelContentType *mime_type_field);
 
-	ssize_t             (*write_to_stream)        (CamelDataWrapper *data_wrapper,
+	gssize             (*write_to_stream)        (CamelDataWrapper *data_wrapper,
 						       CamelStream *stream);
 
-	ssize_t             (*decode_to_stream)       (CamelDataWrapper *data_wrapper,
+	gssize             (*decode_to_stream)       (CamelDataWrapper *data_wrapper,
 						       CamelStream *stream);
 
 	gint                 (*construct_from_stream)  (CamelDataWrapper *data_wrapper,
@@ -78,9 +78,9 @@ CamelType camel_data_wrapper_get_type (void);
 
 /* public methods */
 CamelDataWrapper *camel_data_wrapper_new(void);
-ssize_t           camel_data_wrapper_write_to_stream        (CamelDataWrapper *data_wrapper,
+gssize           camel_data_wrapper_write_to_stream        (CamelDataWrapper *data_wrapper,
 							     CamelStream *stream);
-ssize_t           camel_data_wrapper_decode_to_stream       (CamelDataWrapper *data_wrapper,
+gssize           camel_data_wrapper_decode_to_stream       (CamelDataWrapper *data_wrapper,
 							     CamelStream *stream);
 
 void              camel_data_wrapper_set_mime_type          (CamelDataWrapper *data_wrapper,
diff --git a/camel/camel-db.c b/camel/camel-db.c
index 72ec538..37ff79f 100644
--- a/camel/camel-db.c
+++ b/camel/camel-db.c
@@ -50,7 +50,7 @@ typedef struct {
 	gint flags;
 } CamelSqlite3File;
 
-static int
+static gint
 call_old_file_Sync (CamelSqlite3File *cFile, gint flags)
 {
 	g_return_val_if_fail (old_vfs != NULL, SQLITE_ERROR);
@@ -133,7 +133,7 @@ sync_push_request (CamelSqlite3File *cFile)
 }
 
 #define def_subclassed(_nm, _params, _call)			\
-static int							\
+static gint							\
 camel_sqlite3_file_ ## _nm _params				\
 {								\
 	CamelSqlite3File *cFile;				\
@@ -158,7 +158,7 @@ def_subclassed (xDeviceCharacteristics, (sqlite3_file *pFile), (cFile->old_vfs_f
 
 #undef def_subclassed
 
-static int
+static gint
 camel_sqlite3_file_xCheckReservedLock (sqlite3_file *pFile, gint *pResOut)
 {
 	CamelSqlite3File *cFile;
@@ -176,7 +176,7 @@ camel_sqlite3_file_xCheckReservedLock (sqlite3_file *pFile, gint *pResOut)
 		return ((gint (*)(sqlite3_file *, gint *)) (cFile->old_vfs_file->pMethods->xCheckReservedLock)) (cFile->old_vfs_file, pResOut);
 }
 
-static int
+static gint
 camel_sqlite3_file_xClose (sqlite3_file *pFile)
 {
 	CamelSqlite3File *cFile;
@@ -225,7 +225,7 @@ camel_sqlite3_file_xClose (sqlite3_file *pFile)
 	return res;
 }
 
-static int
+static gint
 camel_sqlite3_file_xSync (sqlite3_file *pFile, gint flags)
 {
 	CamelSqlite3File *cFile;
@@ -256,7 +256,7 @@ camel_sqlite3_file_xSync (sqlite3_file *pFile, gint flags)
 	return SQLITE_OK;
 }
 
-static int
+static gint
 camel_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs, const gchar *zPath, sqlite3_file *pFile, gint flags, gint *pOutFlags)
 {
 	static GStaticRecMutex only_once_lock = G_STATIC_REC_MUTEX_INIT;
@@ -354,7 +354,7 @@ static GStaticRecMutex trans_lock = G_STATIC_REC_MUTEX_INIT;
 
 static gint write_mir (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, CamelException *ex, gboolean delete_old_record);
 
-static int
+static gint
 cdb_sql_exec (sqlite3 *db, const gchar * stmt, CamelException *ex)
 {
 	gchar *errmsg = NULL;
@@ -589,7 +589,7 @@ end:
 	return ret;
 }
 
-static int
+static gint
 count_cb (gpointer data, gint argc, gchar **argv, gchar **azColName)
 {
 	gint i;
@@ -866,7 +866,7 @@ camel_db_delete_uid_from_vfolder (CamelDB *db, gchar *folder_name, gchar *vuid,
 }
 
 gint
-camel_db_delete_uid_from_vfolder_transaction (CamelDB *db, gchar *folder_name, gchar *vuid, CamelException *ex)
+camel_db_delete_uid_from_vfolder_transaction (CamelDB *db, const gchar *folder_name, const gchar *vuid, CamelException *ex)
 {
 	gchar *del_query;
 	gint ret;
@@ -884,7 +884,7 @@ struct _db_data_uids_flags {
 	GPtrArray *uids;
 	GPtrArray *flags;
 };
-static int
+static gint
 read_uids_flags_callback (gpointer ref, gint ncol, gchar ** cols, gchar ** name)
 {
 	struct _db_data_uids_flags *data= (struct _db_data_uids_flags *) ref;
@@ -927,7 +927,7 @@ camel_db_get_folder_uids_flags (CamelDB *db, const gchar *folder_name, const gch
 	 return ret;
 }
 
-static int
+static gint
 read_uids_callback (gpointer ref, gint ncol, gchar ** cols, gchar ** name)
 {
 	GPtrArray *array = (GPtrArray *) ref;
@@ -999,7 +999,7 @@ camel_db_get_folder_deleted_uids (CamelDB *db, gchar *folder_name, CamelExceptio
 	 return array;
 }
 
-static int
+static gint
 read_preview_callback (gpointer ref, gint ncol, gchar ** cols, gchar ** name)
 {
 	GHashTable *hash = (GHashTable *)ref;
@@ -1053,7 +1053,7 @@ camel_db_write_preview_record (CamelDB *db, gchar *folder_name, const gchar *uid
 	return ret;
 }
 
-static int
+static gint
 read_vuids_callback (gpointer ref, gint ncol, gchar ** cols, gchar ** name)
 {
 	 GPtrArray *array = (GPtrArray *)ref;
@@ -1136,14 +1136,14 @@ camel_db_add_to_vfolder_transaction (CamelDB *db, gchar *folder_name, gchar *vui
 gint
 camel_db_create_folders_table (CamelDB *cdb, CamelException *ex)
 {
-	gchar *query = "CREATE TABLE IF NOT EXISTS folders ( folder_name TEXT PRIMARY KEY, version REAL, flags INTEGER, nextuid INTEGER, time NUMERIC, saved_count INTEGER, unread_count INTEGER, deleted_count INTEGER, junk_count INTEGER, visible_count INTEGER, jnd_count INTEGER, bdata TEXT )";
+	const gchar *query = "CREATE TABLE IF NOT EXISTS folders ( folder_name TEXT PRIMARY KEY, version REAL, flags INTEGER, nextuid INTEGER, time NUMERIC, saved_count INTEGER, unread_count INTEGER, deleted_count INTEGER, junk_count INTEGER, visible_count INTEGER, jnd_count INTEGER, bdata TEXT )";
 	CAMEL_DB_RELEASE_SQLITE_MEMORY;
 	return ((camel_db_command (cdb, query, ex)));
 }
 
 
 
-static int
+static gint
 camel_db_create_message_info_table (CamelDB *cdb, const gchar *folder_name, CamelException *ex)
 {
 	gint ret;
@@ -1197,7 +1197,7 @@ camel_db_create_message_info_table (CamelDB *cdb, const gchar *folder_name, Came
 	return ret;
 }
 
-static int
+static gint
 camel_db_migrate_folder_prepare (CamelDB *cdb, const gchar *folder_name, gint version, CamelException *ex)
 {
 	gint ret = 0;
@@ -1237,7 +1237,7 @@ camel_db_migrate_folder_prepare (CamelDB *cdb, const gchar *folder_name, gint ve
 	return ret;
 }
 
-static int
+static gint
 camel_db_migrate_folder_recreate (CamelDB *cdb, const gchar *folder_name, gint version, CamelException *ex)
 {
 	gint ret = 0;
@@ -1260,7 +1260,7 @@ camel_db_migrate_folder_recreate (CamelDB *cdb, const gchar *folder_name, gint v
 	return ret;
 }
 
-static int
+static gint
 camel_db_write_folder_version (CamelDB *cdb, const gchar *folder_name, gint old_version, CamelException *ex)
 {
 	gint ret = 0;
@@ -1283,7 +1283,7 @@ camel_db_write_folder_version (CamelDB *cdb, const gchar *folder_name, gint old_
 	return ret;
 }
 
-static int
+static gint
 camel_db_get_folder_version (CamelDB *cdb, const gchar *folder_name, CamelException *ex)
 {
 	gint version = -1, ret;
@@ -1341,11 +1341,11 @@ camel_db_write_message_info_record (CamelDB *cdb, const gchar *folder_name, Came
 	return write_mir (cdb, folder_name, record, ex, TRUE);
 }
 
-static int
+static gint
 write_mir (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, CamelException *ex, gboolean delete_old_record)
 {
 	gint ret;
-	gchar *del_query;
+	/*char *del_query;*/
 	gchar *ins_query;
 
 	/* FIXME: We should migrate from this DELETE followed by INSERT model to an INSERT OR REPLACE model as pointed out by pvanhoof */
@@ -1356,7 +1356,7 @@ write_mir (CamelDB *cdb, const gchar *folder_name, CamelMIRecord *record, CamelE
 			folder_name, record->uid, record->flags,
 			record->msg_type, record->read, record->deleted, record->replied,
 			record->important, record->junk, record->attachment, record->dirty,
-			record->size, (long long) record->dsent, (long long) record->dreceived,
+			record->size, (gint64) record->dsent, (gint64) record->dreceived,
 			record->subject, record->from, record->to,
 			record->cc, record->mlist, record->followup_flag,
 			record->followup_completed_on, record->followup_due_by,
@@ -1423,7 +1423,7 @@ camel_db_write_folder_info_record (CamelDB *cdb, CamelFIRecord *record, CamelExc
 	return ret;
 }
 
-static int
+static gint
 read_fir_callback (gpointer  ref, gint ncol, gchar ** cols, gchar ** name)
 {
 	CamelFIRecord *record = *(CamelFIRecord **) ref;
@@ -1515,7 +1515,7 @@ camel_db_read_message_info_records (CamelDB *cdb, const gchar *folder_name, gpoi
 	return (ret);
 }
 
-static int
+static gint
 camel_db_create_deleted_table (CamelDB *cdb, CamelException *ex)
 {
 	gint ret;
@@ -1526,7 +1526,7 @@ camel_db_create_deleted_table (CamelDB *cdb, CamelException *ex)
 	return ret;
 }
 
-static int
+static gint
 camel_db_trim_deleted_table (CamelDB *cdb, CamelException *ex)
 {
 	gint ret = 0;
@@ -1564,8 +1564,8 @@ camel_db_delete_uid (CamelDB *cdb, const gchar *folder, const gchar *uid, CamelE
 	return ret;
 }
 
-static int
-cdb_delete_ids (CamelDB *cdb, const gchar * folder_name, GSList *uids, gchar *uid_prefix, const gchar *field, CamelException *ex)
+static gint
+cdb_delete_ids (CamelDB *cdb, const gchar * folder_name, GSList *uids, const gchar *uid_prefix, const gchar *field, CamelException *ex)
 {
 	gchar *tmp;
 	gint ret;
@@ -1645,7 +1645,7 @@ camel_db_delete_uids (CamelDB *cdb, const gchar * folder_name, GSList *uids, Cam
 }
 
 gint
-camel_db_delete_vuids (CamelDB *cdb, const gchar * folder_name, gchar *hash, GSList *uids, CamelException *ex)
+camel_db_delete_vuids (CamelDB *cdb, const gchar * folder_name, const gchar *hash, GSList *uids, CamelException *ex)
 {
 	return cdb_delete_ids (cdb, folder_name, uids, hash, "vuid", ex);
 }
diff --git a/camel/camel-db.h b/camel/camel-db.h
index c73b6f4..64161a8 100644
--- a/camel/camel-db.h
+++ b/camel/camel-db.h
@@ -16,7 +16,7 @@
 
 typedef struct _CamelDBPrivate CamelDBPrivate;
 
-typedef int(*CamelDBCollate)(gpointer ,int,gconstpointer ,int,gconstpointer );
+typedef gint(*CamelDBCollate)(gpointer ,int,gconstpointer ,int,gconstpointer );
 
 struct _CamelDB {
 	sqlite3 *db;
@@ -127,7 +127,7 @@ gint camel_db_delete_folder (CamelDB *cdb, const gchar *folder, CamelException *
 gint camel_db_delete_uid (CamelDB *cdb, const gchar *folder, const gchar *uid, CamelException *ex);
 /*int camel_db_delete_uids (CamelDB *cdb, CamelException *ex, gint nargs, ... );*/
 gint camel_db_delete_uids (CamelDB *cdb, const gchar * folder_name, GSList *uids, CamelException *ex);
-gint camel_db_delete_vuids (CamelDB *cdb, const gchar * folder_name, gchar *shash, GSList *uids, CamelException *ex);
+gint camel_db_delete_vuids (CamelDB *cdb, const gchar * folder_name, const gchar *shash, GSList *uids, CamelException *ex);
 
 gint camel_db_create_folders_table (CamelDB *cdb, CamelException *ex);
 gint camel_db_select (CamelDB *cdb, const gchar * stmt, CamelDBSelectCB callback, gpointer data, CamelException *ex);
@@ -157,7 +157,7 @@ void camel_db_camel_mir_free (CamelMIRecord *record);
 gint camel_db_create_vfolder (CamelDB *db, const gchar *folder_name, CamelException *ex);
 gint camel_db_recreate_vfolder (CamelDB *db, const gchar *folder_name, CamelException *ex);
 gint camel_db_delete_uid_from_vfolder (CamelDB *db, gchar *folder_name, gchar *vuid, CamelException *ex);
-gint camel_db_delete_uid_from_vfolder_transaction (CamelDB *db, gchar *folder_name, gchar *vuid, CamelException *ex);
+gint camel_db_delete_uid_from_vfolder_transaction (CamelDB *db, const gchar *folder_name, const gchar *vuid, CamelException *ex);
 GPtrArray * camel_db_get_vuids_from_vfolder (CamelDB *db, gchar *folder_name, gchar *filter, CamelException *ex);
 gint camel_db_add_to_vfolder (CamelDB *db, gchar *folder_name, gchar *vuid, CamelException *ex);
 gint camel_db_add_to_vfolder_transaction (CamelDB *db, gchar *folder_name, gchar *vuid, CamelException *ex);
diff --git a/camel/camel-debug.c b/camel/camel-debug.c
index 5b377e7..0c8ad92 100644
--- a/camel/camel-debug.c
+++ b/camel/camel-debug.c
@@ -181,7 +181,7 @@ i386_length_and_rw_bits (gint len, enum target_hw_bp_type type)
 #endif
       default:
         internal_error (__FILE__, __LINE__, "\
-Invalid hw breakpoint type %d in i386_length_and_rw_bits.\n", (int)type);
+Invalid hw breakpoint type %d in i386_length_and_rw_bits.\n", (gint)type);
     }
 
   switch (len)
diff --git a/camel/camel-digest-store.c b/camel/camel-digest-store.c
index 2a893ba..3ed3792 100644
--- a/camel/camel-digest-store.c
+++ b/camel/camel-digest-store.c
@@ -108,14 +108,14 @@ camel_digest_store_finalise (CamelObject *obj)
 
 }
 
-static int
+static gint
 digest_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
 {
 	/* CamelDigestStore doesn't currently have anything to set */
 	return CAMEL_OBJECT_CLASS (parent_class)->setv (object, ex, args);
 }
 
-static int
+static gint
 digest_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	/* CamelDigestStore doesn't currently have anything to get */
diff --git a/camel/camel-disco-diary.c b/camel/camel-disco-diary.c
index b3fdb07..a76073c 100644
--- a/camel/camel-disco-diary.c
+++ b/camel/camel-disco-diary.c
@@ -106,7 +106,7 @@ camel_disco_diary_get_type (void)
 }
 
 
-static int
+static gint
 diary_encode_uids (CamelDiscoDiary *diary, GPtrArray *uids)
 {
 	gint i, status;
@@ -285,7 +285,7 @@ camel_disco_diary_replay (CamelDiscoDiary *diary, CamelException *ex)
 {
 	guint32 action;
 	off_t size;
-	double pc;
+	gdouble pc;
 
 	d(printf("disco diary replay\n"));
 
diff --git a/camel/camel-disco-folder.c b/camel/camel-disco-folder.c
index 61f29ff..1d95f35 100644
--- a/camel/camel-disco-folder.c
+++ b/camel/camel-disco-folder.c
@@ -184,7 +184,7 @@ camel_disco_folder_get_type (void)
 	return camel_disco_folder_type;
 }
 
-static int
+static gint
 disco_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	gint i, count=0;
@@ -223,7 +223,7 @@ disco_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 	return 0;
 }
 
-static int
+static gint
 disco_setv(CamelObject *object, CamelException *ex, CamelArgV *args)
 {
 	gint save = 0;
diff --git a/camel/camel-disco-store.c b/camel/camel-disco-store.c
index 0673c31..16a5a7c 100644
--- a/camel/camel-disco-store.c
+++ b/camel/camel-disco-store.c
@@ -110,14 +110,14 @@ camel_disco_store_get_type (void)
 	return camel_disco_store_type;
 }
 
-static int
+static gint
 disco_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
 {
 	/* CamelDiscoStore doesn't currently have anything to set */
 	return CAMEL_OBJECT_CLASS (parent_class)->setv (object, ex, args);
 }
 
-static int
+static gint
 disco_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	/* CamelDiscoStore doesn't currently have anything to get */
diff --git a/camel/camel-file-utils.c b/camel/camel-file-utils.c
index 2c78eb1..7122cb2 100644
--- a/camel/camel-file-utils.c
+++ b/camel/camel-file-utils.c
@@ -150,7 +150,7 @@ camel_file_util_decode_fixed_int32 (FILE *in, gint32 *dest)
 }
 
 #define CFU_ENCODE_T(type)						\
-int									\
+gint									\
 camel_file_util_encode_##type(FILE *out, type value)			\
 {									\
 	gint i;								\
@@ -163,7 +163,7 @@ camel_file_util_encode_##type(FILE *out, type value)			\
 }
 
 #define CFU_DECODE_T(type)				\
-int							\
+gint							\
 camel_file_util_decode_##type(FILE *in, type *dest)	\
 {							\
 	type save = 0;					\
@@ -227,27 +227,27 @@ CFU_ENCODE_T(off_t)
 CFU_DECODE_T(off_t)
 
 /**
- * camel_file_util_encode_size_t:
+ * camel_file_util_encode_gsize:
  * @out: file to output to
  * @value: value to output
  *
- * Encode an size_t type.
+ * Encode an gsize type.
  *
  * Return value: %0 on success, %-1 on error.
  **/
-CFU_ENCODE_T(size_t)
+CFU_ENCODE_T(gsize)
 
 
 /**
- * camel_file_util_decode_size_t:
+ * camel_file_util_decode_gsize:
  * @in: file to read from
  * @dest: pointer to a variable to put the value in
  *
- * Decode an size_t type.
+ * Decode an gsize type.
  *
  * Return value: %0 on success, %-1 on failure.
  **/
-CFU_DECODE_T(size_t)
+CFU_DECODE_T(gsize)
 
 
 /**
@@ -329,7 +329,7 @@ camel_file_util_decode_string (FILE *in, gchar **str)
  * Return value: %0 on success, %-1 on error.
  **/
 gint
-camel_file_util_encode_fixed_string (FILE *out, const gchar *str, size_t len)
+camel_file_util_encode_fixed_string (FILE *out, const gchar *str, gsize len)
 {
 	gchar buf[len];
 
@@ -362,7 +362,7 @@ camel_file_util_encode_fixed_string (FILE *out, const gchar *str, size_t len)
  * Return value: %0 on success, %-1 on error.
  **/
 gint
-camel_file_util_decode_fixed_string (FILE *in, gchar **str, size_t len)
+camel_file_util_decode_fixed_string (FILE *in, gchar **str, gsize len)
 {
 	register gchar *ret;
 
@@ -424,10 +424,10 @@ camel_file_util_safe_filename (const gchar *name)
  * Returns: number of bytes read or -1 on fail. On failure, errno will
  * be set appropriately.
  **/
-ssize_t
-camel_read (gint fd, gchar *buf, size_t n)
+gssize
+camel_read (gint fd, gchar *buf, gsize n)
 {
-	ssize_t nread;
+	gssize nread;
 	gint cancel_fd;
 
 	if (camel_operation_cancel_check (NULL)) {
@@ -502,10 +502,10 @@ camel_read (gint fd, gchar *buf, size_t n)
  * Returns: number of bytes written or -1 on fail. On failure, errno will
  * be set appropriately.
  **/
-ssize_t
-camel_write (gint fd, const gchar *buf, size_t n)
+gssize
+camel_write (gint fd, const gchar *buf, gsize n)
 {
-	ssize_t w, written = 0;
+	gssize w, written = 0;
 	gint cancel_fd;
 
 	if (camel_operation_cancel_check (NULL)) {
@@ -593,13 +593,13 @@ camel_write (gint fd, const gchar *buf, size_t n)
  * be set appropriately. If the socket is nonblocking
  * camel_read_socket() will retry the read until it gets something.
  **/
-ssize_t
-camel_read_socket (gint fd, gchar *buf, size_t n)
+gssize
+camel_read_socket (gint fd, gchar *buf, gsize n)
 {
 #ifndef G_OS_WIN32
 	return camel_read (fd, buf, n);
 #else
-	ssize_t nread;
+	gssize nread;
 	gint cancel_fd;
 
 	if (camel_operation_cancel_check (NULL)) {
@@ -663,13 +663,13 @@ camel_read_socket (gint fd, gchar *buf, size_t n)
  * Returns: number of bytes written or -1 on fail. On failure, errno will
  * be set appropriately.
  **/
-ssize_t
-camel_write_socket (gint fd, const gchar *buf, size_t n)
+gssize
+camel_write_socket (gint fd, const gchar *buf, gsize n)
 {
 #ifndef G_OS_WIN32
 	return camel_write (fd, buf, n);
 #else
-	ssize_t w, written = 0;
+	gssize w, written = 0;
 	gint cancel_fd;
 
 	if (camel_operation_cancel_check (NULL)) {
diff --git a/camel/camel-file-utils.h b/camel/camel-file-utils.h
index 243e1c5..dfcf3d1 100644
--- a/camel/camel-file-utils.h
+++ b/camel/camel-file-utils.h
@@ -47,12 +47,12 @@ gint camel_file_util_encode_time_t (FILE *out, time_t value);
 gint camel_file_util_decode_time_t (FILE *in, time_t *dest);
 gint camel_file_util_encode_off_t (FILE *out, off_t value);
 gint camel_file_util_decode_off_t (FILE *in, off_t *dest);
-gint camel_file_util_encode_size_t (FILE *out, size_t value);
-gint camel_file_util_decode_size_t (FILE *in, size_t *dest);
+gint camel_file_util_encode_gsize (FILE *out, gsize value);
+gint camel_file_util_decode_gsize (FILE *in, gsize *dest);
 gint camel_file_util_encode_string (FILE *out, const gchar *str);
 gint camel_file_util_decode_string (FILE *in, gchar **str);
-gint camel_file_util_encode_fixed_string (FILE *out, const gchar *str, size_t len);
-gint camel_file_util_decode_fixed_string (FILE *in, gchar **str, size_t len);
+gint camel_file_util_encode_fixed_string (FILE *out, const gchar *str, gsize len);
+gint camel_file_util_decode_fixed_string (FILE *in, gchar **str, gsize len);
 
 
 gchar *camel_file_util_safe_filename (const gchar *name);
@@ -64,11 +64,11 @@ gchar *camel_file_util_safe_filename (const gchar *name);
  * camel_read_socket() and camel_write_socket(). These are cancellable
  * also on Win32.
  */
-ssize_t camel_read (gint fd, gchar *buf, size_t n);
-ssize_t camel_write (gint fd, const gchar *buf, size_t n);
+gssize camel_read (gint fd, gchar *buf, gsize n);
+gssize camel_write (gint fd, const gchar *buf, gsize n);
 
-ssize_t camel_read_socket (gint fd, gchar *buf, size_t n);
-ssize_t camel_write_socket (gint fd, const gchar *buf, size_t n);
+gssize camel_read_socket (gint fd, gchar *buf, gsize n);
+gssize camel_write_socket (gint fd, const gchar *buf, gsize n);
 
 gchar *camel_file_util_savename(const gchar *filename);
 
diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c
index d84746d..e215523 100644
--- a/camel/camel-filter-driver.c
+++ b/camel/camel-filter-driver.c
@@ -154,7 +154,7 @@ static ESExpResult *pipe_message (struct _ESExp *f, gint argc, struct _ESExpResu
 
 /* these are our filter actions - each must have a callback */
 static struct {
-	gchar *name;
+	const gchar *name;
 	ESExpFunc *func;
 	gint type;		/* set to 1 if a function can perform shortcut evaluation, or
 				   doesn't execute everything, 0 otherwise */
@@ -747,7 +747,7 @@ child_watch (GPid     pid,
 	g_main_loop_quit (child_watch_data->loop);
 }
 
-static int
+static gint
 pipe_to_system (struct _ESExp *f, gint argc, struct _ESExpResult **argv, CamelFilterDriver *driver)
 {
 	struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
@@ -1027,7 +1027,7 @@ close_folder (gpointer key, gpointer value, gpointer data)
 }
 
 /* flush/close all folders */
-static int
+static gint
 close_folders (CamelFilterDriver *driver)
 {
 	struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
@@ -1169,7 +1169,7 @@ camel_filter_driver_flush (CamelFilterDriver *driver, CamelException *ex)
 }
 
 
-static int
+static gint
 decode_flags_from_xev(const gchar *xev, CamelMessageInfoBase *mi)
 {
 	guint32 uid, flags = 0;
@@ -1241,7 +1241,7 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const gchar *mbox, c
 		const gchar *xev;
 
 		if (st.st_size > 0)
-			pc = (int)(100.0 * ((double)camel_mime_parser_tell (mp) / (double)st.st_size));
+			pc = (gint)(100.0 * ((double)camel_mime_parser_tell (mp) / (double)st.st_size));
 
 		report_status (driver, CAMEL_FILTER_STATUS_START, pc, _("Getting message %d (%d%%)"), i, pc);
 
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
index aebfcf4..0908188 100644
--- a/camel/camel-filter-search.c
+++ b/camel/camel-filter-search.c
@@ -97,7 +97,7 @@ static ESExpResult *junk_test (struct _ESExp *f, gint argc, struct _ESExpResult
 
 /* builtin functions */
 static struct {
-	gchar *name;
+	const gchar *name;
 	ESExpFunc *func;
 	gint type;		/* set to 1 if a function can perform shortcut evaluation, or
 				   doesn't execute everything, 0 otherwise */
@@ -539,7 +539,7 @@ child_watch (GPid     pid,
 	g_main_loop_quit (child_watch_data->loop);
 }
 
-static int
+static gint
 run_command (struct _ESExp *f, gint argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
 {
 	CamelMimeMessage *message;
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index edadf62..100d34d 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -180,7 +180,7 @@ camel_folder_search_get_type (void)
 #endif
 
 static struct {
-	gchar *name;
+	const gchar *name;
 	gint offset;
 	gint flags;		/* 0x02 = immediate, 0x01 = always enter */
 } builtins[] = {
@@ -1050,7 +1050,7 @@ check_header (struct _ESExp *f, gint argc, struct _ESExpResult **argv, CamelFold
 			header = camel_message_info_subject(search->current);
 		} else if (!g_ascii_strcasecmp(headername, "date")) {
 			/* FIXME: not a very useful form of the date */
-			sprintf(strbuf, "%d", (int)camel_message_info_date_sent(search->current));
+			sprintf(strbuf, "%d", (gint)camel_message_info_date_sent(search->current));
 			header = strbuf;
 		} else if (!g_ascii_strcasecmp(headername, "from")) {
 			header = camel_message_info_from(search->current);
@@ -1291,7 +1291,7 @@ htand(gchar *key, gint value, struct IterData *iter_data)
 		g_ptr_array_add(iter_data->uids, key);
 }
 
-static int
+static gint
 match_message_index(CamelIndex *idx, const gchar *uid, const gchar *match, CamelException *ex)
 {
 	CamelIndexCursor *wc, *nc;
@@ -1772,7 +1772,7 @@ search_uid(struct _ESExp *f, gint argc, struct _ESExpResult **argv, CamelFolderS
 	return r;
 }
 
-static int
+static gint
 read_uid_callback (gpointer  ref, gint ncol, gchar ** cols, gchar **name)
 {
 	GPtrArray *matches;
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 25af5c0..571c72d 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -110,24 +110,25 @@ static gint my_list_size(struct _node **list);
 
 static gint summary_header_load(CamelFolderSummary *, FILE *);
 static gint summary_header_save(CamelFolderSummary *, FILE *);
+#if 0
 static gint summary_meta_header_load(CamelFolderSummary *, FILE *);
 static gint summary_meta_header_save(CamelFolderSummary *, FILE *);
-
+#endif
 
 
 static CamelMessageInfo * message_info_new_from_header(CamelFolderSummary *, struct _camel_header_raw *);
 static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
 static CamelMessageInfo * message_info_new_from_message(CamelFolderSummary *s, CamelMimeMessage *msg);
 static CamelMessageInfo * message_info_load(CamelFolderSummary *, FILE *);
-static int		  message_info_save(CamelFolderSummary *, FILE *, CamelMessageInfo *);
-static int		  meta_message_info_save(CamelFolderSummary *s, FILE *out_meta, FILE *out, CamelMessageInfo *info);
+static gint		  message_info_save(CamelFolderSummary *, FILE *, CamelMessageInfo *);
+static gint		  meta_message_info_save(CamelFolderSummary *s, FILE *out_meta, FILE *out, CamelMessageInfo *info);
 static void		  message_info_free(CamelFolderSummary *, CamelMessageInfo *);
 
 static CamelMessageContentInfo * content_info_new_from_header(CamelFolderSummary *, struct _camel_header_raw *);
 static CamelMessageContentInfo * content_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
 static CamelMessageContentInfo * content_info_new_from_message(CamelFolderSummary *s, CamelMimePart *mp);
 static CamelMessageContentInfo * content_info_load(CamelFolderSummary *, FILE *);
-static int			 content_info_save(CamelFolderSummary *, FILE *, CamelMessageContentInfo *);
+static gint			 content_info_save(CamelFolderSummary *, FILE *, CamelMessageContentInfo *);
 static void			 content_info_free(CamelFolderSummary *, CamelMessageContentInfo *);
 
 static gint save_message_infos_to_db (CamelFolderSummary *s, gboolean fresh_mir, CamelException *ex);
@@ -786,7 +787,7 @@ count_changed_uids (gchar *key, CamelMessageInfoBase *info, gint *count)
 		(*count)++;
 }
 
-static int
+static gint
 cfs_count_dirty (CamelFolderSummary *s)
 {
 	gint count = 0;
@@ -1060,6 +1061,7 @@ camel_folder_summary_ensure_infos_loaded (CamelFolderSummary *s, gint at_least,
 	}
 }
 
+#if 0
 static void
 camel_folder_summary_dump (CamelFolderSummary *s)
 {
@@ -1070,6 +1072,7 @@ camel_folder_summary_dump (CamelFolderSummary *s)
 		printf("%s\t", (gchar *)s->uids->pdata[i]);
 	printf("\n");
 }
+#endif
 
 GHashTable *
 camel_folder_summary_get_flag_cache (CamelFolderSummary *summary)
@@ -1171,7 +1174,7 @@ mir_from_cols (CamelMIRecord *mir, CamelFolderSummary *s, gint ncol, gchar ** co
 	}
 }
 
-static int
+static gint
 camel_read_mir_callback (gpointer  ref, gint ncol, gchar ** cols, gchar ** name)
 {
 	struct _db_pass_data *data = (struct _db_pass_data *) ref;
@@ -1409,7 +1412,7 @@ error:
 
 
 /* saves the content descriptions, recursively */
-static int
+static gint
 perform_content_info_save_to_db (CamelFolderSummary *s, CamelMessageContentInfo *ci, CamelMIRecord *record)
 {
 	CamelMessageContentInfo *part;
@@ -1433,7 +1436,8 @@ perform_content_info_save_to_db (CamelFolderSummary *s, CamelMessageContentInfo
 }
 
 /* saves the content descriptions, recursively */
-static int
+#if 0
+static gint
 perform_content_info_save(CamelFolderSummary *s, FILE *out, CamelMessageContentInfo *ci)
 {
 	CamelMessageContentInfo *part;
@@ -1453,6 +1457,7 @@ perform_content_info_save(CamelFolderSummary *s, FILE *out, CamelMessageContentI
 
 	return 0;
 }
+#endif
 
 typedef struct {
 	CamelException *ex;
@@ -1514,7 +1519,7 @@ save_to_db_cb (gpointer key, gpointer value, gpointer data)
 	camel_db_camel_mir_free (mir);
 }
 
-static int
+static gint
 save_message_infos_to_db (CamelFolderSummary *s, gboolean fresh_mirs, CamelException *ex)
 {
 	CamelDB *cdb = s->folder->parent_store->cdb_w;
@@ -1853,7 +1858,7 @@ camel_folder_summary_header_load(CamelFolderSummary *s)
 	return ret;
 }
 
-static int
+static gint
 summary_assign_uid(CamelFolderSummary *s, CamelMessageInfo *info)
 {
 	const gchar *uid;
@@ -2126,7 +2131,7 @@ camel_folder_summary_info_new_from_parser(CamelFolderSummary *s, CamelMimeParser
 {
 	CamelMessageInfo *info = NULL;
 	gchar *buffer;
-	size_t len;
+	gsize len;
 	struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
 	off_t start;
 	CamelIndexName *name = NULL;
@@ -2330,7 +2335,7 @@ camel_folder_summary_clear_db (CamelFolderSummary *s)
 
 /* This function returns 0 on success. So the caller should not bother,
 deleting the uid from db when the return value is non-zero */
-static int
+static gint
 summary_remove_uid (CamelFolderSummary *s, const gchar *uid)
 {
 	gint i;
@@ -2375,7 +2380,7 @@ camel_folder_summary_remove (CamelFolderSummary *s, CamelMessageInfo *info)
 	CAMEL_SUMMARY_UNLOCK(s, summary_lock);
 
 	if (!ret && camel_db_delete_uid (s->folder->parent_store->cdb_w, s->folder->full_name, camel_message_info_uid(info), NULL) != 0)
-		return ;
+		return;
 
 	camel_message_info_free(info);
 }
@@ -2413,7 +2418,7 @@ camel_folder_summary_remove_uid(CamelFolderSummary *s, const gchar *uid)
 
 				if (!ret && camel_db_delete_uid (s->folder->parent_store->cdb_w, s->folder->full_name, tmpid, NULL) != 0) {
 						g_free(tmpid);
-						return ;
+						return;
 				}
 				g_free (tmpid);
 		}
@@ -2564,7 +2569,7 @@ camel_folder_summary_remove_range (CamelFolderSummary *s, gint start, gint end)
 /* This is a tokenisation mechanism for strings written to the
    summary - to save space.
    This list can have at most 31 words. */
-static gchar * tokens[] = {
+static const gchar * tokens[] = {
 	"7bit",
 	"8bit",
 	"alternative",
@@ -2601,7 +2606,7 @@ static gchar * tokens[] = {
 */
 
 #ifdef USE_BSEARCH
-static int
+static gint
 token_search_cmp(gchar *key, gchar **index)
 {
 	d(printf("comparing '%s' to '%s'\n", key, *index));
@@ -2633,7 +2638,7 @@ camel_folder_summary_encode_token(FILE *out, const gchar *str)
 
 		if (len <= 16) {
 			gchar lower[32];
-			gchar **match;
+			const gchar **match;
 
 			for (i=0;i<len;i++)
 				lower[i] = tolower(str[i]);
@@ -2735,7 +2740,7 @@ my_list_append(struct _node **list, struct _node *n)
 	return n;
 }
 
-static int
+static gint
 my_list_size(struct _node **list)
 {
 	gint len = 0;
@@ -2747,7 +2752,8 @@ my_list_size(struct _node **list)
 	return len;
 }
 
-static int
+#if 0
+static gint
 summary_meta_header_load(CamelFolderSummary *s, FILE *in)
 {
 	if (!s->meta_summary->path)
@@ -2764,8 +2770,9 @@ summary_meta_header_load(CamelFolderSummary *s, FILE *in)
 
 	return 0;
 }
+#endif
 
-static	int
+static	gint
 summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *record)
 {
 	io(printf("Loading header from db \n"));
@@ -2801,7 +2808,7 @@ summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *record)
 	return 0;
 }
 
-static int
+static gint
 summary_header_load(CamelFolderSummary *s, FILE *in)
 {
 	if (!s->summary_path)
@@ -2811,7 +2818,7 @@ summary_header_load(CamelFolderSummary *s, FILE *in)
 
 	io(printf("Loading header\n"));
 
-	if (camel_file_util_decode_fixed_int32(in, &s->version) == -1)
+	if (camel_file_util_decode_fixed_int32(in, (gint32 *) &s->version) == -1)
 		return -1;
 
 	/* Legacy version check, before version 12 we have no upgrade knowledge */
@@ -2821,24 +2828,25 @@ summary_header_load(CamelFolderSummary *s, FILE *in)
 		return -1;
 	}
 
-	if (!(s->version < 0x100 && s->version >= 13))
+	if (!(s->version < 0x100 && s->version >= 13)) {
 		io(printf("Loading legacy summary\n"));
-	else
+	} else {
 		io(printf("loading new-format summary\n"));
+	}
 
 	/* legacy version */
-	if (camel_file_util_decode_fixed_int32(in, &s->flags) == -1
-	    || camel_file_util_decode_fixed_int32(in, &s->nextuid) == -1
+	if (camel_file_util_decode_fixed_int32(in, (gint32 *) &s->flags) == -1
+	    || camel_file_util_decode_fixed_int32(in, (gint32 *) &s->nextuid) == -1
 	    || camel_file_util_decode_time_t(in, &s->time) == -1
-	    || camel_file_util_decode_fixed_int32(in, &s->saved_count) == -1) {
+	    || camel_file_util_decode_fixed_int32(in, (gint32 *) &s->saved_count) == -1) {
 		return -1;
 	}
 
 	/* version 13 */
 	if (s->version < 0x100 && s->version >= 13
-	    && (camel_file_util_decode_fixed_int32(in, &s->unread_count) == -1
-		|| camel_file_util_decode_fixed_int32(in, &s->deleted_count) == -1
-		|| camel_file_util_decode_fixed_int32(in, &s->junk_count) == -1)) {
+	    && (camel_file_util_decode_fixed_int32(in, (gint32 *) &s->unread_count) == -1
+		|| camel_file_util_decode_fixed_int32(in, (gint32 *) &s->deleted_count) == -1
+		|| camel_file_util_decode_fixed_int32(in, (gint32 *) &s->junk_count) == -1)) {
 		return -1;
 	}
 
@@ -2889,7 +2897,7 @@ summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
 	return record;
 }
 
-static int
+static gint
 summary_header_save(CamelFolderSummary *s, FILE *out)
 {
 	gint unread = 0, deleted = 0, junk = 0, count, i;
@@ -2930,7 +2938,8 @@ summary_header_save(CamelFolderSummary *s, FILE *out)
 	return camel_file_util_encode_fixed_int32(out, junk);
 }
 
-static int
+#if 0
+static gint
 summary_meta_header_save(CamelFolderSummary *s, FILE *out_meta)
 {
 	fseek(out_meta, 0, SEEK_SET);
@@ -2948,6 +2957,7 @@ summary_meta_header_save(CamelFolderSummary *s, FILE *out_meta)
 
 	return ferror(out_meta);
 }
+#endif
 
 /* are these even useful for anything??? */
 static CamelMessageInfo *
@@ -3303,8 +3313,8 @@ message_info_load(CamelFolderSummary *s, FILE *in)
 
 	mi->content = NULL;
 
-	camel_file_util_decode_fixed_int32(in, &mi->message_id.id.part.hi);
-	camel_file_util_decode_fixed_int32(in, &mi->message_id.id.part.lo);
+	camel_file_util_decode_fixed_int32(in, (gint32 *) &mi->message_id.id.part.hi);
+	camel_file_util_decode_fixed_int32(in, (gint32 *) &mi->message_id.id.part.lo);
 
 	if (camel_file_util_decode_uint32(in, &count) == -1)
 		goto error;
@@ -3313,8 +3323,8 @@ message_info_load(CamelFolderSummary *s, FILE *in)
 		mi->references = g_malloc(sizeof(*mi->references) + ((count-1) * sizeof(mi->references->references[0])));
 		mi->references->size = count;
 		for (i=0;i<count;i++) {
-			camel_file_util_decode_fixed_int32(in, &mi->references->references[i].id.part.hi);
-			camel_file_util_decode_fixed_int32(in, &mi->references->references[i].id.part.lo);
+			camel_file_util_decode_fixed_int32(in, (gint32 *) &mi->references->references[i].id.part.hi);
+			camel_file_util_decode_fixed_int32(in, (gint32 *) &mi->references->references[i].id.part.lo);
 		}
 	}
 
@@ -3351,7 +3361,7 @@ error:
 	return NULL;
 }
 
-static int
+static gint
 meta_message_info_save(CamelFolderSummary *s, FILE *out_meta, FILE *out, CamelMessageInfo *info)
 {
 	time_t timestamp;
@@ -3409,11 +3419,11 @@ message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
 
 	tmp = g_string_new (NULL);
 	if (mi->references) {
-		g_string_append_printf (tmp, "%lu %lu %lu", (long unsigned)mi->message_id.id.part.hi, (long unsigned)mi->message_id.id.part.lo, (long unsigned)mi->references->size);
+		g_string_append_printf (tmp, "%lu %lu %lu", (gulong)mi->message_id.id.part.hi, (gulong)mi->message_id.id.part.lo, (gulong)mi->references->size);
 		for (i=0;i<mi->references->size;i++)
-			g_string_append_printf (tmp, " %lu %lu", (long unsigned)mi->references->references[i].id.part.hi, (long unsigned)mi->references->references[i].id.part.lo);
+			g_string_append_printf (tmp, " %lu %lu", (gulong)mi->references->references[i].id.part.hi, (gulong)mi->references->references[i].id.part.lo);
 	} else {
-		g_string_append_printf (tmp, "%lu %lu %lu", (long unsigned)mi->message_id.id.part.hi, (long unsigned)mi->message_id.id.part.lo, (unsigned long) 0);
+		g_string_append_printf (tmp, "%lu %lu %lu", (gulong)mi->message_id.id.part.hi, (gulong)mi->message_id.id.part.lo, (gulong) 0);
 	}
 	record->part = tmp->str;
 	g_string_free (tmp, FALSE);
@@ -3434,11 +3444,11 @@ message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
 
 	tmp = g_string_new (NULL);
 	count = camel_tag_list_size(&mi->user_tags);
-	g_string_append_printf (tmp, "%lu", (long unsigned)count);
+	g_string_append_printf (tmp, "%lu", (gulong)count);
 	tag = mi->user_tags;
 	while (tag) {
 		/* FIXME: Should we handle empty tags? Can it be empty? If it potential crasher ahead*/
-		g_string_append_printf (tmp, " %lu-%s %lu-%s", (long unsigned)strlen(tag->name), tag->name, (long unsigned)strlen(tag->value), tag->value);
+		g_string_append_printf (tmp, " %lu-%s %lu-%s", (gulong)strlen(tag->name), tag->name, (gulong)strlen(tag->value), tag->value);
 		tag = tag->next;
 	}
 	record->usertags = tmp->str;
@@ -3449,7 +3459,7 @@ message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
 }
 
 
-static int
+static gint
 message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *info)
 {
 	guint32 count;
@@ -3662,7 +3672,7 @@ content_info_load(CamelFolderSummary *s, FILE *in)
 	return NULL;
 }
 
-static int
+static gint
 content_info_to_db(CamelFolderSummary *s, CamelMessageContentInfo *ci, CamelMIRecord *record)
 {
 	CamelContentType *ct;
@@ -3675,22 +3685,22 @@ content_info_to_db(CamelFolderSummary *s, CamelMessageContentInfo *ci, CamelMIRe
 	ct = ci->type;
 	if (ct) {
 		if (ct->type)
-			g_string_append_printf (str, " %d-%s", (int) strlen (ct->type), ct->type);
+			g_string_append_printf (str, " %d-%s", (gint) strlen (ct->type), ct->type);
 		else
 			g_string_append_printf (str, " 0-");
 		if (ct->subtype)
-			g_string_append_printf (str, " %d-%s", (int) strlen (ct->subtype), ct->subtype);
+			g_string_append_printf (str, " %d-%s", (gint) strlen (ct->subtype), ct->subtype);
 		else
 			g_string_append_printf (str, " 0-");
 		g_string_append_printf (str, " %d", my_list_size((struct _node **)&ct->params));
 		hp = ct->params;
 		while (hp) {
 			if (hp->name)
-				g_string_append_printf (str, " %d-%s", (int)strlen(hp->name), hp->name);
+				g_string_append_printf (str, " %d-%s", (gint)strlen(hp->name), hp->name);
 			else
 				g_string_append_printf (str, " 0-");
 			if (hp->value)
-				g_string_append_printf (str, " %d-%s", (int)strlen (hp->value), hp->value);
+				g_string_append_printf (str, " %d-%s", (gint)strlen (hp->value), hp->value);
 			else
 				g_string_append_printf (str, " 0-");
 			hp = hp->next;
@@ -3702,15 +3712,15 @@ content_info_to_db(CamelFolderSummary *s, CamelMessageContentInfo *ci, CamelMIRe
 	}
 
 	if (ci->id)
-		g_string_append_printf (str, " %d-%s", (int)strlen (ci->id), ci->id);
+		g_string_append_printf (str, " %d-%s", (gint)strlen (ci->id), ci->id);
 	else
 		g_string_append_printf (str, " 0-");
 	if (ci->description)
-		g_string_append_printf (str, " %d-%s", (int)strlen (ci->description), ci->description);
+		g_string_append_printf (str, " %d-%s", (gint)strlen (ci->description), ci->description);
 	else
 		g_string_append_printf (str, " 0-");
 	if (ci->encoding)
-		g_string_append_printf (str, " %d-%s", (int)strlen (ci->encoding), ci->encoding);
+		g_string_append_printf (str, " %d-%s", (gint)strlen (ci->encoding), ci->encoding);
 	else
 		g_string_append_printf (str, " 0-");
 	g_string_append_printf (str, " %u", ci->size);
@@ -3727,7 +3737,7 @@ content_info_to_db(CamelFolderSummary *s, CamelMessageContentInfo *ci, CamelMIRe
 	return 0;
 }
 
-static int
+static gint
 content_info_save(CamelFolderSummary *s, FILE *out, CamelMessageContentInfo *ci)
 {
 	CamelContentType *ct;
@@ -3793,7 +3803,7 @@ static CamelMessageContentInfo *
 summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, CamelMimeParser *mp)
 {
 	gint state;
-	size_t len;
+	gsize len;
 	gchar *buffer;
 	CamelMessageContentInfo *info = NULL;
 	CamelContentType *ct;
@@ -4368,7 +4378,7 @@ camel_tag_list_free(CamelTag **list)
 }
 
 static struct flag_names_t {
-	gchar *name;
+	const gchar *name;
 	guint32 value;
 } flag_names[] = {
 	{ "answered", CAMEL_MESSAGE_ANSWERED },
@@ -4990,7 +5000,7 @@ camel_content_info_dump (CamelMessageContentInfo *ci, gint depth)
 		printf ("%scontent-type: <unset>\n", p);
 	printf ("%scontent-transfer-encoding: %s\n", p, ci->encoding ? ci->encoding : "(null)");
 	printf ("%scontent-description: %s\n", p, ci->description ? ci->description : "(null)");
-	printf ("%ssize: %lu\n", p, (unsigned long) ci->size);
+	printf ("%ssize: %lu\n", p, (gulong) ci->size);
 	ci = ci->childs;
 	while (ci) {
 		camel_content_info_dump (ci, depth + 1);
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index f36cf2f..7fbffc8 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -277,8 +277,8 @@ struct _CamelFolderSummaryClass {
 	CamelMessageInfo * (*message_info_new_from_parser)(CamelFolderSummary *, CamelMimeParser *);
 	CamelMessageInfo * (*message_info_new_from_message)(CamelFolderSummary *, CamelMimeMessage *);
 	CamelMessageInfo * (*message_info_load)(CamelFolderSummary *, FILE *);
-	int		   (*message_info_save)(CamelFolderSummary *, FILE *, CamelMessageInfo *);
-	int		   (*meta_message_info_save)(CamelFolderSummary *, FILE *, FILE *, CamelMessageInfo *);
+	gint		   (*message_info_save)(CamelFolderSummary *, FILE *, CamelMessageInfo *);
+	gint		   (*meta_message_info_save)(CamelFolderSummary *, FILE *, FILE *, CamelMessageInfo *);
 
 	void		   (*message_info_free)(CamelFolderSummary *, CamelMessageInfo *);
 	CamelMessageInfo * (*message_info_clone)(CamelFolderSummary *, const CamelMessageInfo *);
@@ -288,7 +288,7 @@ struct _CamelFolderSummaryClass {
 	CamelMessageContentInfo * (*content_info_new_from_parser)(CamelFolderSummary *, CamelMimeParser *);
 	CamelMessageContentInfo * (*content_info_new_from_message)(CamelFolderSummary *, CamelMimePart *);
 	CamelMessageContentInfo * (*content_info_load)(CamelFolderSummary *, FILE *);
-	int			  (*content_info_save)(CamelFolderSummary *, FILE *, CamelMessageContentInfo *);
+	gint			  (*content_info_save)(CamelFolderSummary *, FILE *, CamelMessageContentInfo *);
 	void			  (*content_info_free)(CamelFolderSummary *, CamelMessageContentInfo *);
 	CamelMessageInfo * (*message_info_from_uid) (CamelFolderSummary *, const gchar *);
 	/* get the next uid */
@@ -417,17 +417,17 @@ gint camel_folder_summary_decode_token(FILE *in, gchar **str);
 gboolean	camel_flag_get(CamelFlag **list, const gchar *name);
 gboolean	camel_flag_set(CamelFlag **list, const gchar *name, gboolean value);
 gboolean	camel_flag_list_copy(CamelFlag **to, CamelFlag **from);
-int		camel_flag_list_size(CamelFlag **list);
+gint		camel_flag_list_size(CamelFlag **list);
 void		camel_flag_list_free(CamelFlag **list);
 
 guint32         camel_system_flag (const gchar *name);
 gboolean        camel_system_flag_get (guint32 flags, const gchar *name);
 
 /* message tag operations */
-const char	*camel_tag_get(CamelTag **list, const gchar *name);
+const gchar	*camel_tag_get(CamelTag **list, const gchar *name);
 gboolean	camel_tag_set(CamelTag **list, const gchar *name, const gchar *value);
 gboolean	camel_tag_list_copy(CamelTag **to, CamelTag **from);
-int		camel_tag_list_size(CamelTag **list);
+gint		camel_tag_list_size(CamelTag **list);
 void		camel_tag_list_free(CamelTag **list);
 
 /* Summary may be null */
diff --git a/camel/camel-folder-thread.c b/camel/camel-folder-thread.c
index 6f6fd15..2f0bb06 100644
--- a/camel/camel-folder-thread.c
+++ b/camel/camel-folder-thread.c
@@ -318,7 +318,7 @@ struct _tree_info {
 	GHashTable *visited;
 };
 
-static int
+static gint
 dump_tree_rec(struct _tree_info *info, CamelFolderThreadNode *c, gint depth)
 {
 	gchar *p;
@@ -360,7 +360,7 @@ camel_folder_threaded_messages_dump(CamelFolderThreadNode *c)
 	return count;
 }
 
-static int
+static gint
 sort_node(gconstpointer a, gconstpointer b)
 {
 	const CamelFolderThreadNode *a1 = ((CamelFolderThreadNode **)a)[0];
@@ -440,7 +440,7 @@ thread_summary(CamelFolderThread *thread, GPtrArray *summary)
 	CamelFolderThreadNode *c, *child, *head;
 #ifdef TIMEIT
 	struct timeval start, end;
-	unsigned long diff;
+	gulong diff;
 
 	gettimeofday(&start, NULL);
 #endif
@@ -623,8 +623,8 @@ camel_folder_thread_messages_new (CamelFolder *folder, GPtrArray *uids, gboolean
 	if (fsummary->len - camel_folder_summary_cache_size (folder->summary) > 50)
 		camel_folder_summary_reload_from_db (folder->summary, NULL);
 
-	for (i = 0 ; i < fsummary->len ; i++) {
-		CamelMessageInfo *info ;
+	for (i = 0; i < fsummary->len; i++) {
+		CamelMessageInfo *info;
 		gchar *uid = fsummary->pdata[i];
 
 		if (wanted == NULL || g_hash_table_lookup(wanted, uid) != NULL) {
@@ -747,7 +747,7 @@ camel_folder_thread_messages_new_summary(GPtrArray *summary)
 
 #ifdef TIMEIT
 	struct timeval start, end;
-	unsigned long diff;
+	gulong diff;
 
 	gettimeofday(&start, NULL);
 #endif
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index f106339..84d0537 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -49,8 +49,6 @@
 #define d(x)
 #define w(x)
 
-extern gint camel_verbose_debug;
-
 static CamelObjectClass *parent_class = NULL;
 
 /* Returns the class for a CamelFolder */
@@ -351,7 +349,7 @@ camel_folder_refresh_info (CamelFolder *folder, CamelException *ex)
 	CF_CLASS (folder)->refresh_info (folder, ex);
 }
 
-static int
+static gint
 folder_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	CamelFolder *folder = (CamelFolder *)object;
@@ -620,7 +618,7 @@ camel_folder_expunge (CamelFolder *folder, CamelException *ex)
 	CAMEL_FOLDER_REC_UNLOCK(folder, lock);
 }
 
-static int
+static gint
 get_message_count (CamelFolder *folder)
 {
 	g_return_val_if_fail(folder->summary != NULL, -1);
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index dba2384..b564188 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -495,18 +495,18 @@ gpg_ctx_get_argv (struct _GpgCtx *gpg, gint status_fd, gchar **sfd, gint passwd_
 	gint i;
 
 	argv = g_ptr_array_new ();
-	g_ptr_array_add (argv, "gpg");
+	g_ptr_array_add (argv, (guint8 *) "gpg");
 
-	g_ptr_array_add (argv, "--verbose");
-	g_ptr_array_add (argv, "--no-secmem-warning");
-	g_ptr_array_add (argv, "--no-greeting");
-	g_ptr_array_add (argv, "--no-tty");
+	g_ptr_array_add (argv, (guint8 *) "--verbose");
+	g_ptr_array_add (argv, (guint8 *) "--no-secmem-warning");
+	g_ptr_array_add (argv, (guint8 *) "--no-greeting");
+	g_ptr_array_add (argv, (guint8 *) "--no-tty");
 
 	if (passwd_fd == -1) {
 		/* only use batch mode if we don't intend on using the
                    interactive --command-fd option */
-		g_ptr_array_add (argv, "--batch");
-		g_ptr_array_add (argv, "--yes");
+		g_ptr_array_add (argv, (guint8 *) "--batch");
+		g_ptr_array_add (argv, (guint8 *) "--yes");
 	}
 
 	*sfd = buf = g_strdup_printf ("--status-fd=%d", status_fd);
@@ -519,64 +519,64 @@ gpg_ctx_get_argv (struct _GpgCtx *gpg, gint status_fd, gchar **sfd, gint passwd_
 
 	switch (gpg->mode) {
 	case GPG_CTX_MODE_SIGN:
-		g_ptr_array_add (argv, "--sign");
-		g_ptr_array_add (argv, "--detach");
+		g_ptr_array_add (argv, (guint8 *) "--sign");
+		g_ptr_array_add (argv, (guint8 *) "--detach");
 		if (gpg->armor)
-			g_ptr_array_add (argv, "--armor");
+			g_ptr_array_add (argv, (guint8 *) "--armor");
 		hash_str = gpg_hash_str (gpg->hash);
 		if (hash_str)
-			g_ptr_array_add (argv, (gchar *) hash_str);
+			g_ptr_array_add (argv, (guint8 *) hash_str);
 		if (gpg->userid) {
-			g_ptr_array_add (argv, "-u");
-			g_ptr_array_add (argv, (gchar *) gpg->userid);
+			g_ptr_array_add (argv, (guint8 *) "-u");
+			g_ptr_array_add (argv, (guint8 *) gpg->userid);
 		}
-		g_ptr_array_add (argv, "--output");
-		g_ptr_array_add (argv, "-");
+		g_ptr_array_add (argv, (guint8 *) "--output");
+		g_ptr_array_add (argv, (guint8 *) "-");
 		break;
 	case GPG_CTX_MODE_VERIFY:
 		if (!camel_session_is_online (gpg->session)) {
 			/* this is a deprecated flag to gpg since 1.0.7 */
 			/*g_ptr_array_add (argv, "--no-auto-key-retrieve");*/
-			g_ptr_array_add (argv, "--keyserver-options");
-			g_ptr_array_add (argv, "no-auto-key-retrieve");
+			g_ptr_array_add (argv, (guint8 *) "--keyserver-options");
+			g_ptr_array_add (argv, (guint8 *) "no-auto-key-retrieve");
 		}
-		g_ptr_array_add (argv, "--verify");
+		g_ptr_array_add (argv, (guint8 *) "--verify");
 		if (gpg->sigfile)
 			g_ptr_array_add (argv, gpg->sigfile);
-		g_ptr_array_add (argv, "-");
+		g_ptr_array_add (argv, (guint8 *) "-");
 		break;
 	case GPG_CTX_MODE_ENCRYPT:
-		g_ptr_array_add (argv,  "--encrypt");
+		g_ptr_array_add (argv, (guint8 *) "--encrypt");
 		if (gpg->armor)
-			g_ptr_array_add (argv, "--armor");
+			g_ptr_array_add (argv, (guint8 *) "--armor");
 		if (gpg->always_trust)
-			g_ptr_array_add (argv, "--always-trust");
+			g_ptr_array_add (argv, (guint8 *) "--always-trust");
 		if (gpg->userid) {
-			g_ptr_array_add (argv, "-u");
-			g_ptr_array_add (argv, (gchar *) gpg->userid);
+			g_ptr_array_add (argv, (guint8 *) "-u");
+			g_ptr_array_add (argv, (guint8 *) gpg->userid);
 		}
 		if (gpg->recipients) {
 			for (i = 0; i < gpg->recipients->len; i++) {
-				g_ptr_array_add (argv, "-r");
+				g_ptr_array_add (argv, (guint8 *) "-r");
 				g_ptr_array_add (argv, gpg->recipients->pdata[i]);
 			}
 		}
-		g_ptr_array_add (argv, "--output");
-		g_ptr_array_add (argv, "-");
+		g_ptr_array_add (argv, (guint8 *) "--output");
+		g_ptr_array_add (argv, (guint8 *) "-");
 		break;
 	case GPG_CTX_MODE_DECRYPT:
-		g_ptr_array_add (argv, "--decrypt");
-		g_ptr_array_add (argv, "--output");
-		g_ptr_array_add (argv, "-");
+		g_ptr_array_add (argv, (guint8 *) "--decrypt");
+		g_ptr_array_add (argv, (guint8 *) "--output");
+		g_ptr_array_add (argv, (guint8 *) "-");
 		break;
 	case GPG_CTX_MODE_IMPORT:
-		g_ptr_array_add (argv, "--import");
-		g_ptr_array_add (argv, "-");
+		g_ptr_array_add (argv, (guint8 *) "--import");
+		g_ptr_array_add (argv, (guint8 *) "-");
 		break;
 	case GPG_CTX_MODE_EXPORT:
 		if (gpg->armor)
-			g_ptr_array_add (argv, "--armor");
-		g_ptr_array_add (argv, "--export");
+			g_ptr_array_add (argv, (guint8 *) "--armor");
+		g_ptr_array_add (argv, (guint8 *) "--export");
 		for (i = 0; i < gpg->recipients->len; i++)
 			g_ptr_array_add (argv, gpg->recipients->pdata[i]);
 		break;
@@ -589,7 +589,7 @@ gpg_ctx_get_argv (struct _GpgCtx *gpg, gint status_fd, gchar **sfd, gint passwd_
 
 #endif
 
-static int
+static gint
 gpg_ctx_op_start (struct _GpgCtx *gpg)
 {
 #ifndef G_OS_WIN32
@@ -722,12 +722,12 @@ next_token (const gchar *in, gchar **token)
 	return inptr;
 }
 
-static int
+static gint
 gpg_ctx_parse_status (struct _GpgCtx *gpg, CamelException *ex)
 {
 	register guchar *inptr;
 	const guchar *status;
-	size_t nread, nwritten;
+	gsize nread, nwritten;
 	gint len;
 
  parse:
@@ -1020,7 +1020,7 @@ gpg_ctx_op_cancel (struct _GpgCtx *gpg)
 
 #endif
 
-static int
+static gint
 gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex)
 {
 #ifndef G_OS_WIN32
@@ -1081,7 +1081,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex)
 	if (polls[2].revents & (G_IO_IN|G_IO_HUP)) {
 		/* read the status message and decide what to do... */
 		gchar buffer[4096];
-		ssize_t nread;
+		gssize nread;
 
 		d(printf ("reading from gpg's status-fd...\n"));
 
@@ -1103,7 +1103,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex)
 
 	if ((polls[0].revents & (G_IO_IN|G_IO_HUP)) && gpg->ostream) {
 		gchar buffer[4096];
-		ssize_t nread;
+		gssize nread;
 
 		d(printf ("reading gpg's stdout...\n"));
 
@@ -1114,7 +1114,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex)
 			goto exception;
 
 		if (nread > 0) {
-			if (camel_stream_write (gpg->ostream, buffer, (size_t) nread) == -1)
+			if (camel_stream_write (gpg->ostream, buffer, (gsize) nread) == -1)
 				goto exception;
 		} else {
 			gpg->seen_eof1 = TRUE;
@@ -1123,7 +1123,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex)
 
 	if (polls[1].revents & (G_IO_IN|G_IO_HUP)) {
 		gchar buffer[4096];
-		ssize_t nread;
+		gssize nread;
 
 		d(printf ("reading gpg's stderr...\n"));
 
@@ -1141,8 +1141,8 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex)
 	}
 
 	if ((polls[4].revents & (G_IO_OUT|G_IO_HUP)) && gpg->need_passwd && gpg->send_passwd) {
-		ssize_t w, nwritten = 0;
-		size_t n;
+		gssize w, nwritten = 0;
+		gsize n;
 
 		d(printf ("sending gpg our passphrase...\n"));
 
@@ -1170,14 +1170,14 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex)
 
 	if ((polls[3].revents & (G_IO_OUT|G_IO_HUP)) && gpg->istream) {
 		gchar buffer[4096];
-		ssize_t nread;
+		gssize nread;
 
 		d(printf ("writing to gpg's stdin...\n"));
 
 		/* write our stream to gpg's stdin */
 		nread = camel_stream_read (gpg->istream, buffer, sizeof (buffer));
 		if (nread > 0) {
-			ssize_t w, nwritten = 0;
+			gssize w, nwritten = 0;
 
 			do {
 				do {
@@ -1238,7 +1238,7 @@ gpg_ctx_op_exited (struct _GpgCtx *gpg)
 }
 #endif
 
-static int
+static gint
 gpg_ctx_op_wait (struct _GpgCtx *gpg)
 {
 #ifndef G_OS_WIN32
@@ -1283,7 +1283,7 @@ gpg_ctx_op_wait (struct _GpgCtx *gpg)
 
 
 
-static int
+static gint
 gpg_sign (CamelCipherContext *context, const gchar *userid, CamelCipherHash hash, CamelMimePart *ipart, CamelMimePart *opart, CamelException *ex)
 {
 	struct _GpgCtx *gpg = NULL;
@@ -1612,7 +1612,7 @@ gpg_verify (CamelCipherContext *context, CamelMimePart *ipart, CamelException *e
 	return NULL;
 }
 
-static int
+static gint
 gpg_encrypt (CamelCipherContext *context, const gchar *userid, GPtrArray *recipients, struct _CamelMimePart *ipart, struct _CamelMimePart *opart, CamelException *ex)
 {
 	CamelGpgContext *ctx = (CamelGpgContext *) context;
@@ -1843,7 +1843,7 @@ gpg_decrypt(CamelCipherContext *context, CamelMimePart *ipart, CamelMimePart *op
 	return valid;
 }
 
-static int
+static gint
 gpg_import_keys (CamelCipherContext *context, CamelStream *istream, CamelException *ex)
 {
 	struct _GpgCtx *gpg;
@@ -1882,7 +1882,7 @@ fail:
 	return res;
 }
 
-static int
+static gint
 gpg_export_keys (CamelCipherContext *context, GPtrArray *keys, CamelStream *ostream, CamelException *ex)
 {
 	struct _GpgCtx *gpg;
diff --git a/camel/camel-http-stream.c b/camel/camel-http-stream.c
index ff11441..32d60a1 100644
--- a/camel/camel-http-stream.c
+++ b/camel/camel-http-stream.c
@@ -47,8 +47,8 @@
 
 static CamelStreamClass *parent_class = NULL;
 
-static ssize_t stream_read (CamelStream *stream, gchar *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const gchar *buffer, size_t n);
+static gssize stream_read (CamelStream *stream, gchar *buffer, gsize n);
+static gssize stream_write (CamelStream *stream, const gchar *buffer, gsize n);
 static gint stream_flush  (CamelStream *stream);
 static gint stream_close  (CamelStream *stream);
 static gint stream_reset  (CamelStream *stream);
@@ -246,16 +246,16 @@ http_next_token (const guchar *in)
 {
 	const guchar *inptr = in;
 
-	while (*inptr && !isspace ((int) *inptr))
+	while (*inptr && !isspace ((gint) *inptr))
 		inptr++;
 
-	while (*inptr && isspace ((int) *inptr))
+	while (*inptr && isspace ((gint) *inptr))
 		inptr++;
 
 	return (const gchar *) inptr;
 }
 
-static int
+static gint
 http_get_statuscode (CamelHttpStream *http)
 {
 	const gchar *token;
@@ -278,13 +278,13 @@ http_get_statuscode (CamelHttpStream *http)
 	return -1;
 }
 
-static int
+static gint
 http_get_headers (CamelHttpStream *http)
 {
 	struct _camel_header_raw *headers, *node, *tail;
 	const gchar *type;
 	gchar *buf;
-	size_t len;
+	gsize len;
 	gint err;
 
 	if (http->parser)
@@ -347,7 +347,7 @@ http_get_headers (CamelHttpStream *http)
 	return -1;
 }
 
-static int
+static gint
 http_method_invoke (CamelHttpStream *http)
 {
 	const gchar *method = NULL;
@@ -381,16 +381,18 @@ http_method_invoke (CamelHttpStream *http)
 	}
 	g_free (url);
 
-	if (http->authrealm)
+	if (http->authrealm) {
 		d(printf("HTTP Stream Sending: WWW-Authenticate: %s\n", http->authrealm));
+	}
 
 	if (http->authrealm && camel_stream_printf (http->raw, "WWW-Authenticate: %s\r\n", http->authrealm) == -1) {
 		http_disconnect(http);
 		return -1;
 	}
 
-	if (http->authpass && http->proxy)
+	if (http->authpass && http->proxy) {
 		d(printf("HTTP Stream Sending: Proxy-Aurhorization: Basic %s\n", http->authpass));
+	}
 
 	if (http->authpass && http->proxy && camel_stream_printf (http->raw, "Proxy-Authorization: Basic %s\r\n",
 								  http->authpass) == -1) {
@@ -407,12 +409,12 @@ http_method_invoke (CamelHttpStream *http)
 	return 0;
 }
 
-static ssize_t
-stream_read (CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelHttpStream *http = CAMEL_HTTP_STREAM (stream);
 	const gchar *parser_buf;
-	ssize_t nread;
+	gssize nread;
 
 	if (http->method != CAMEL_HTTP_METHOD_GET && http->method != CAMEL_HTTP_METHOD_HEAD) {
 		errno = EIO;
@@ -500,13 +502,13 @@ stream_read (CamelStream *stream, gchar *buffer, size_t n)
 	return nread;
 }
 
-static ssize_t
-stream_write (CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	return -1;
 }
 
-static int
+static gint
 stream_flush (CamelStream *stream)
 {
 	CamelHttpStream *http = (CamelHttpStream *) stream;
@@ -517,7 +519,7 @@ stream_flush (CamelStream *stream)
 		return 0;
 }
 
-static int
+static gint
 stream_close (CamelStream *stream)
 {
 	CamelHttpStream *http = (CamelHttpStream *) stream;
@@ -532,7 +534,7 @@ stream_close (CamelStream *stream)
 	return 0;
 }
 
-static int
+static gint
 stream_reset (CamelStream *stream)
 {
 	CamelHttpStream *http = CAMEL_HTTP_STREAM (stream);
diff --git a/camel/camel-iconv.c b/camel/camel-iconv.c
index 4cbf02f..1c9d529 100644
--- a/camel/camel-iconv.c
+++ b/camel/camel-iconv.c
@@ -97,8 +97,8 @@ static gchar *locale_charset = NULL;
 static gchar *locale_lang = NULL;
 
 struct {
-	gchar *charset;
-	gchar *iconv_name;
+	const gchar *charset;
+	const gchar *iconv_name;
 } known_iconv_charsets[] = {
 #if 0
 	/* charset name, iconv-friendly charset name */
@@ -508,7 +508,7 @@ camel_iconv_open (const gchar *oto, const gchar *ofrom)
 			/* work around some broken iconv implementations
 			 * that die if the length arguments are NULL
 			 */
-			size_t buggy_iconv_len = 0;
+			gsize buggy_iconv_len = 0;
 			gchar *buggy_iconv_buf = NULL;
 
 			/* resets the converter */
@@ -592,8 +592,8 @@ camel_iconv_locale_language (void)
  * camel_iconv_charset_name() so that we don't have to keep track of all
  * the aliases too. */
 static struct {
-	gchar *charset;
-	gchar *lang;
+	const gchar *charset;
+	const gchar *lang;
 } cjkr_lang_map[] = {
 	{ "Big5",        "zh" },
 	{ "BIG5HKSCS",   "zh" },
diff --git a/camel/camel-index-control.c b/camel/camel-index-control.c
index e09711b..2594486 100644
--- a/camel/camel-index-control.c
+++ b/camel/camel-index-control.c
@@ -20,7 +20,9 @@
 #include "camel-object.h"
 #include "camel-text-index.h"
 
-static void
+extern gint camel_init(const gchar *certdb_dir, gboolean nss_init);
+
+G_GNUC_NORETURN static void
 do_usage(gchar *argv0)
 {
 	fprintf(stderr, "Usage: %s [ compress | dump | info ] file(s) ...\n", argv0);
@@ -30,7 +32,7 @@ do_usage(gchar *argv0)
 	exit(1);
 }
 
-static int
+static gint
 do_compress(gint argc, gchar **argv)
 {
 	gint i;
@@ -54,7 +56,7 @@ do_compress(gint argc, gchar **argv)
 	return 0;
 }
 
-static int
+static gint
 do_dump(gint argc, gchar **argv)
 {
 	gint i;
@@ -75,7 +77,7 @@ do_dump(gint argc, gchar **argv)
 	return 0;
 }
 
-static int
+static gint
 do_info(gint argc, gchar **argv)
 {
 	gint i;
@@ -95,7 +97,7 @@ do_info(gint argc, gchar **argv)
 	return 1;
 }
 
-static int
+static gint
 do_check(gint argc, gchar **argv)
 {
 	gint i;
@@ -119,8 +121,6 @@ static gint do_perf(gint argc, gchar **argv);
 
 gint main(gint argc, gchar **argv)
 {
-	extern gint camel_init(const gchar *certdb_dir, gboolean nss_init);
-
 	if (argc<2)
 		do_usage(argv[0]);
 
@@ -149,12 +149,12 @@ gint main(gint argc, gchar **argv)
 #include "camel-mime-filter-index.h"
 #include "camel-stream-fs.h"
 
-static int
+static gint
 do_perf(gint argc, gchar **argv)
 {
 	CamelIndex *idx;
 	DIR *dir;
-	gchar *path = "/home/notzed/evolution/local/Inbox/mbox/cur";
+	const gchar *path = "/home/notzed/evolution/local/Inbox/mbox/cur";
 	struct dirent *d;
 	CamelStream *null, *filter, *stream;
 	CamelMimeFilterIndex *filter_index;
diff --git a/camel/camel-index.c b/camel/camel-index.c
index afcf497..7671059 100644
--- a/camel/camel-index.c
+++ b/camel/camel-index.c
@@ -346,8 +346,8 @@ camel_index_name_add_word(CamelIndexName *idn, const gchar *word)
 		g_free(b);
 }
 
-size_t
-camel_index_name_add_buffer(CamelIndexName *idn, const gchar *buffer, size_t len)
+gsize
+camel_index_name_add_buffer(CamelIndexName *idn, const gchar *buffer, gsize len)
 {
 	return CIN_CLASS(idn)->add_buffer(idn, buffer, len);
 }
diff --git a/camel/camel-index.h b/camel/camel-index.h
index 7707ecb..7b074f4 100644
--- a/camel/camel-index.h
+++ b/camel/camel-index.h
@@ -93,7 +93,7 @@ struct _CamelIndexNameClass {
 
 	gint (*sync)(CamelIndexName *name);
 	void (*add_word)(CamelIndexName *name, const gchar *word);
-	size_t (*add_buffer)(CamelIndexName *name, const gchar *buffer, size_t len);
+	gsize (*add_buffer)(CamelIndexName *name, const gchar *buffer, gsize len);
 };
 
 CamelType		   camel_index_name_get_type	(void);
@@ -101,7 +101,7 @@ CamelType		   camel_index_name_get_type	(void);
 CamelIndexName    *camel_index_name_new(CamelIndex *idx, const gchar *name);
 
 void               camel_index_name_add_word(CamelIndexName *name, const gchar *word);
-size_t             camel_index_name_add_buffer(CamelIndexName *name, const gchar *buffer, size_t len);
+gsize             camel_index_name_add_buffer(CamelIndexName *name, const gchar *buffer, gsize len);
 
 /* ********************************************************************** */
 
@@ -122,15 +122,15 @@ struct _CamelIndex {
 struct _CamelIndexClass {
 	CamelObjectClass parent_class;
 
-	int			(*sync)(CamelIndex *idx);
-	int			(*compress)(CamelIndex *idx);
-	int			(*delete)(CamelIndex *idx);
+	gint			(*sync)(CamelIndex *idx);
+	gint			(*compress)(CamelIndex *idx);
+	gint			(*delete)(CamelIndex *idx);
 
-	int			(*rename)(CamelIndex *idx, const gchar *path);
+	gint			(*rename)(CamelIndex *idx, const gchar *path);
 
-	int			(*has_name)(CamelIndex *idx, const gchar *name);
+	gint			(*has_name)(CamelIndex *idx, const gchar *name);
 	CamelIndexName *	(*add_name)(CamelIndex *idx, const gchar *name);
-	int			(*write_name)(CamelIndex *idx, CamelIndexName *idn);
+	gint			(*write_name)(CamelIndex *idx, CamelIndexName *idn);
 	CamelIndexCursor *	(*find_name)(CamelIndex *idx, const gchar *name);
 	void			(*delete_name)(CamelIndex *idx, const gchar *name);
 	CamelIndexCursor *	(*find)(CamelIndex *idx, const gchar *word);
@@ -146,13 +146,13 @@ CamelType		   camel_index_get_type	(void);
 
 CamelIndex        *camel_index_new(const gchar *path, gint flags);
 void               camel_index_construct(CamelIndex *, const gchar *path, gint flags);
-int		   camel_index_rename(CamelIndex *, const gchar *path);
+gint		   camel_index_rename(CamelIndex *, const gchar *path);
 
 void               camel_index_set_normalise(CamelIndex *idx, CamelIndexNorm func, gpointer data);
 
 gint                camel_index_sync(CamelIndex *idx);
 gint                camel_index_compress(CamelIndex *idx);
-int		   camel_index_delete(CamelIndex *idx);
+gint		   camel_index_delete(CamelIndex *idx);
 
 gint                camel_index_has_name(CamelIndex *idx, const gchar *name);
 CamelIndexName    *camel_index_add_name(CamelIndex *idx, const gchar *name);
diff --git a/camel/camel-internet-address.c b/camel/camel-internet-address.c
index 10329ce..2fba26f 100644
--- a/camel/camel-internet-address.c
+++ b/camel/camel-internet-address.c
@@ -81,7 +81,7 @@ camel_internet_address_get_type(void)
 	return type;
 }
 
-static int
+static gint
 internet_decode	(CamelAddress *a, const gchar *raw)
 {
 	struct _camel_header_address *ha, *n;
@@ -142,7 +142,7 @@ internet_encode	(CamelAddress *a)
 	return ret;
 }
 
-static int
+static gint
 internet_unformat(CamelAddress *a, const gchar *raw)
 {
 	gchar *buffer, *p, *name, *addr;
@@ -162,7 +162,7 @@ internet_unformat(CamelAddress *a, const gchar *raw)
 	name = NULL;
 	addr = p;
 	do {
-		c = (unsigned char)*p++;
+		c = (guchar)*p++;
 		switch (c) {
 			/* removes quotes, they should only be around the total name anyway */
 		case '"':
@@ -238,7 +238,7 @@ internet_format	(CamelAddress *a)
 	return ret;
 }
 
-static int
+static gint
 internet_cat (CamelAddress *dest, const CamelAddress *source)
 {
 	gint i;
diff --git a/camel/camel-internet-address.h b/camel/camel-internet-address.h
index 3e4bb19..c214c9a 100644
--- a/camel/camel-internet-address.h
+++ b/camel/camel-internet-address.h
@@ -45,11 +45,11 @@ struct _CamelInternetAddressClass {
 CamelType		camel_internet_address_get_type	(void);
 CamelInternetAddress   *camel_internet_address_new	(void);
 
-int			camel_internet_address_add	(CamelInternetAddress *addr, const gchar *name, const gchar *address);
+gint			camel_internet_address_add	(CamelInternetAddress *addr, const gchar *name, const gchar *address);
 gboolean		camel_internet_address_get	(const CamelInternetAddress *addr, gint index, const gchar **namep, const gchar **addressp);
 
-int			camel_internet_address_find_name(CamelInternetAddress *addr, const gchar *name, const gchar **addressp);
-int			camel_internet_address_find_address(CamelInternetAddress *addr, const gchar *address, const gchar **namep);
+gint			camel_internet_address_find_name(CamelInternetAddress *addr, const gchar *name, const gchar **addressp);
+gint			camel_internet_address_find_address(CamelInternetAddress *addr, const gchar *address, const gchar **namep);
 
 /* utility functions, for network/display formatting */
 gchar *			camel_internet_address_encode_address(gint *len, const gchar *name, const gchar *addr);
diff --git a/camel/camel-mime-filter-basic.c b/camel/camel-mime-filter-basic.c
index e6a93f2..4815f37 100644
--- a/camel/camel-mime-filter-basic.c
+++ b/camel/camel-mime-filter-basic.c
@@ -25,12 +25,12 @@
 #include "camel-mime-utils.h"
 
 static void reset(CamelMimeFilter *mf);
-static void complete(CamelMimeFilter *mf, gchar *in, size_t len,
-		     size_t prespace, gchar **out,
-		     size_t *outlen, size_t *outprespace);
-static void filter(CamelMimeFilter *mf, gchar *in, size_t len,
-		   size_t prespace, gchar **out,
-		   size_t *outlen, size_t *outprespace);
+static void complete(CamelMimeFilter *mf, const gchar *in, gsize len,
+		     gsize prespace, gchar **out,
+		     gsize *outlen, gsize *outprespace);
+static void filter(CamelMimeFilter *mf, const gchar *in, gsize len,
+		   gsize prespace, gchar **out,
+		   gsize *outlen, gsize *outprespace);
 
 static void camel_mime_filter_basic_class_init (CamelMimeFilterBasicClass *klass);
 static void camel_mime_filter_basic_init       (CamelMimeFilterBasic *obj);
@@ -92,10 +92,10 @@ reset(CamelMimeFilter *mf)
 }
 
 static void
-complete(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+complete(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterBasic *f = (CamelMimeFilterBasic *)mf;
-	size_t newlen = 0;
+	gsize newlen = 0;
 
 	switch(f->type) {
 	case CAMEL_MIME_FILTER_BASIC_BASE64_ENC:
@@ -150,17 +150,17 @@ complete(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **ou
 
 	return;
 donothing:
-	*out = in;
+	*out = (gchar *) in;
 	*outlen = len;
 	*outprespace = prespace;
 }
 
 /* here we do all of the basic mime filtering */
 static void
-filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+filter(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterBasic *f = (CamelMimeFilterBasic *)mf;
-	size_t newlen;
+	gsize newlen;
 
 	switch(f->type) {
 	case CAMEL_MIME_FILTER_BASIC_BASE64_ENC:
@@ -195,8 +195,8 @@ filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out,
 		break;
 	case CAMEL_MIME_FILTER_BASIC_UU_DEC:
 		if (!(f->state & CAMEL_UUDECODE_STATE_BEGIN)) {
-			register gchar *inptr, *inend;
-			size_t left;
+			const gchar *inptr, *inend;
+			gsize left;
 
 			inptr = in;
 			inend = inptr + len;
@@ -222,7 +222,7 @@ filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out,
 				}
 
 				/* go to the next line */
-				for ( ; inptr < inend && *inptr != '\n'; inptr++);
+				for (; inptr < inend && *inptr != '\n'; inptr++);
 
 				if (inptr < inend)
 					inptr++;
@@ -248,7 +248,7 @@ filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out,
 
 	return;
 donothing:
-	*out = in;
+	*out = (gchar *) in;
 	*outlen = len;
 	*outprespace = prespace;
 }
diff --git a/camel/camel-mime-filter-bestenc.c b/camel/camel-mime-filter-bestenc.c
index 498359d..b183a57 100644
--- a/camel/camel-mime-filter-bestenc.c
+++ b/camel/camel-mime-filter-bestenc.c
@@ -70,7 +70,7 @@ reset(CamelMimeFilter *mf)
 }
 
 static void
-filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+filter(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterBestenc *f = (CamelMimeFilterBestenc *)mf;
 	register guchar *p, *pend;
@@ -158,13 +158,13 @@ filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out,
 		camel_charset_step(&f->charset, in, len);
 
 donothing:
-	*out = in;
+	*out = (gchar *) in;
 	*outlen = len;
 	*outprespace = prespace;
 }
 
 static void
-complete(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+complete(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterBestenc *f = (CamelMimeFilterBestenc *)mf;
 
diff --git a/camel/camel-mime-filter-canon.c b/camel/camel-mime-filter-canon.c
index 7c0f866..2fd5c0f 100644
--- a/camel/camel-mime-filter-canon.c
+++ b/camel/camel-mime-filter-canon.c
@@ -31,11 +31,11 @@
 
 #include "camel-mime-filter-canon.h"
 
-static void filter (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
-		    gchar **out, size_t *outlen, size_t *outprespace);
-static void complete (CamelMimeFilter *f, gchar *in, size_t len,
-		      size_t prespace, gchar **out, size_t *outlen,
-		      size_t *outprespace);
+static void filter (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace,
+		    gchar **out, gsize *outlen, gsize *outprespace);
+static void complete (CamelMimeFilter *f, const gchar *in, gsize len,
+		      gsize prespace, gchar **out, gsize *outlen,
+		      gsize *outprespace);
 static void reset (CamelMimeFilter *f);
 
 
@@ -68,7 +68,7 @@ camel_mime_filter_canon_get_type (void)
 }
 
 static void
-filter_run(CamelMimeFilter *f, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace, gint last)
+filter_run(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace, gint last)
 {
 	register guchar *inptr, c;
 	const guchar *inend, *start;
@@ -162,13 +162,13 @@ filter_run(CamelMimeFilter *f, gchar *in, size_t len, size_t prespace, gchar **o
 }
 
 static void
-filter(CamelMimeFilter *f, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+filter(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
 	filter_run(f, in, len, prespace, out, outlen, outprespace, FALSE);
 }
 
 static void
-complete(CamelMimeFilter *f, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+complete(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
 	filter_run(f, in, len, prespace, out, outlen, outprespace, TRUE);
 }
diff --git a/camel/camel-mime-filter-charset.c b/camel/camel-mime-filter-charset.c
index f7742e9..9ba14b6 100644
--- a/camel/camel-mime-filter-charset.c
+++ b/camel/camel-mime-filter-charset.c
@@ -77,7 +77,7 @@ reset(CamelMimeFilter *mf)
 	CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)mf;
 	gchar buf[16];
 	gchar *buffer;
-	size_t outlen = 16;
+	gsize outlen = 16;
 
 	/* what happens with the output bytes if this resets the state? */
 	if (f->ic != (iconv_t) -1) {
@@ -87,10 +87,10 @@ reset(CamelMimeFilter *mf)
 }
 
 static void
-complete(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+complete(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterCharset *charset = (CamelMimeFilterCharset *)mf;
-	size_t inleft, outleft, converted = 0;
+	gsize inleft, outleft, converted = 0;
 	const gchar *inbuf;
 	gchar *outbuf;
 
@@ -107,7 +107,7 @@ complete(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **ou
 	if (inleft > 0) {
 		do {
 			converted = camel_iconv (charset->ic, &inbuf, &inleft, &outbuf, &outleft);
-			if (converted == (size_t) -1) {
+			if (converted == (gsize) -1) {
 				if (errno == E2BIG) {
 					/*
 					 * E2BIG   There is not sufficient room at *outbuf.
@@ -142,7 +142,7 @@ complete(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **ou
 				} else
 					goto noop;
 			}
-		} while (((int) inleft) > 0);
+		} while (((gint) inleft) > 0);
 	}
 
 	/* flush the iconv conversion */
@@ -156,16 +156,16 @@ complete(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **ou
 
  noop:
 
-	*out = in;
+	*out = (gchar *) in;
 	*outlen = len;
 	*outprespace = prespace;
 }
 
 static void
-filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+filter(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterCharset *charset = (CamelMimeFilterCharset *)mf;
-	size_t inleft, outleft, converted = 0;
+	gsize inleft, outleft, converted = 0;
 	const gchar *inbuf;
 	gchar *outbuf;
 
@@ -181,7 +181,7 @@ filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out,
 
 	do {
 		converted = camel_iconv (charset->ic, &inbuf, &inleft, &outbuf, &outleft);
-		if (converted == (size_t) -1) {
+		if (converted == (gsize) -1) {
 			if (errno == E2BIG || errno == EINVAL)
 				break;
 
@@ -200,9 +200,9 @@ filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out,
 				goto noop;
 			}
 		}
-	} while (((int) inleft) > 0);
+	} while (((gint) inleft) > 0);
 
-	if (((int) inleft) > 0) {
+	if (((gint) inleft) > 0) {
 		/* We've either got an E2BIG or EINVAL. Save the
                    remainder of the buffer as we'll process this next
                    time through */
@@ -217,7 +217,7 @@ filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out,
 
  noop:
 
-	*out = in;
+	*out = (gchar *) in;
 	*outlen = len;
 	*outprespace = prespace;
 }
diff --git a/camel/camel-mime-filter-crlf.c b/camel/camel-mime-filter-crlf.c
index 7b08fdd..c256370 100644
--- a/camel/camel-mime-filter-crlf.c
+++ b/camel/camel-mime-filter-crlf.c
@@ -22,11 +22,11 @@
 
 #include "camel-mime-filter-crlf.h"
 
-static void filter (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
-		    gchar **out, size_t *outlen, size_t *outprespace);
-static void complete (CamelMimeFilter *f, gchar *in, size_t len,
-		      size_t prespace, gchar **out, size_t *outlen,
-		      size_t *outprespace);
+static void filter (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace,
+		    gchar **out, gsize *outlen, gsize *outprespace);
+static void complete (CamelMimeFilter *f, const gchar *in, gsize len,
+		      gsize prespace, gchar **out, gsize *outlen,
+		      gsize *outprespace);
 static void reset (CamelMimeFilter *f);
 
 
@@ -60,8 +60,8 @@ camel_mime_filter_crlf_get_type (void)
 }
 
 static void
-filter (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
-	gchar **out, size_t *outlen, size_t *outprespace)
+filter (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace,
+	gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterCRLF *crlf = (CamelMimeFilterCRLF *)f;
 	register const gchar *inptr;
@@ -144,8 +144,8 @@ filter (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
 }
 
 static void
-complete (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
-	  gchar **out, size_t *outlen, size_t *outprespace)
+complete (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace,
+	  gchar **out, gsize *outlen, gsize *outprespace)
 {
 	if (len)
 		filter (f, in, len, prespace, out, outlen, outprespace);
diff --git a/camel/camel-mime-filter-enriched.c b/camel/camel-mime-filter-enriched.c
index f543b66..94cda93 100644
--- a/camel/camel-mime-filter-enriched.c
+++ b/camel/camel-mime-filter-enriched.c
@@ -40,8 +40,8 @@ static gchar *param_parse_font (const gchar *inptr, gint inlen);
 static gchar *param_parse_lang (const gchar *inptr, gint inlen);
 
 static struct {
-	gchar *enriched;
-	gchar *html;
+	const gchar *enriched;
+	const gchar *html;
 	gboolean needs_param;
 	EnrichedParamParser parse_param; /* parses *and* validates the input */
 } enriched_tags[] = {
@@ -98,10 +98,10 @@ static void camel_mime_filter_enriched_class_init (CamelMimeFilterEnrichedClass
 static void camel_mime_filter_enriched_init       (CamelMimeFilterEnriched *filter);
 static void camel_mime_filter_enriched_finalize   (CamelObject *obj);
 
-static void filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-			   gchar **out, size_t *outlen, size_t *outprespace);
-static void filter_complete (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-			     gchar **out, size_t *outlen, size_t *outprespace);
+static void filter_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+			   gchar **out, gsize *outlen, gsize *outprespace);
+static void filter_complete (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+			     gchar **out, gsize *outlen, gsize *outprespace);
 static void filter_reset (CamelMimeFilter *filter);
 
 
@@ -142,8 +142,10 @@ camel_mime_filter_enriched_class_init (CamelMimeFilterEnrichedClass *klass)
 	if (!enriched_hash) {
 		enriched_hash = g_hash_table_new (camel_strcase_hash, camel_strcase_equal);
 		for (i = 0; i < NUM_ENRICHED_TAGS; i++)
-			g_hash_table_insert (enriched_hash, enriched_tags[i].enriched,
-					     enriched_tags[i].html);
+			g_hash_table_insert (
+				enriched_hash,
+				(gpointer) enriched_tags[i].enriched,
+				(gpointer) enriched_tags[i].html);
 	}
 }
 
@@ -276,8 +278,8 @@ param_parse (const gchar *enriched, const gchar *inptr, gint inlen)
 #define IS_RICHTEXT CAMEL_MIME_FILTER_ENRICHED_IS_RICHTEXT
 
 static void
-enriched_to_html (CamelMimeFilter *filter, gchar *in, size_t inlen, size_t prespace,
-		  gchar **out, size_t *outlen, size_t *outprespace, gboolean flush)
+enriched_to_html (CamelMimeFilter *filter, const gchar *in, gsize inlen, gsize prespace,
+		  gchar **out, gsize *outlen, gsize *outprespace, gboolean flush)
 {
 	CamelMimeFilterEnriched *enriched = (CamelMimeFilterEnriched *) filter;
 	const gchar *tag, *inend, *outend;
@@ -522,7 +524,7 @@ enriched_to_html (CamelMimeFilter *filter, gchar *in, size_t inlen, size_t presp
  backup:
 
 	if (flush) {
-		size_t offset, grow;
+		gsize offset, grow;
 
 		grow = (inend - inptr) * 2 + 20;
 		offset = outptr - filter->outbuf;
@@ -541,15 +543,15 @@ enriched_to_html (CamelMimeFilter *filter, gchar *in, size_t inlen, size_t presp
 }
 
 static void
-filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-	       gchar **out, size_t *outlen, size_t *outprespace)
+filter_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+	       gchar **out, gsize *outlen, gsize *outprespace)
 {
 	enriched_to_html (filter, in, len, prespace, out, outlen, outprespace, FALSE);
 }
 
 static void
-filter_complete (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-		 gchar **out, size_t *outlen, size_t *outprespace)
+filter_complete (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+		 gchar **out, gsize *outlen, gsize *outprespace)
 {
 	enriched_to_html (filter, in, len, prespace, out, outlen, outprespace, TRUE);
 }
@@ -599,7 +601,7 @@ gchar *
 camel_enriched_to_html(const gchar *in, guint32 flags)
 {
 	CamelMimeFilter *filter;
-	size_t outlen, outpre;
+	gsize outlen, outpre;
 	gchar *outbuf;
 
 	if (in == NULL)
diff --git a/camel/camel-mime-filter-from.c b/camel/camel-mime-filter-from.c
index 8cdc929..76422e5 100644
--- a/camel/camel-mime-filter-from.c
+++ b/camel/camel-mime-filter-from.c
@@ -55,23 +55,23 @@ camel_mime_filter_from_get_type (void)
 
 struct fromnode {
 	struct fromnode *next;
-	gchar *pointer;
+	const gchar *pointer;
 };
 
 static void
-complete(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+complete(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
-	*out = in;
+	*out = (gchar *) in;
 	*outlen = len;
 	*outprespace = prespace;
 }
 
 /* Yes, it is complicated ... */
 static void
-filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+filter(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterFrom *f = (CamelMimeFilterFrom *)mf;
-	register gchar *inptr, *inend;
+	const gchar *inptr, *inend;
 	gint left;
 	gint midline = f->midline;
 	gint fromcount = 0;
@@ -144,7 +144,7 @@ filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out,
 
 		d(printf("Filtered '%.*s'\n", *outlen, *out));
 	} else {
-		*out = in;
+		*out = (gchar *) in;
 		*outlen = inend - in;
 		*outprespace = prespace;
 
diff --git a/camel/camel-mime-filter-gzip.c b/camel/camel-mime-filter-gzip.c
index b1ee68e..5dadbfb 100644
--- a/camel/camel-mime-filter-gzip.c
+++ b/camel/camel-mime-filter-gzip.c
@@ -93,10 +93,10 @@ static void camel_mime_filter_gzip_class_init (CamelMimeFilterGZipClass *klass);
 static void camel_mime_filter_gzip_init (CamelMimeFilterGZip *filter, CamelMimeFilterGZipClass *klass);
 static void camel_mime_filter_gzip_finalize (CamelObject *object);
 
-static void filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-			   gchar **out, size_t *outlen, size_t *outprespace);
-static void filter_complete (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-			     gchar **out, size_t *outlen, size_t *outprespace);
+static void filter_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+			   gchar **out, gsize *outlen, gsize *outprespace);
+static void filter_complete (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+			     gchar **out, gsize *outlen, gsize *outprespace);
 static void filter_reset (CamelMimeFilter *filter);
 
 
@@ -160,8 +160,8 @@ camel_mime_filter_gzip_finalize (CamelObject *object)
 
 
 static void
-gzip_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-	     gchar **out, size_t *outlen, size_t *outprespace, gint flush)
+gzip_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+	     gchar **out, gsize *outlen, gsize *outprespace, gint flush)
 {
 	CamelMimeFilterGZip *gzip = (CamelMimeFilterGZip *) filter;
 	struct _CamelMimeFilterGZipPrivate *priv = gzip->priv;
@@ -205,7 +205,7 @@ gzip_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
 			fprintf (stderr, "gzip: %d: %s\n", retval, priv->stream->msg);
 
 		if (flush == Z_FULL_FLUSH) {
-			size_t n;
+			gsize n;
 
 			n = filter->outsize - priv->stream->avail_out;
 			camel_mime_filter_set_size (filter, n + (priv->stream->avail_in * 2) + 12, TRUE);
@@ -244,8 +244,8 @@ gzip_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
 }
 
 static void
-gunzip_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-	       gchar **out, size_t *outlen, size_t *outprespace, gint flush)
+gunzip_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+	       gchar **out, gsize *outlen, gsize *outprespace, gint flush)
 {
 	CamelMimeFilterGZip *gzip = (CamelMimeFilterGZip *) filter;
 	struct _CamelMimeFilterGZipPrivate *priv = gzip->priv;
@@ -358,7 +358,7 @@ gunzip_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
 			fprintf (stderr, "gunzip: %d: %s\n", retval, priv->stream->msg);
 
 		if (flush == Z_FULL_FLUSH) {
-			size_t n;
+			gsize n;
 
 			if (priv->stream->avail_in == 0) {
 				/* FIXME: extract & compare calculated crc32 and isize values? */
@@ -391,8 +391,8 @@ gunzip_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
 }
 
 static void
-filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-	       gchar **out, size_t *outlen, size_t *outprespace)
+filter_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+	       gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterGZip *gzip = (CamelMimeFilterGZip *) filter;
 
@@ -403,8 +403,8 @@ filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
 }
 
 static void
-filter_complete (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-		 gchar **out, size_t *outlen, size_t *outprespace)
+filter_complete (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+		 gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterGZip *gzip = (CamelMimeFilterGZip *) filter;
 
diff --git a/camel/camel-mime-filter-html.c b/camel/camel-mime-filter-html.c
index 774a403..8e5e5fb 100644
--- a/camel/camel-mime-filter-html.c
+++ b/camel/camel-mime-filter-html.c
@@ -110,13 +110,13 @@ camel_mime_filter_html_init       (CamelObject *o)
 }
 
 static void
-run(CamelMimeFilter *mf, gchar *in, size_t inlen, size_t prespace, gchar **out, size_t *outlenptr, size_t *outprespace, gint last)
+run(CamelMimeFilter *mf, const gchar *in, gsize inlen, gsize prespace, gchar **out, gsize *outlenptr, gsize *outprespace, gint last)
 {
 	CamelMimeFilterHTML *f = (CamelMimeFilterHTML *) mf;
 	camel_html_parser_t state;
 	gchar *outp;
 
-	d(printf("converting html:\n%.*s\n", (int)inlen, in));
+	d(printf("converting html:\n%.*s\n", (gint)inlen, in));
 
 	/* We should generally shrink the data, but this'll do */
 	camel_mime_filter_set_size (mf, inlen * 2 + 256, FALSE);
@@ -148,17 +148,17 @@ run(CamelMimeFilter *mf, gchar *in, size_t inlen, size_t prespace, gchar **out,
 	*outlenptr = outp - mf->outbuf;
 	*outprespace = mf->outbuf - mf->outreal;
 
-	d(printf("converted html end:\n%.*s\n", (int)*outlenptr, *out));
+	d(printf("converted html end:\n%.*s\n", (gint)*outlenptr, *out));
 }
 
 static void
-complete(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlenptr, size_t *outprespace)
+complete(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlenptr, gsize *outprespace)
 {
 	run(mf, in, len, prespace, out, outlenptr, outprespace, TRUE);
 }
 
 static void
-filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlenptr, size_t *outprespace)
+filter(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlenptr, gsize *outprespace)
 {
 	run(mf, in, len, prespace, out, outlenptr, outprespace, FALSE);
 }
diff --git a/camel/camel-mime-filter-index.c b/camel/camel-mime-filter-index.c
index 63df3ce..4e2e940 100644
--- a/camel/camel-mime-filter-index.c
+++ b/camel/camel-mime-filter-index.c
@@ -55,7 +55,7 @@ camel_mime_filter_index_finalize(CamelObject *o)
 }
 
 static void
-complete(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlenptr, size_t *outprespace)
+complete(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlenptr, gsize *outprespace)
 {
 	CamelMimeFilterIndex *f = (CamelMimeFilterIndex *)mf;
 
@@ -67,13 +67,13 @@ complete(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **ou
 	camel_index_name_add_buffer(f->name, NULL, 0);
 
 donothing:
-	*out = in;
+	*out = (gchar *) in;
 	*outlenptr = len;
 	*outprespace = prespace;
 }
 
 static void
-filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlenptr, size_t *outprespace)
+filter(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlenptr, gsize *outprespace)
 {
 	CamelMimeFilterIndex *f = (CamelMimeFilterIndex *)mf;
 
@@ -84,7 +84,7 @@ filter(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out,
 	camel_index_name_add_buffer(f->name, in, len);
 
 donothing:
-	*out = in;
+	*out = (gchar *) in;
 	*outlenptr = len;
 	*outprespace = prespace;
 }
@@ -170,7 +170,7 @@ camel_mime_filter_index_set_index (CamelMimeFilterIndex *filter, CamelIndex *ind
 {
 	if (filter->index) {
 		gchar *out;
-		size_t outlen, outspace;
+		gsize outlen, outspace;
 
 		camel_mime_filter_complete((CamelMimeFilter *)filter, "", 0, 0, &out, &outlen, &outspace);
 		camel_object_unref (index);
diff --git a/camel/camel-mime-filter-linewrap.c b/camel/camel-mime-filter-linewrap.c
index 60ffcbe..425ec06 100644
--- a/camel/camel-mime-filter-linewrap.c
+++ b/camel/camel-mime-filter-linewrap.c
@@ -29,11 +29,11 @@
 #include "camel-mime-filter-linewrap.h"
 
 
-static void filter (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
-		    gchar **out, size_t *outlen, size_t *outprespace);
-static void complete (CamelMimeFilter *f, gchar *in, size_t len,
-		      size_t prespace, gchar **out, size_t *outlen,
-		      size_t *outprespace);
+static void filter (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace,
+		    gchar **out, gsize *outlen, gsize *outprespace);
+static void complete (CamelMimeFilter *f, const gchar *in, gsize len,
+		      gsize prespace, gchar **out, gsize *outlen,
+		      gsize *outprespace);
 static void reset (CamelMimeFilter *f);
 
 
@@ -67,11 +67,12 @@ camel_mime_filter_linewrap_get_type (void)
 }
 
 static void
-filter (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
-	gchar **out, size_t *outlen, size_t *outprespace)
+filter (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace,
+	gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterLinewrap *linewrap = (CamelMimeFilterLinewrap *)f;
-	gchar *inend, *p, *q;
+	gchar *q;
+	const gchar *inend, *p;
 	gint nchars = linewrap->nchars;
 
 	/* we'll be adding chars here so we need a bigger buffer */
@@ -114,8 +115,8 @@ filter (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
 }
 
 static void
-complete (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
-	  gchar **out, size_t *outlen, size_t *outprespace)
+complete (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace,
+	  gchar **out, gsize *outlen, gsize *outprespace)
 {
 	if (len)
 		filter (f, in, len, prespace, out, outlen, outprespace);
diff --git a/camel/camel-mime-filter-pgp.c b/camel/camel-mime-filter-pgp.c
index 949a126..d49c10c 100644
--- a/camel/camel-mime-filter-pgp.c
+++ b/camel/camel-mime-filter-pgp.c
@@ -32,11 +32,11 @@
 
 #include "camel-mime-filter-pgp.h"
 
-static void filter (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
-		    gchar **out, size_t *outlen, size_t *outprespace);
-static void complete (CamelMimeFilter *f, gchar *in, size_t len,
-		      size_t prespace, gchar **out, size_t *outlen,
-		      size_t *outprespace);
+static void filter (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace,
+		    gchar **out, gsize *outlen, gsize *outprespace);
+static void complete (CamelMimeFilter *f, const gchar *in, gsize len,
+		      gsize prespace, gchar **out, gsize *outlen,
+		      gsize *outprespace);
 static void reset (CamelMimeFilter *f);
 
 enum {
@@ -84,14 +84,14 @@ camel_mime_filter_pgp_get_type (void)
 #define END_PGP_SIGNATURE_LEN        (sizeof (END_PGP_SIGNATURE) - 1)
 
 static void
-filter_run(CamelMimeFilter *f, gchar *in, size_t inlen, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace, gint last)
+filter_run(CamelMimeFilter *f, const gchar *in, gsize inlen, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace, gint last)
 {
 	CamelMimeFilterPgp *pgp = (CamelMimeFilterPgp *) f;
 	const gchar *start, *inend = in + inlen;
 	register const gchar *inptr = in;
 	register gchar *o;
 	gboolean blank;
-	size_t len;
+	gsize len;
 
 	/* only need as much space as the input, we're stripping chars */
 	camel_mime_filter_set_size (f, inlen, FALSE);
@@ -168,13 +168,13 @@ filter_run(CamelMimeFilter *f, gchar *in, size_t inlen, size_t prespace, gchar *
 }
 
 static void
-filter (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+filter (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
 	filter_run (f, in, len, prespace, out, outlen, outprespace, FALSE);
 }
 
 static void
-complete (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+complete (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
 	filter_run (f, in, len, prespace, out, outlen, outprespace, TRUE);
 }
diff --git a/camel/camel-mime-filter-progress.c b/camel/camel-mime-filter-progress.c
index 35794b4..dacebf5 100644
--- a/camel/camel-mime-filter-progress.c
+++ b/camel/camel-mime-filter-progress.c
@@ -73,11 +73,11 @@ camel_mime_filter_progress_init (CamelObject *o)
 }
 
 static void
-filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-	       gchar **out, size_t *outlen, size_t *outprespace)
+filter_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+	       gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterProgress *progress = (CamelMimeFilterProgress *) filter;
-	double percent;
+	gdouble percent;
 
 	progress->count += len;
 
@@ -86,16 +86,16 @@ filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
 	else
 		percent = 100.0;
 
-	camel_operation_progress (progress->operation, (int) percent);
+	camel_operation_progress (progress->operation, (gint) percent);
 
 	*outprespace = prespace;
 	*outlen = len;
-	*out = in;
+	*out = (gchar *) in;
 }
 
 static void
-filter_complete (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-		 gchar **out, size_t *outlen, size_t *outprespace)
+filter_complete (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+		 gchar **out, gsize *outlen, gsize *outprespace)
 {
 	filter_filter (filter, in, len, prespace, out, outlen, outprespace);
 }
@@ -132,7 +132,7 @@ camel_mime_filter_progress_class_init (CamelMimeFilterProgressClass *klass)
  * Returns: a new #CamelMimeFilter object
  **/
 CamelMimeFilter *
-camel_mime_filter_progress_new (CamelOperation *operation, size_t total)
+camel_mime_filter_progress_new (CamelOperation *operation, gsize total)
 {
 	CamelMimeFilter *filter;
 
diff --git a/camel/camel-mime-filter-progress.h b/camel/camel-mime-filter-progress.h
index 1cbd749..355e3e3 100644
--- a/camel/camel-mime-filter-progress.h
+++ b/camel/camel-mime-filter-progress.h
@@ -40,8 +40,8 @@ struct _CamelMimeFilterProgress {
 	CamelMimeFilter parent;
 
 	CamelOperation *operation;
-	size_t total;
-        size_t count;
+	gsize total;
+        gsize count;
 };
 
 struct _CamelMimeFilterProgressClass {
@@ -52,7 +52,7 @@ struct _CamelMimeFilterProgressClass {
 
 CamelType camel_mime_filter_progress_get_type (void);
 
-CamelMimeFilter *camel_mime_filter_progress_new (CamelOperation *operation, size_t total);
+CamelMimeFilter *camel_mime_filter_progress_new (CamelOperation *operation, gsize total);
 
 G_END_DECLS
 
diff --git a/camel/camel-mime-filter-save.c b/camel/camel-mime-filter-save.c
index 1550ebf..e8e51cd 100644
--- a/camel/camel-mime-filter-save.c
+++ b/camel/camel-mime-filter-save.c
@@ -28,11 +28,11 @@
 #include "camel-mime-filter-save.h"
 #include "camel-stream-mem.h"
 
-static void filter (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
-		    gchar **out, size_t *outlen, size_t *outprespace);
-static void complete (CamelMimeFilter *f, gchar *in, size_t len,
-		      size_t prespace, gchar **out, size_t *outlen,
-		      size_t *outprespace);
+static void filter (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace,
+		    gchar **out, gsize *outlen, gsize *outprespace);
+static void complete (CamelMimeFilter *f, const gchar *in, gsize len,
+		      gsize prespace, gchar **out, gsize *outlen,
+		      gsize *outprespace);
 static void reset (CamelMimeFilter *f);
 
 
@@ -66,22 +66,22 @@ camel_mime_filter_save_get_type (void)
 }
 
 static void
-filter (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
-	gchar **out, size_t *outlen, size_t *outprespace)
+filter (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace,
+	gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterSave *save = (CamelMimeFilterSave *) f;
 
 	if (save->stream)
 		camel_stream_write (save->stream, in, len);
 
-	*out = in;
+	*out = (gchar *) in;
 	*outlen = len;
 	*outprespace = f->outpre;
 }
 
 static void
-complete (CamelMimeFilter *f, gchar *in, size_t len, size_t prespace,
-	  gchar **out, size_t *outlen, size_t *outprespace)
+complete (CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace,
+	  gchar **out, gsize *outlen, gsize *outprespace)
 {
 	if (len)
 		filter (f, in, len, prespace, out, outlen, outprespace);
diff --git a/camel/camel-mime-filter-tohtml.c b/camel/camel-mime-filter-tohtml.c
index acbdda0..4dda1ab 100644
--- a/camel/camel-mime-filter-tohtml.c
+++ b/camel/camel-mime-filter-tohtml.c
@@ -118,9 +118,9 @@ camel_mime_filter_tohtml_init (CamelMimeFilterToHTML *filter)
 
 
 static gchar *
-check_size (CamelMimeFilter *filter, gchar *outptr, gchar **outend, size_t len)
+check_size (CamelMimeFilter *filter, gchar *outptr, gchar **outend, gsize len)
 {
-	size_t offset;
+	gsize offset;
 
 	if (*outend - outptr >= len)
 		return outptr;
@@ -137,7 +137,7 @@ check_size (CamelMimeFilter *filter, gchar *outptr, gchar **outend, size_t len)
 static gchar *
 append_string_verbatim (CamelMimeFilter *filter, const gchar *str, gchar *outptr, gchar **outend)
 {
-	size_t len = strlen (str);
+	gsize len = strlen (str);
 
 	outptr = check_size (filter, outptr, outend, len);
 	memcpy(outptr, str, len);
@@ -146,7 +146,7 @@ append_string_verbatim (CamelMimeFilter *filter, const gchar *str, gchar *outptr
 	return outptr;
 }
 
-static int
+static gint
 citation_depth (const gchar *in)
 {
 	register const gchar *inptr = in;
@@ -242,12 +242,13 @@ writeln (CamelMimeFilter *filter, const guchar *in, const guchar *inend, gchar *
 }
 
 static void
-html_convert (CamelMimeFilter *filter, gchar *in, size_t inlen, size_t prespace,
-	      gchar **out, size_t *outlen, size_t *outprespace, gboolean flush)
+html_convert (CamelMimeFilter *filter, const gchar *in, gsize inlen, gsize prespace,
+	      gchar **out, gsize *outlen, gsize *outprespace, gboolean flush)
 {
 	CamelMimeFilterToHTML *html = (CamelMimeFilterToHTML *) filter;
-	register gchar *inptr, *outptr;
-	gchar *start, *outend;
+	const gchar *inptr;
+	gchar *outptr, *outend;
+	const gchar *start;
 	const gchar *inend;
 	gint depth;
 
@@ -263,7 +264,7 @@ html_convert (CamelMimeFilter *filter, gchar *in, size_t inlen, size_t prespace,
 			*outlen = outptr - filter->outbuf;
 			*outprespace = filter->outpre;
 		} else {
-			*out = in;
+			*out = (gchar *) in;
 			*outlen = 0;
 			*outprespace = 0;
 		}
@@ -315,7 +316,7 @@ html_convert (CamelMimeFilter *filter, gchar *in, size_t inlen, size_t prespace,
 
 #define CONVERT_URLS (CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES)
 		if (html->flags & CONVERT_URLS) {
-			size_t matchlen, len;
+			gsize matchlen, len;
 			urlmatch_t match;
 
 			len = inptr - start;
@@ -403,15 +404,15 @@ html_convert (CamelMimeFilter *filter, gchar *in, size_t inlen, size_t prespace,
 }
 
 static void
-filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-	       gchar **out, size_t *outlen, size_t *outprespace)
+filter_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+	       gchar **out, gsize *outlen, gsize *outprespace)
 {
 	html_convert (filter, in, len, prespace, out, outlen, outprespace, FALSE);
 }
 
 static void
-filter_complete (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-		 gchar **out, size_t *outlen, size_t *outprespace)
+filter_complete (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+		 gchar **out, gsize *outlen, gsize *outprespace)
 {
 	html_convert (filter, in, len, prespace, out, outlen, outprespace, TRUE);
 }
@@ -483,7 +484,7 @@ gchar *
 camel_text_to_html (const gchar *in, guint32 flags, guint32 colour)
 {
 	CamelMimeFilter *filter;
-	size_t outlen, outpre;
+	gsize outlen, outpre;
 	gchar *outbuf;
 
 	g_return_val_if_fail (in != NULL, NULL);
diff --git a/camel/camel-mime-filter-windows.c b/camel/camel-mime-filter-windows.c
index 6647ebd..dbf5cba 100644
--- a/camel/camel-mime-filter-windows.c
+++ b/camel/camel-mime-filter-windows.c
@@ -78,8 +78,8 @@ camel_mime_filter_windows_init (CamelObject *o)
 }
 
 static void
-filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-	       gchar **out, size_t *outlen, size_t *outprespace)
+filter_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+	       gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterWindows *windows = (CamelMimeFilterWindows *) filter;
 	register guchar *inptr;
@@ -101,14 +101,14 @@ filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
 		}
 	}
 
-	*out = in;
+	*out = (gchar *) in;
 	*outlen = len;
 	*outprespace = prespace;
 }
 
 static void
-filter_complete (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-		 gchar **out, size_t *outlen, size_t *outprespace)
+filter_complete (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+		 gchar **out, gsize *outlen, gsize *outprespace)
 {
 	filter_filter (filter, in, len, prespace, out, outlen, outprespace);
 }
diff --git a/camel/camel-mime-filter-yenc.c b/camel/camel-mime-filter-yenc.c
index 88afefe..d81759c 100644
--- a/camel/camel-mime-filter-yenc.c
+++ b/camel/camel-mime-filter-yenc.c
@@ -32,10 +32,10 @@
 static void camel_mime_filter_yenc_class_init (CamelMimeFilterYencClass *klass);
 static void camel_mime_filter_yenc_init (CamelMimeFilterYenc *filter, CamelMimeFilterYencClass *klass);
 
-static void filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-			   gchar **out, size_t *outlen, size_t *outprespace);
-static void filter_complete (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-			     gchar **out, size_t *outlen, size_t *outprespace);
+static void filter_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+			   gchar **out, gsize *outlen, gsize *outprespace);
+static void filter_complete (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+			     gchar **out, gsize *outlen, gsize *outprespace);
 static void filter_reset (CamelMimeFilter *filter);
 
 
@@ -85,11 +85,11 @@ camel_mime_filter_yenc_init (CamelMimeFilterYenc *filter, CamelMimeFilterYencCla
 
 /* here we do all of the basic yEnc filtering */
 static void
-filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-	       gchar **out, size_t *outlen, size_t *outprespace)
+filter_filter (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+	       gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterYenc *yenc = (CamelMimeFilterYenc *) filter;
-	size_t newlen = 0;
+	gsize newlen = 0;
 
 	switch (yenc->direction) {
 	case CAMEL_MIME_FILTER_YENC_DIRECTION_ENCODE:
@@ -101,8 +101,8 @@ filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
 		break;
 	case CAMEL_MIME_FILTER_YENC_DIRECTION_DECODE:
 		if (!(yenc->state & CAMEL_MIME_YDECODE_STATE_DECODE)) {
-			register gchar *inptr, *inend;
-			size_t left;
+			const gchar *inptr, *inend;
+			gsize left;
 
 			inptr = in;
 			inend = inptr + len;
@@ -180,11 +180,11 @@ filter_filter (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
 }
 
 static void
-filter_complete (CamelMimeFilter *filter, gchar *in, size_t len, size_t prespace,
-		 gchar **out, size_t *outlen, size_t *outprespace)
+filter_complete (CamelMimeFilter *filter, const gchar *in, gsize len, gsize prespace,
+		 gchar **out, gsize *outlen, gsize *outprespace)
 {
 	CamelMimeFilterYenc *yenc = (CamelMimeFilterYenc *) filter;
-	size_t newlen = 0;
+	gsize newlen = 0;
 
 	switch (yenc->direction) {
 	case CAMEL_MIME_FILTER_YENC_DIRECTION_ENCODE:
@@ -386,7 +386,7 @@ static const gint yenc_crc_table[256] = {
 	0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
 };
 
-#define yenc_crc_add(crc, c) (yenc_crc_table[(((int) (crc)) ^ ((unsigned char) (c))) & 0xff] ^ ((((int) (crc)) >> 8) & 0x00ffffff))
+#define yenc_crc_add(crc, c) (yenc_crc_table[(((gint) (crc)) ^ ((guchar) (c))) & 0xff] ^ ((((gint) (crc)) >> 8) & 0x00ffffff))
 
 #define YENC_NEWLINE_ESCAPE (CAMEL_MIME_YDECODE_STATE_EOLN | CAMEL_MIME_YDECODE_STATE_ESCAPE)
 
@@ -412,8 +412,8 @@ static const gint yenc_crc_table[256] = {
  *
  * Returns: the number of bytes decoded
  **/
-size_t
-camel_ydecode_step (const guchar *in, size_t inlen, guchar *out,
+gsize
+camel_ydecode_step (const guchar *in, gsize inlen, guchar *out,
 		    gint *state, guint32 *pcrc, guint32 *crc)
 {
 	register const guchar *inptr;
@@ -492,8 +492,8 @@ camel_ydecode_step (const guchar *in, size_t inlen, guchar *out,
  *
  * Returns: the number of bytes encoded
  **/
-size_t
-camel_yencode_step (const guchar *in, size_t inlen, guchar *out,
+gsize
+camel_yencode_step (const guchar *in, gsize inlen, guchar *out,
 		    gint *state, guint32 *pcrc, guint32 *crc)
 {
 	register const guchar *inptr;
@@ -557,8 +557,8 @@ camel_yencode_step (const guchar *in, size_t inlen, guchar *out,
  *
  * Returns: the number of bytes encoded.
  **/
-size_t
-camel_yencode_close (const guchar *in, size_t inlen, guchar *out,
+gsize
+camel_yencode_close (const guchar *in, gsize inlen, guchar *out,
 		     gint *state, guint32 *pcrc, guint32 *crc)
 {
 	register guchar *outptr;
diff --git a/camel/camel-mime-filter-yenc.h b/camel/camel-mime-filter-yenc.h
index 6db62ba..c5b5e0b 100644
--- a/camel/camel-mime-filter-yenc.h
+++ b/camel/camel-mime-filter-yenc.h
@@ -92,11 +92,11 @@ guint32 camel_mime_filter_yenc_get_pcrc (CamelMimeFilterYenc *yenc);
 guint32 camel_mime_filter_yenc_get_crc (CamelMimeFilterYenc *yenc);
 
 
-size_t camel_ydecode_step  (const guchar *in, size_t inlen, guchar *out,
+gsize camel_ydecode_step  (const guchar *in, gsize inlen, guchar *out,
 			    gint *state, guint32 *pcrc, guint32 *crc);
-size_t camel_yencode_step  (const guchar *in, size_t inlen, guchar *out,
+gsize camel_yencode_step  (const guchar *in, gsize inlen, guchar *out,
 			    gint *state, guint32 *pcrc, guint32 *crc);
-size_t camel_yencode_close (const guchar *in, size_t inlen, guchar *out,
+gsize camel_yencode_close (const guchar *in, gsize inlen, guchar *out,
 			    gint *state, guint32 *pcrc, guint32 *crc);
 
 G_END_DECLS
diff --git a/camel/camel-mime-filter.c b/camel/camel-mime-filter.c
index c027100..d06f8ff 100644
--- a/camel/camel-mime-filter.c
+++ b/camel/camel-mime-filter.c
@@ -31,7 +31,7 @@
 
 struct _CamelMimeFilterPrivate {
 	gchar *inbuf;
-	size_t inlen;
+	gsize inlen;
 };
 
 #define PRE_HEAD (64)
@@ -41,9 +41,9 @@ struct _CamelMimeFilterPrivate {
 
 static CamelObjectClass *camel_mime_filter_parent;
 
-static void complete (CamelMimeFilter *mf, gchar *in, size_t len,
-		      size_t prespace, gchar **out, size_t *outlen,
-		      size_t *outprespace);
+static void complete (CamelMimeFilter *mf, const gchar *in, gsize len,
+		      gsize prespace, gchar **out, gsize *outlen,
+		      gsize *outprespace);
 
 static void
 camel_mime_filter_class_init (CamelMimeFilterClass *klass)
@@ -98,7 +98,7 @@ camel_mime_filter_get_type (void)
 }
 
 static void
-complete(CamelMimeFilter *mf, gchar *in, size_t len, size_t prespace, gchar **out, size_t *outlen, size_t *outprespace)
+complete(CamelMimeFilter *mf, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace)
 {
 	/* default - do nothing */
 }
@@ -141,11 +141,11 @@ checkmem(gpointer p)
 #endif
 
 static void filter_run(CamelMimeFilter *f,
-		       gchar *in, size_t len, size_t prespace,
-		       gchar **out, size_t *outlen, size_t *outprespace,
+		       const gchar *in, gsize len, gsize prespace,
+		       gchar **out, gsize *outlen, gsize *outprespace,
 		       void (*filterfunc)(CamelMimeFilter *f,
-					  gchar *in, size_t len, size_t prespace,
-					  gchar **out, size_t *outlen, size_t *outprespace))
+					  const gchar *in, gsize len, gsize prespace,
+					  gchar **out, gsize *outlen, gsize *outprespace))
 {
 	struct _CamelMimeFilterPrivate *p;
 
@@ -179,7 +179,7 @@ static void filter_run(CamelMimeFilter *f,
 
 	/* preload any backed up data */
 	if (f->backlen > 0) {
-		memcpy(in-f->backlen, f->backbuf, f->backlen);
+		memcpy((gchar *) in-f->backlen, f->backbuf, f->backlen);
 		in -= f->backlen;
 		len += f->backlen;
 		prespace -= f->backlen;
@@ -211,8 +211,8 @@ static void filter_run(CamelMimeFilter *f,
  **/
 void
 camel_mime_filter_filter (CamelMimeFilter *filter,
-			  gchar *in, size_t len, size_t prespace,
-			  gchar **out, size_t *outlen, size_t *outprespace)
+			  const gchar *in, gsize len, gsize prespace,
+			  gchar **out, gsize *outlen, gsize *outprespace)
 {
 	if (FCLASS(filter)->filter)
 		filter_run(filter, in, len, prespace, out, outlen, outprespace, FCLASS(filter)->filter);
@@ -239,8 +239,8 @@ camel_mime_filter_filter (CamelMimeFilter *filter,
  **/
 void
 camel_mime_filter_complete (CamelMimeFilter *filter,
-			    gchar *in, size_t len, size_t prespace,
-			    gchar **out, size_t *outlen, size_t *outprespace)
+			    const gchar *in, gsize len, gsize prespace,
+			    gchar **out, gsize *outlen, gsize *outprespace)
 {
 	if (FCLASS(filter)->complete)
 		filter_run(filter, in, len, prespace, out, outlen, outprespace, FCLASS(filter)->complete);
@@ -277,7 +277,7 @@ camel_mime_filter_reset(CamelMimeFilter *filter)
  * Note: New calls replace old data.
  **/
 void
-camel_mime_filter_backup(CamelMimeFilter *filter, const gchar *data, size_t length)
+camel_mime_filter_backup(CamelMimeFilter *filter, const gchar *data, gsize length)
 {
 	if (filter->backsize < length) {
 		/* g_realloc copies data, unnecessary overhead */
@@ -300,7 +300,7 @@ camel_mime_filter_backup(CamelMimeFilter *filter, const gchar *data, size_t leng
  * for filter output.
  **/
 void
-camel_mime_filter_set_size(CamelMimeFilter *filter, size_t size, gint keep)
+camel_mime_filter_set_size(CamelMimeFilter *filter, gsize size, gint keep)
 {
 	if (filter->outsize < size) {
 		gint offset = filter->outptr - filter->outreal;
diff --git a/camel/camel-mime-filter.h b/camel/camel-mime-filter.h
index 70fd8cb..4849829 100644
--- a/camel/camel-mime-filter.h
+++ b/camel/camel-mime-filter.h
@@ -44,12 +44,12 @@ struct _CamelMimeFilter {
 	gchar *outreal;		/* real malloc'd buffer */
 	gchar *outbuf;		/* first 'writable' position allowed (outreal + outpre) */
 	gchar *outptr;
-	size_t outsize;
-	size_t outpre;		/* prespace of this buffer */
+	gsize outsize;
+	gsize outpre;		/* prespace of this buffer */
 
 	gchar *backbuf;
-	size_t backsize;
-	size_t backlen;		/* significant data there */
+	gsize backsize;
+	gsize backlen;		/* significant data there */
 };
 
 struct _CamelMimeFilterClass {
@@ -57,11 +57,11 @@ struct _CamelMimeFilterClass {
 
 	/* virtual functions */
 	void (*filter)(CamelMimeFilter *f,
-		       gchar *in, size_t len, size_t prespace,
-		       gchar **out, size_t *outlen, size_t *outprespace);
+		       const gchar *in, gsize len, gsize prespace,
+		       gchar **out, gsize *outlen, gsize *outprespace);
 	void (*complete)(CamelMimeFilter *f,
-			 gchar *in, size_t len, size_t prespace,
-			 gchar **out, size_t *outlen, size_t *outprespace);
+			 const gchar *in, gsize len, gsize prespace,
+			 gchar **out, gsize *outlen, gsize *outprespace);
 	void (*reset)(CamelMimeFilter *f);
 };
 
@@ -69,20 +69,20 @@ CamelType	      camel_mime_filter_get_type	(void);
 CamelMimeFilter      *camel_mime_filter_new	(void);
 
 void camel_mime_filter_filter(CamelMimeFilter *filter,
-			      gchar *in, size_t len, size_t prespace,
-			      gchar **out, size_t *outlen, size_t *outprespace);
+			      const gchar *in, gsize len, gsize prespace,
+			      gchar **out, gsize *outlen, gsize *outprespace);
 
 void camel_mime_filter_complete(CamelMimeFilter *filter,
-				gchar *in, size_t len, size_t prespace,
-				gchar **out, size_t *outlen, size_t *outprespace);
+				const gchar *in, gsize len, gsize prespace,
+				gchar **out, gsize *outlen, gsize *outprespace);
 
 void camel_mime_filter_reset(CamelMimeFilter *filter);
 
 /* sets/returns number of bytes backed up on the input */
-void camel_mime_filter_backup(CamelMimeFilter *filter, const gchar *data, size_t length);
+void camel_mime_filter_backup(CamelMimeFilter *filter, const gchar *data, gsize length);
 
 /* ensure this much size available for filter output */
-void camel_mime_filter_set_size(CamelMimeFilter *filter, size_t size, gint keep);
+void camel_mime_filter_set_size(CamelMimeFilter *filter, gsize size, gint keep);
 
 G_END_DECLS
 
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index 7fcdd0e..62cee06 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -74,7 +74,7 @@ typedef enum {
 	HEADER_MESSAGE_ID
 } CamelHeaderType;
 
-static gchar *header_names[] = {
+static const gchar *header_names[] = {
 	/* dont include HEADER_UNKNOWN string */
 	"From", "Reply-To", "Subject", "To", "Resent-To", "Cc", "Resent-Cc",
 	"Bcc", "Resent-Bcc", "Date", "Message-Id", NULL
@@ -84,11 +84,11 @@ static GHashTable *header_name_table;
 
 static CamelMimePartClass *parent_class = NULL;
 
-static gchar *recipient_names[] = {
+static const gchar *recipient_names[] = {
 	"To", "Cc", "Bcc", "Resent-To", "Resent-Cc", "Resent-Bcc", NULL
 };
 
-static ssize_t write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
+static gssize write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
 static void add_header (CamelMedium *medium, const gchar *name, gconstpointer value);
 static void set_header (CamelMedium *medium, const gchar *name, gconstpointer value);
 static void remove_header (CamelMedium *medium, const gchar *name);
@@ -112,7 +112,10 @@ camel_mime_message_class_init (CamelMimeMessageClass *camel_mime_message_class)
 
 	header_name_table = g_hash_table_new (camel_strcase_hash, camel_strcase_equal);
 	for (i = 0;header_names[i]; i++)
-		g_hash_table_insert (header_name_table, header_names[i], GINT_TO_POINTER(i+1));
+		g_hash_table_insert (
+			header_name_table,
+			(gpointer) header_names[i],
+			GINT_TO_POINTER(i+1));
 
 	/* virtual method overload */
 	camel_data_wrapper_class->write_to_stream = write_to_stream;
@@ -133,7 +136,10 @@ camel_mime_message_init (gpointer object, gpointer klass)
 
 	mime_message->recipients =  g_hash_table_new (camel_strcase_hash, camel_strcase_equal);
 	for (i=0;recipient_names[i];i++) {
-		g_hash_table_insert(mime_message->recipients, recipient_names[i], camel_internet_address_new());
+		g_hash_table_insert (
+			mime_message->recipients,
+			(gpointer) recipient_names[i],
+			camel_internet_address_new ());
 	}
 
 	mime_message->subject = NULL;
@@ -580,11 +586,11 @@ camel_mime_message_get_source (CamelMimeMessage *mime_message)
 }
 
 /* mime_message */
-static int
+static gint
 construct_from_parser (CamelMimePart *dw, CamelMimeParser *mp)
 {
 	gchar *buf;
-	size_t len;
+	gsize len;
 	gint state;
 	gint ret;
 	gint err;
@@ -624,7 +630,7 @@ construct_from_parser (CamelMimePart *dw, CamelMimeParser *mp)
 	return ret;
 }
 
-static ssize_t
+static gssize
 write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
 {
 	CamelMimeMessage *mm = CAMEL_MIME_MESSAGE (data_wrapper);
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c
index 4956340..15b8645 100644
--- a/camel/camel-mime-parser.c
+++ b/camel/camel-mime-parser.c
@@ -145,13 +145,13 @@ struct _header_scan_filter {
 	CamelMimeFilter *filter;
 };
 
-static void folder_scan_step(struct _header_scan_state *s, gchar **databuffer, size_t *datalength);
+static void folder_scan_step(struct _header_scan_state *s, gchar **databuffer, gsize *datalength);
 static void folder_scan_drop_step(struct _header_scan_state *s);
 static gint folder_scan_init_with_fd(struct _header_scan_state *s, gint fd);
 static gint folder_scan_init_with_stream(struct _header_scan_state *s, CamelStream *stream);
 static struct _header_scan_state *folder_scan_init(void);
 static void folder_scan_close(struct _header_scan_state *s);
-static struct _header_scan_stack *folder_scan_content(struct _header_scan_state *s, gint *lastone, gchar **data, size_t *length);
+static struct _header_scan_stack *folder_scan_content(struct _header_scan_state *s, gint *lastone, gchar **data, gsize *length);
 static struct _header_scan_stack *folder_scan_header(struct _header_scan_state *s, gint *lastone);
 static gint folder_scan_skip_line(struct _header_scan_state *s, GByteArray *save);
 static off_t folder_seek(struct _header_scan_state *s, off_t offset, gint whence);
@@ -605,7 +605,7 @@ camel_mime_parser_drop_step (CamelMimeParser *parser)
  * is returned.
  **/
 camel_mime_parser_state_t
-camel_mime_parser_step (CamelMimeParser *parser, gchar **databuffer, size_t *datalength)
+camel_mime_parser_step (CamelMimeParser *parser, gchar **databuffer, gsize *datalength)
 {
 	struct _header_scan_state *s = _PRIVATE (parser);
 
@@ -613,7 +613,7 @@ camel_mime_parser_step (CamelMimeParser *parser, gchar **databuffer, size_t *dat
 
 	if (s->unstep <= 0) {
 		gchar *dummy;
-		size_t dummylength;
+		gsize dummylength;
 
 		if (databuffer == NULL) {
 			databuffer = &dummy;
@@ -885,7 +885,7 @@ camel_mime_parser_errno (CamelMimeParser *parser)
 /* ********************************************************************** */
 
 /* read the next bit of data, ensure there is enough room 'atleast' bytes */
-static int
+static gint
 folder_read(struct _header_scan_state *s)
 {
 	gint len;
@@ -1016,7 +1016,7 @@ folder_pull_part(struct _header_scan_state *s)
 	}
 }
 
-static int
+static gint
 folder_scan_skip_line(struct _header_scan_state *s, GByteArray *save)
 {
 	gint atleast = s->atleast;
@@ -1253,7 +1253,7 @@ folder_scan_header(struct _header_scan_state *s, gint *lastone)
 						/* otherwise, complete header, add it */
 						s->outptr[0] = 0;
 
-						h(printf("header '%s' at %d\n", s->outbuf, (int)s->header_start));
+						h(printf("header '%s' at %d\n", s->outbuf, (gint)s->header_start));
 
 						header_raw_append_parse(&h->headers, s->outbuf, s->header_start);
 						s->outptr = s->outbuf;
@@ -1299,7 +1299,7 @@ header_done:
 }
 
 static struct _header_scan_stack *
-folder_scan_content(struct _header_scan_state *s, gint *lastone, gchar **data, size_t *length)
+folder_scan_content(struct _header_scan_state *s, gint *lastone, gchar **data, gsize *length)
 {
 	gint atleast = s->atleast, newatleast;
 	register gchar *inptr;
@@ -1494,7 +1494,7 @@ folder_scan_reset(struct _header_scan_state *s)
 	s->eof = FALSE;
 }
 
-static int
+static gint
 folder_scan_init_with_fd(struct _header_scan_state *s, gint fd)
 {
 	folder_scan_reset(s);
@@ -1503,7 +1503,7 @@ folder_scan_init_with_fd(struct _header_scan_state *s, gint fd)
 	return 0;
 }
 
-static int
+static gint
 folder_scan_init_with_stream(struct _header_scan_state *s, CamelStream *stream)
 {
 	folder_scan_reset(s);
@@ -1516,7 +1516,7 @@ folder_scan_init_with_stream(struct _header_scan_state *s, CamelStream *stream)
 #define USE_FROM
 
 static void
-folder_scan_step(struct _header_scan_state *s, gchar **databuffer, size_t *datalength)
+folder_scan_step(struct _header_scan_state *s, gchar **databuffer, gsize *datalength)
 {
 	struct _header_scan_stack *h, *hb;
 	const gchar *content;
@@ -1524,7 +1524,7 @@ folder_scan_step(struct _header_scan_state *s, gchar **databuffer, size_t *datal
 	gint type, state, seenlast;
 	CamelContentType *ct = NULL;
 	struct _header_scan_filter *f;
-	size_t presize;
+	gsize presize;
 
 /*	printf("\nSCAN PASS: state = %d '%s'\n", s->state, states[s->state]);*/
 
@@ -1660,7 +1660,7 @@ tail_recurse:
 			hb = folder_scan_content (s, &state, databuffer, datalength);
 
 			d(printf ("\n\nOriginal content: '"));
-			d(fwrite(*databuffer, sizeof(char), *datalength, stdout));
+			d(fwrite(*databuffer, sizeof(gchar), *datalength, stdout));
 			d(printf("'\n"));
 
 			if (*datalength > 0) {
@@ -1668,7 +1668,7 @@ tail_recurse:
 					camel_mime_filter_filter(f->filter, *databuffer, *datalength, presize,
 								 databuffer, datalength, &presize);
 					d(printf("Filtered content (%s): '", ((CamelObject *)f->filter)->klass->name));
-					d(fwrite(*databuffer, sizeof(char), *datalength, stdout));
+					d(fwrite(*databuffer, sizeof(gchar), *datalength, stdout));
 					d(printf("'\n"));
 					f = f->next;
 				}
@@ -1808,7 +1808,7 @@ gint main(gint argc, gchar **argv)
 	gint fd;
 	struct _header_scan_state *s;
 	gchar *data;
-	size_t len;
+	gsize len;
 	gint state;
 	gchar *name = "/tmp/evmail/Inbox";
 	struct _header_scan_stack *h;
diff --git a/camel/camel-mime-parser.h b/camel/camel-mime-parser.h
index c688ce5..8738b37 100644
--- a/camel/camel-mime-parser.h
+++ b/camel/camel-mime-parser.h
@@ -80,15 +80,15 @@ CamelType camel_mime_parser_get_type (void);
 CamelMimeParser *camel_mime_parser_new (void);
 
 /* quick-fix for parser not erroring, we can find out if it had an error afterwards */
-int		camel_mime_parser_errno (CamelMimeParser *parser);
+gint		camel_mime_parser_errno (CamelMimeParser *parser);
 
 /* using an fd will be a little faster, but not much (over a simple stream) */
-int		camel_mime_parser_init_with_fd (CamelMimeParser *m, gint fd);
-int		camel_mime_parser_init_with_stream (CamelMimeParser *m, CamelStream *stream);
+gint		camel_mime_parser_init_with_fd (CamelMimeParser *m, gint fd);
+gint		camel_mime_parser_init_with_stream (CamelMimeParser *m, CamelStream *stream);
 
 /* get the stream or fd back of the parser */
 CamelStream    *camel_mime_parser_stream (CamelMimeParser *parser);
-int		camel_mime_parser_fd (CamelMimeParser *parser);
+gint		camel_mime_parser_fd (CamelMimeParser *parser);
 
 /* scan 'From' separators? */
 void camel_mime_parser_scan_from (CamelMimeParser *parser, gboolean scan_from);
@@ -99,7 +99,7 @@ void camel_mime_parser_scan_pre_from (CamelMimeParser *parser, gboolean scan_pre
 gint camel_mime_parser_set_header_regex (CamelMimeParser *parser, gchar *matchstr);
 
 /* normal interface */
-camel_mime_parser_state_t camel_mime_parser_step (CamelMimeParser *parser, gchar **databuffer, size_t *datalength);
+camel_mime_parser_state_t camel_mime_parser_step (CamelMimeParser *parser, gchar **databuffer, gsize *datalength);
 void camel_mime_parser_unstep (CamelMimeParser *parser);
 void camel_mime_parser_drop_step (CamelMimeParser *parser);
 camel_mime_parser_state_t camel_mime_parser_state (CamelMimeParser *parser);
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
index 2276763..ccda987 100644
--- a/camel/camel-mime-part-utils.c
+++ b/camel/camel-mime-part-utils.c
@@ -60,7 +60,7 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser
 	gchar *buf;
 	GByteArray *buffer;
 	CamelStream *mem;
-	size_t len;
+	gsize len;
 
 	d(printf ("simple_data_wrapper_construct_from_parser()\n"));
 
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index c67dfbf..88fb732 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -74,8 +74,8 @@ static CamelMediumClass *parent_class=NULL;
 #define CMD_CLASS(so) CAMEL_MEDIUM_CLASS (CAMEL_OBJECT_GET_CLASS(so))
 
 /* from CamelDataWrapper */
-static ssize_t         write_to_stream                 (CamelDataWrapper *dw, CamelStream *stream);
-static int	       construct_from_stream	       (CamelDataWrapper *dw, CamelStream *stream);
+static gssize         write_to_stream                 (CamelDataWrapper *dw, CamelStream *stream);
+static gint	       construct_from_stream	       (CamelDataWrapper *dw, CamelStream *stream);
 
 /* from CamelMedium */
 static void            add_header                      (CamelMedium *medium, const gchar *name, gconstpointer value);
@@ -94,9 +94,9 @@ static gint             construct_from_parser           (CamelMimePart *mime_par
 static void set_disposition (CamelMimePart *mime_part, const gchar *disposition);
 
 /* format output of headers */
-static ssize_t write_references(CamelStream *stream, struct _camel_header_raw *h);
+static gssize write_references(CamelStream *stream, struct _camel_header_raw *h);
 /*static gint write_fold(CamelStream *stream, struct _camel_header_raw *h);*/
-static ssize_t write_raw(CamelStream *stream, struct _camel_header_raw *h);
+static gssize write_raw(CamelStream *stream, struct _camel_header_raw *h);
 
 
 /* loads in a hash table the set of header names we */
@@ -105,26 +105,69 @@ static ssize_t write_raw(CamelStream *stream, struct _camel_header_raw *h);
 static void
 init_header_name_table(void)
 {
-	header_name_table = g_hash_table_new (camel_strcase_hash, camel_strcase_equal);
-	g_hash_table_insert (header_name_table, "Content-Description", (gpointer)HEADER_DESCRIPTION);
-	g_hash_table_insert (header_name_table, "Content-Disposition", (gpointer)HEADER_DISPOSITION);
-	g_hash_table_insert (header_name_table, "Content-id", (gpointer)HEADER_CONTENT_ID);
-	g_hash_table_insert (header_name_table, "Content-Transfer-Encoding", (gpointer)HEADER_ENCODING);
-	g_hash_table_insert (header_name_table, "Content-MD5", (gpointer)HEADER_CONTENT_MD5);
-	g_hash_table_insert (header_name_table, "Content-Location", (gpointer)HEADER_CONTENT_LOCATION);
-	g_hash_table_insert (header_name_table, "Content-Type", (gpointer)HEADER_CONTENT_TYPE);
-
-	header_formatted_table = g_hash_table_new (camel_strcase_hash, camel_strcase_equal);
-	g_hash_table_insert(header_formatted_table, "Content-Type", write_raw);
-	g_hash_table_insert(header_formatted_table, "Content-Disposition", write_raw);
-	g_hash_table_insert(header_formatted_table, "To", write_raw);
-	g_hash_table_insert(header_formatted_table, "From", write_raw);
-	g_hash_table_insert(header_formatted_table, "Reply-To", write_raw);
-	g_hash_table_insert(header_formatted_table, "Cc", write_raw);
-	g_hash_table_insert(header_formatted_table, "Bcc", write_raw);
-	g_hash_table_insert(header_formatted_table, "Message-ID", write_raw);
-	g_hash_table_insert(header_formatted_table, "In-Reply-To", write_raw);
-	g_hash_table_insert(header_formatted_table, "References", write_references);
+	header_name_table = g_hash_table_new (
+		camel_strcase_hash, camel_strcase_equal);
+	g_hash_table_insert (
+		header_name_table,
+		(gpointer) "Content-Description",
+		(gpointer) HEADER_DESCRIPTION);
+	g_hash_table_insert (
+		header_name_table,
+		(gpointer) "Content-Disposition",
+		(gpointer) HEADER_DISPOSITION);
+	g_hash_table_insert (
+		header_name_table,
+		(gpointer) "Content-id",
+		(gpointer) HEADER_CONTENT_ID);
+	g_hash_table_insert (
+		header_name_table,
+		(gpointer) "Content-Transfer-Encoding",
+		(gpointer) HEADER_ENCODING);
+	g_hash_table_insert (
+		header_name_table,
+		(gpointer) "Content-MD5",
+		(gpointer) HEADER_CONTENT_MD5);
+	g_hash_table_insert (
+		header_name_table,
+		(gpointer) "Content-Location",
+		(gpointer) HEADER_CONTENT_LOCATION);
+	g_hash_table_insert (
+		header_name_table,
+		(gpointer) "Content-Type",
+		(gpointer) HEADER_CONTENT_TYPE);
+
+	header_formatted_table = g_hash_table_new (
+		camel_strcase_hash, camel_strcase_equal);
+	g_hash_table_insert (
+		header_formatted_table,
+		(gpointer) "Content-Type", write_raw);
+	g_hash_table_insert (
+		header_formatted_table,
+		(gpointer) "Content-Disposition", write_raw);
+	g_hash_table_insert (
+		header_formatted_table,
+		(gpointer) "To", write_raw);
+	g_hash_table_insert (
+		header_formatted_table,
+		(gpointer) "From", write_raw);
+	g_hash_table_insert (
+		header_formatted_table,
+		(gpointer) "Reply-To", write_raw);
+	g_hash_table_insert (
+		header_formatted_table,
+		(gpointer) "Cc", write_raw);
+	g_hash_table_insert (
+		header_formatted_table,
+		(gpointer) "Bcc", write_raw);
+	g_hash_table_insert (
+		header_formatted_table,
+		(gpointer) "Message-ID", write_raw);
+	g_hash_table_insert (
+		header_formatted_table,
+		(gpointer) "In-Reply-To", write_raw);
+	g_hash_table_insert (
+		header_formatted_table,
+		(gpointer) "References", write_references);
 }
 
 static void
@@ -707,10 +750,10 @@ set_content_object (CamelMedium *medium, CamelDataWrapper *content)
 
 /**********************************************************************/
 
-static ssize_t
+static gssize
 write_references(CamelStream *stream, struct _camel_header_raw *h)
 {
-	ssize_t len, out, total;
+	gssize len, out, total;
 	gchar *v, *ids, *ide;
 
 	/* this is only approximate, based on the next >, this way it retains any content
@@ -751,7 +794,7 @@ write_references(CamelStream *stream, struct _camel_header_raw *h)
 
 #if 0
 /* not needed - yet - handled by default case */
-static ssize_t
+static gssize
 write_fold(CamelStream *stream, struct _camel_header_raw *h)
 {
 	gchar *val;
@@ -765,7 +808,7 @@ write_fold(CamelStream *stream, struct _camel_header_raw *h)
 }
 #endif
 
-static ssize_t
+static gssize
 write_raw(CamelStream *stream, struct _camel_header_raw *h)
 {
 	gchar *val = h->value;
@@ -773,15 +816,15 @@ write_raw(CamelStream *stream, struct _camel_header_raw *h)
 	return camel_stream_printf(stream, "%s%s%s\n", h->name, isspace(val[0]) ? ":" : ": ", val);
 }
 
-static ssize_t
+static gssize
 write_to_stream (CamelDataWrapper *dw, CamelStream *stream)
 {
 	CamelMimePart *mp = CAMEL_MIME_PART (dw);
 	CamelMedium *medium = CAMEL_MEDIUM (dw);
 	CamelStream *ostream = stream;
 	CamelDataWrapper *content;
-	ssize_t total = 0;
-	ssize_t count;
+	gssize total = 0;
+	gssize count;
 	gint errnosav;
 
 	d(printf("mime_part::write_to_stream\n"));
@@ -792,7 +835,7 @@ write_to_stream (CamelDataWrapper *dw, CamelStream *stream)
 	if (mp->headers) {
 		struct _camel_header_raw *h = mp->headers;
 		gchar *val;
-		ssize_t (*writefn)(CamelStream *stream, struct _camel_header_raw *);
+		gssize (*writefn)(CamelStream *stream, struct _camel_header_raw *);
 
 		/* fold/write the headers.   But dont fold headers that are already formatted
 		   (e.g. ones with parameter-lists, that we know about, and have created) */
@@ -925,14 +968,14 @@ write_to_stream (CamelDataWrapper *dw, CamelStream *stream)
 }
 
 /* mime_part */
-static int
+static gint
 construct_from_parser (CamelMimePart *mime_part, CamelMimeParser *mp)
 {
 	CamelDataWrapper *dw = (CamelDataWrapper *) mime_part;
 	struct _camel_header_raw *headers;
 	const gchar *content;
 	gchar *buf;
-	size_t len;
+	gsize len;
 	gint err;
 
 	d(printf("mime_part::construct_from_parser()\n"));
@@ -993,7 +1036,7 @@ camel_mime_part_construct_from_parser(CamelMimePart *mime_part, CamelMimeParser
 	return CMP_CLASS (mime_part)->construct_from_parser (mime_part, mp);
 }
 
-static int
+static gint
 construct_from_stream(CamelDataWrapper *dw, CamelStream *s)
 {
 	CamelMimeParser *mp;
@@ -1073,12 +1116,12 @@ camel_mime_part_set_content (CamelMimePart *mime_part,
  *
  * Returns: the size of the MIME part's content in bytes.
  **/
-size_t
+gsize
 camel_mime_part_get_content_size (CamelMimePart *mime_part)
 {
 	CamelStreamNull *null;
 	CamelDataWrapper *dw;
-	size_t size;
+	gsize size;
 
 	g_return_val_if_fail (CAMEL_IS_MIME_PART (mime_part), 0);
 
diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h
index 5bbed27..86478e0 100644
--- a/camel/camel-mime-part.h
+++ b/camel/camel-mime-part.h
@@ -97,13 +97,13 @@ void               camel_mime_part_set_content_type	(CamelMimePart *mime_part, c
 CamelContentType  *camel_mime_part_get_content_type	(CamelMimePart *mime_part);
 
 /* construction */
-int		camel_mime_part_construct_from_parser  (CamelMimePart *mime_part, CamelMimeParser *parser);
+gint		camel_mime_part_construct_from_parser  (CamelMimePart *mime_part, CamelMimeParser *parser);
 
 /* utility functions */
 void	camel_mime_part_set_content	       (CamelMimePart *mime_part,
 							const gchar *data, gint length, const gchar *type);
 
-size_t          camel_mime_part_get_content_size       (CamelMimePart *mime_part);
+gsize          camel_mime_part_get_content_size       (CamelMimePart *mime_part);
 
 G_END_DECLS
 
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index df81611..13b660b 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -101,8 +101,8 @@ static const guchar tohex[16] = {
  *
  * Returns: the number of bytes encoded
  **/
-size_t
-camel_base64_encode_close(guchar *in, size_t inlen, gboolean break_lines, guchar *out, gint *state, gint *save)
+gsize
+camel_base64_encode_close(guchar *in, gsize inlen, gboolean break_lines, guchar *out, gint *state, gint *save)
 {
 	gsize bytes = 0;
 
@@ -131,8 +131,8 @@ camel_base64_encode_close(guchar *in, size_t inlen, gboolean break_lines, guchar
  *
  * Returns: the number of bytes encoded
  **/
-size_t
-camel_base64_encode_step(guchar *in, size_t len, gboolean break_lines, guchar *out, gint *state, gint *save)
+gsize
+camel_base64_encode_step(guchar *in, gsize len, gboolean break_lines, guchar *out, gint *state, gint *save)
 {
 	return g_base64_encode_step (in, len, break_lines, (gchar *) out, state, save);
 }
@@ -150,8 +150,8 @@ camel_base64_encode_step(guchar *in, size_t len, gboolean break_lines, guchar *o
  *
  * Returns: the number of bytes decoded (which have been dumped in @out)
  **/
-size_t
-camel_base64_decode_step(guchar *in, size_t len, guchar *out, gint *state, guint *save)
+gsize
+camel_base64_decode_step(guchar *in, gsize len, guchar *out, gint *state, guint *save)
 {
 	return g_base64_decode_step ((gchar *) in, len, out, state, save);
 }
@@ -167,7 +167,7 @@ camel_base64_decode_step(guchar *in, size_t len, guchar *out, gint *state, guint
  * Returns: a string containing the base64 encoded data
  **/
 gchar *
-camel_base64_encode_simple (const gchar *data, size_t len)
+camel_base64_encode_simple (const gchar *data, gsize len)
 {
 	return g_base64_encode ((const guchar *) data, len);
 }
@@ -182,8 +182,8 @@ camel_base64_encode_simple (const gchar *data, size_t len)
  *
  * Returns: the new length of @data
  **/
-size_t
-camel_base64_decode_simple (gchar *data, size_t len)
+gsize
+camel_base64_decode_simple (gchar *data, gsize len)
 {
 	guchar *out_data;
 	gsize out_len = 0;
@@ -214,8 +214,8 @@ camel_base64_decode_simple (gchar *data, size_t len)
  *
  * Returns: the number of bytes encoded
  **/
-size_t
-camel_uuencode_close (guchar *in, size_t len, guchar *out, guchar *uubuf, gint *state, guint32 *save)
+gsize
+camel_uuencode_close (guchar *in, gsize len, guchar *out, guchar *uubuf, gint *state, guint32 *save)
 {
 	register guchar *outptr, *bufptr;
 	register guint32 saved;
@@ -296,8 +296,8 @@ camel_uuencode_close (guchar *in, size_t len, guchar *out, guchar *uubuf, gint *
  *
  * Returns: the number of bytes encoded
  **/
-size_t
-camel_uuencode_step (guchar *in, size_t len, guchar *out, guchar *uubuf, gint *state, guint32 *save)
+gsize
+camel_uuencode_step (guchar *in, gsize len, guchar *out, guchar *uubuf, gint *state, guint32 *save)
 {
 	register guchar *inptr, *outptr, *bufptr;
 	guchar *inend;
@@ -372,8 +372,8 @@ camel_uuencode_step (guchar *in, size_t len, guchar *out, guchar *uubuf, gint *s
  *
  * Returns: the number of bytes decoded
  **/
-size_t
-camel_uudecode_step (guchar *in, size_t len, guchar *out, gint *state, guint32 *save)
+gsize
+camel_uudecode_step (guchar *in, gsize len, guchar *out, gint *state, guint32 *save)
 {
 	register guchar *inptr, *outptr;
 	guchar *inend, ch;
@@ -471,8 +471,8 @@ camel_uudecode_step (guchar *in, size_t len, guchar *out, gint *state, guint32 *
  *
  * Returns: the number of bytes encoded
  **/
-size_t
-camel_quoted_encode_close(guchar *in, size_t len, guchar *out, gint *state, gint *save)
+gsize
+camel_quoted_encode_close(guchar *in, gsize len, guchar *out, gint *state, gint *save)
 {
 	register guchar *outptr = out;
 	gint last;
@@ -514,8 +514,8 @@ camel_quoted_encode_close(guchar *in, size_t len, guchar *out, gint *state, gint
  *
  * Returns: the number of bytes encoded
  **/
-size_t
-camel_quoted_encode_step (guchar *in, size_t len, guchar *out, gint *statep, gint *save)
+gsize
+camel_quoted_encode_step (guchar *in, gsize len, guchar *out, gint *statep, gint *save)
 {
 	register guchar *inptr, *outptr, *inend;
 	guchar c;
@@ -613,8 +613,8 @@ camel_quoted_encode_step (guchar *in, size_t len, guchar *out, gint *statep, gin
  *
  * Returns: the number of bytes decoded
  **/
-size_t
-camel_quoted_decode_step(guchar *in, size_t len, guchar *out, gint *savestate, gint *saveme)
+gsize
+camel_quoted_decode_step(guchar *in, gsize len, guchar *out, gint *savestate, gint *saveme)
 {
 	register guchar *inptr, *outptr;
 	guchar *inend, c;
@@ -705,8 +705,8 @@ camel_quoted_decode_step(guchar *in, size_t len, guchar *out, gint *savestate, g
   this is for the "Q" encoding of international words,
   which is slightly different than plain quoted-printable (mainly by allowing 0x20 <> _)
 */
-static size_t
-quoted_decode(const guchar *in, size_t len, guchar *out)
+static gsize
+quoted_decode(const guchar *in, gsize len, guchar *out)
 {
 	register const guchar *inptr;
 	register guchar *outptr;
@@ -748,8 +748,8 @@ quoted_decode(const guchar *in, size_t len, guchar *out)
 /* rfc2047 version of quoted-printable */
 /* safemask is the mask to apply to the camel_mime_special_table to determine what
    characters can safely be included without encoding */
-static size_t
-quoted_encode (const guchar *in, size_t len, guchar *out, unsigned short safemask)
+static gsize
+quoted_encode (const guchar *in, gsize len, guchar *out, unsigned short safemask)
 {
 	register const guchar *inptr, *inend;
 	guchar *outptr;
@@ -812,12 +812,12 @@ header_decode_lwsp(const gchar **in)
 }
 
 static gchar *
-camel_iconv_strndup (iconv_t cd, const gchar *string, size_t n)
+camel_iconv_strndup (iconv_t cd, const gchar *string, gsize n)
 {
-	size_t inleft, outleft, converted = 0;
+	gsize inleft, outleft, converted = 0;
 	gchar *out, *outbuf;
 	const gchar *inbuf;
-	size_t outlen;
+	gsize outlen;
 	gint errnosav;
 
 	if (cd == (iconv_t) -1)
@@ -835,7 +835,7 @@ camel_iconv_strndup (iconv_t cd, const gchar *string, size_t n)
 		outleft = outlen - converted;
 
 		converted = iconv (cd, (gchar **) &inbuf, &inleft, &outbuf, &outleft);
-		if (converted == (size_t) -1) {
+		if (converted == (gsize) -1) {
 			if (errno != E2BIG && errno != EINVAL)
 				goto fail;
 		}
@@ -893,13 +893,13 @@ camel_iconv_strndup (iconv_t cd, const gchar *string, size_t n)
 	return NULL;
 }
 
-#define is_ascii(c) isascii ((int) ((unsigned char) (c)))
+#define is_ascii(c) isascii ((gint) ((guchar) (c)))
 
 static gchar *
-decode_8bit (const gchar *text, size_t len, const gchar *default_charset)
+decode_8bit (const gchar *text, gsize len, const gchar *default_charset)
 {
 	const gchar *charsets[4] = { "UTF-8", NULL, NULL, NULL };
-	size_t inleft, outleft, outlen, rc, min, n;
+	gsize inleft, outleft, outlen, rc, min, n;
 	const gchar *locale_charset, *best;
 	gchar *out, *outbuf;
 	const gchar *inbuf;
@@ -931,7 +931,7 @@ decode_8bit (const gchar *text, size_t len, const gchar *default_charset)
 
 		do {
 			rc = iconv (cd, (gchar **) &inbuf, &inleft, &outbuf, &outleft);
-			if (rc == (size_t) -1) {
+			if (rc == (gsize) -1) {
 				if (errno == EINVAL) {
 					/* incomplete sequence at the end of the input buffer */
 					n += inleft;
@@ -940,7 +940,7 @@ decode_8bit (const gchar *text, size_t len, const gchar *default_charset)
 
 				if (errno == E2BIG) {
 					outlen += (inleft * 2) + 16;
-					rc = (size_t) (outbuf - out);
+					rc = (gsize) (outbuf - out);
 					out = g_realloc (out, outlen + 1);
 					outleft = outlen - rc;
 					outbuf = out + rc;
@@ -957,7 +957,7 @@ decode_8bit (const gchar *text, size_t len, const gchar *default_charset)
 
 		camel_iconv_close (cd);
 
-		if (rc != (size_t) -1 && n == 0)
+		if (rc != (gsize) -1 && n == 0)
 			return out;
 
 		if (n < min) {
@@ -998,7 +998,7 @@ decode_8bit (const gchar *text, size_t len, const gchar *default_charset)
 
 	do {
 		rc = iconv (cd, (gchar **) &inbuf, &inleft, &outbuf, &outleft);
-		if (rc == (size_t) -1) {
+		if (rc == (gsize) -1) {
 			if (errno == EINVAL) {
 				/* incomplete sequence at the end of the input buffer */
 				break;
@@ -1031,18 +1031,18 @@ decode_8bit (const gchar *text, size_t len, const gchar *default_charset)
 
 /* decode an rfc2047 encoded-word token */
 static gchar *
-rfc2047_decode_word (const gchar *in, size_t inlen, const gchar *default_charset)
+rfc2047_decode_word (const gchar *in, gsize inlen, const gchar *default_charset)
 {
 	const guchar *instart = (const guchar *) in;
-	const register guchar *inptr = instart + 2;
+	const guchar *inptr = instart + 2;
 	const guchar *inend = instart + inlen - 2;
 	guchar *decoded;
 	const gchar *charset;
 	gchar *charenc, *p;
 	guint32 save = 0;
-	ssize_t declen;
+	gssize declen;
 	gint state = 0;
-	size_t len;
+	gsize len;
 	iconv_t cd;
 	gchar *buf;
 
@@ -1137,12 +1137,12 @@ rfc2047_decode_word (const gchar *in, size_t inlen, const gchar *default_charset
    according to the rfc's.  Anyway, since the conversion to utf-8
    is trivial, just do it here without iconv */
 static GString *
-append_latin1 (GString *out, const gchar *in, size_t len)
+append_latin1 (GString *out, const gchar *in, gsize len)
 {
 	guint c;
 
 	while (len) {
-		c = (unsigned int)*in++;
+		c = (guint)*in++;
 		len--;
 		if (c & 0x80) {
 			out = g_string_append_c (out, 0xc0 | ((c >> 6) & 0x3));  /* 110000xx */
@@ -1154,11 +1154,11 @@ append_latin1 (GString *out, const gchar *in, size_t len)
 	return out;
 }
 
-static int
-append_8bit (GString *out, const gchar *inbuf, size_t inlen, const gchar *charset)
+static gint
+append_8bit (GString *out, const gchar *inbuf, gsize inlen, const gchar *charset)
 {
 	gchar *outbase, *outbuf;
-	size_t outlen;
+	gsize outlen;
 	iconv_t ic;
 
 	ic = camel_iconv_open ("UTF-8", charset);
@@ -1168,7 +1168,7 @@ append_8bit (GString *out, const gchar *inbuf, size_t inlen, const gchar *charse
 	outlen = inlen * 6 + 16;
 	outbuf = outbase = g_malloc(outlen);
 
-	if (camel_iconv (ic, &inbuf, &inlen, &outbuf, &outlen) == (size_t) -1) {
+	if (camel_iconv (ic, &inbuf, &inlen, &outbuf, &outlen) == (gsize) -1) {
 		w(g_warning("Conversion to '%s' failed: %s", charset, g_strerror (errno)));
 		g_free(outbase);
 		camel_iconv_close (ic);
@@ -1187,7 +1187,7 @@ append_8bit (GString *out, const gchar *inbuf, size_t inlen, const gchar *charse
 }
 
 static GString *
-append_quoted_pair (GString *str, const gchar *in, size_t inlen)
+append_quoted_pair (GString *str, const gchar *in, gsize inlen)
 {
 	register const gchar *inptr = in;
 	const gchar *inend = in + inlen;
@@ -1211,7 +1211,7 @@ header_decode_text (const gchar *in, gint ctext, const gchar *default_charset)
 	register const gchar *inptr = in;
 	gboolean encoded = FALSE;
 	const gchar *lwsp, *text;
-	size_t nlwsp, n;
+	gsize nlwsp, n;
 	gboolean ascii;
 	gchar *decoded;
 	GString *out;
@@ -1226,7 +1226,7 @@ header_decode_text (const gchar *in, gint ctext, const gchar *default_charset)
 		while (camel_mime_is_lwsp (*inptr))
 			inptr++;
 
-		nlwsp = (size_t) (inptr - lwsp);
+		nlwsp = (gsize) (inptr - lwsp);
 
 		if (*inptr != '\0') {
 			text = inptr;
@@ -1266,7 +1266,7 @@ header_decode_text (const gchar *in, gint ctext, const gchar *default_charset)
 				}
 			}
 
-			n = (size_t) (inptr - text);
+			n = (gsize) (inptr - text);
 			if (is_rfc2047_encoded_word (text, n)) {
 				if ((decoded = rfc2047_decode_word (text, n, default_charset))) {
 					/* rfc2047 states that you must ignore all
@@ -1366,11 +1366,11 @@ camel_header_format_ctext (const gchar *in, const gchar *default_charset)
 
 /* FIXME: needs a way to cache iconv opens for different charsets? */
 static void
-rfc2047_encode_word(GString *outstring, const gchar *in, size_t len, const gchar *type, unsigned short safemask)
+rfc2047_encode_word(GString *outstring, const gchar *in, gsize len, const gchar *type, unsigned short safemask)
 {
 	iconv_t ic = (iconv_t) -1;
 	gchar *buffer, *out, *ascii;
-	size_t inlen, outlen, enclen, bufflen;
+	gsize inlen, outlen, enclen, bufflen;
 	const gchar *inptr, *p;
 	gint first = 1;
 
@@ -1388,7 +1388,7 @@ rfc2047_encode_word(GString *outstring, const gchar *in, size_t len, const gchar
 		ic = camel_iconv_open (type, "UTF-8");
 
 	while (inlen) {
-		ssize_t convlen, proclen;
+		gssize convlen, proclen;
 		gint i;
 
 		/* break up words into smaller bits, what we really want is encoded + overhead < 75,
@@ -1438,7 +1438,7 @@ rfc2047_encode_word(GString *outstring, const gchar *in, size_t len, const gchar
 			   hopefully-small-enough chunks, and leave it at that */
 			convlen = MIN(inlen, CAMEL_FOLD_PREENCODED);
 			p = inptr;
-			if (camel_iconv (ic, &inptr, &convlen, &out, &outlen) == (size_t) -1 && errno != EINVAL) {
+			if (camel_iconv (ic, &inptr, (gsize *) &convlen, &out, &outlen) == (gsize) -1 && errno != EINVAL) {
 				w(g_warning("Conversion problem: conversion truncated: %s", g_strerror (errno)));
 				/* blah, we include it anyway, better than infinite loop ... */
 				inptr += convlen;
@@ -1614,7 +1614,7 @@ camel_header_encode_string (const guchar *in)
 
 /* apply quoted-string rules to a string */
 static void
-quote_word(GString *out, gboolean do_quotes, const gchar *start, size_t len)
+quote_word(GString *out, gboolean do_quotes, const gchar *start, gsize len)
 {
 	gint i, c;
 
@@ -1817,7 +1817,7 @@ camel_header_encode_phrase (const guchar *in)
 	wordl = words;
 	while (wordl) {
 		const gchar *start;
-		size_t len;
+		gsize len;
 
 		word = wordl->data;
 
@@ -1923,7 +1923,7 @@ header_decode_quoted_string(const gchar **in)
 {
 	const gchar *inptr = *in;
 	gchar *out = NULL, *outptr;
-	size_t outlen;
+	gsize outlen;
 	gint c;
 
 	header_decode_lwsp(&inptr);
@@ -2034,7 +2034,7 @@ camel_header_decode_int(const gchar **in)
 #define HEXVAL(c) (isdigit (c) ? (c) - '0' : tolower (c) - 'a' + 10)
 
 static gchar *
-hex_decode (const gchar *in, size_t len)
+hex_decode (const gchar *in, gsize len)
 {
 	const guchar *inend = (const guchar *) (in + len);
 	guchar *inptr, *outptr;
@@ -2062,10 +2062,10 @@ hex_decode (const gchar *in, size_t len)
 
 /* Tries to convert @in @from charset @to charset.  Any failure, we get no data out rather than partial conversion */
 static gchar *
-header_convert(const gchar *to, const gchar *from, const gchar *in, size_t inlen)
+header_convert(const gchar *to, const gchar *from, const gchar *in, gsize inlen)
 {
 	iconv_t ic;
-	size_t outlen, ret;
+	gsize outlen, ret;
 	gchar *outbuf, *outbase, *result = NULL;
 
 	ic = camel_iconv_open(to, from);
@@ -2076,7 +2076,7 @@ header_convert(const gchar *to, const gchar *from, const gchar *in, size_t inlen
 	outbuf = outbase = g_malloc(outlen);
 
 	ret = camel_iconv(ic, &in, &inlen, &outbuf, &outlen);
-	if (ret != (size_t) -1) {
+	if (ret != (gsize) -1) {
 		camel_iconv(ic, NULL, 0, &outbuf, &outlen);
 		*outbuf = '\0';
 		result = g_strdup(outbase);
@@ -2092,7 +2092,7 @@ header_convert(const gchar *to, const gchar *from, const gchar *in, size_t inlen
  */
 
 static gchar *
-rfc2184_decode (const gchar *in, size_t len)
+rfc2184_decode (const gchar *in, gsize len)
 {
 	const gchar *inptr = in;
 	const gchar *inend = in + len;
@@ -2486,8 +2486,8 @@ header_decode_mailbox(const gchar **in, const gchar *charset)
 
 			pre = header_decode_word (&inptr);
 			if (pre) {
-				size_t l = strlen (last);
-				size_t p = strlen (pre);
+				gsize l = strlen (last);
+				gsize p = strlen (pre);
 
 				/* dont append ' ' between sucsessive encoded words */
 				if ((l>6 && last[l-2] == '?' && last[l-1] == '=')
@@ -3121,7 +3121,7 @@ struct _rfc2184_param {
 	gint index;
 };
 
-static int
+static gint
 rfc2184_param_cmp(gconstpointer ap, gconstpointer bp)
 {
 	const struct _rfc2184_param *a = *(gpointer *)ap;
@@ -3164,7 +3164,7 @@ header_append_param(struct _camel_header_param *last, gchar *name, gchar *value)
 		} else {
 			node->value = value;
 			for (;*value;value++)
-				if (!isascii((unsigned char)*value))
+				if (!isascii((guchar)*value))
 					*value = '_';
 		}
 	} else
@@ -3295,7 +3295,7 @@ header_encode_param (const guchar *in, gboolean *encoded, gboolean is_filename)
 	g_return_val_if_fail (in != NULL, NULL);
 
 	if (is_filename) {
-		if (!g_utf8_validate (inptr, -1, NULL)) {
+		if (!g_utf8_validate ((gchar *) inptr, -1, NULL)) {
 			GString *buff = g_string_new ("");
 
 			for (; inptr && *inptr; inptr++) {
@@ -3305,7 +3305,7 @@ header_encode_param (const guchar *in, gboolean *encoded, gboolean is_filename)
 					g_string_append_c (buff, *inptr);
 			}
 
-			outbuf = g_string_free (buff, FALSE);
+			outbuf = (guchar *) g_string_free (buff, FALSE);
 			inptr = outbuf;
 		}
 
@@ -3365,7 +3365,7 @@ camel_header_param_list_format_append (GString *out, struct _camel_header_param
 		gboolean encoded = FALSE;
 		gboolean quote = FALSE;
 		gint here = out->len;
-		size_t nlen, vlen;
+		gsize nlen, vlen;
 		gchar *value;
 
 		if (!p->value) {
@@ -3419,7 +3419,7 @@ camel_header_param_list_format_append (GString *out, struct _camel_header_param
 					gchar *q = ptr;
 					gint j = 2;
 
-					for ( ; j > 0 && q > inptr && *q != '%'; j--, q--);
+					for (; j > 0 && q > inptr && *q != '%'; j--, q--);
 					if (*q == '%')
 						ptr = q;
 				}
@@ -3598,8 +3598,9 @@ camel_content_disposition_decode(const gchar *in)
 	d = g_malloc(sizeof(*d));
 	d->refcount = 1;
 	d->disposition = decode_token(&inptr);
-	if (d->disposition == NULL)
+	if (d->disposition == NULL) {
 		w(g_warning("Empty disposition type"));
+	}
 	d->params = header_decode_param_list(&inptr);
 	return d;
 }
@@ -3684,7 +3685,7 @@ static guchar camel_datetok_table[256] = {
 };
 
 static struct {
-	gchar *name;
+	const gchar *name;
 	gint offset;
 } tz_offsets [] = {
 	{ "UT", 0 },
@@ -3753,7 +3754,7 @@ struct _date_token {
 	struct _date_token *next;
 	guchar mask;
 	const gchar *start;
-	size_t len;
+	gsize len;
 };
 
 static struct _date_token *
@@ -3772,12 +3773,12 @@ datetok (const gchar *date)
 		if (*start == '\0')
 			break;
 
-		mask = camel_datetok_table[(unsigned char) *start];
+		mask = camel_datetok_table[(guchar) *start];
 
 		/* find the end of this token */
 		end = start + 1;
 		while (*end && !strchr ("-/,\t\r\n ", *end))
-			mask |= camel_datetok_table[(unsigned char) *end++];
+			mask |= camel_datetok_table[(guchar) *end++];
 
 		if (end != start) {
 			token = g_malloc (sizeof (struct _date_token));
@@ -3799,8 +3800,8 @@ datetok (const gchar *date)
 	return tokens;
 }
 
-static int
-decode_int (const gchar *in, size_t inlen)
+static gint
+decode_int (const gchar *in, gsize inlen)
 {
 	register const gchar *inptr;
 	gint sign = 1, val = 0;
@@ -3815,7 +3816,7 @@ decode_int (const gchar *in, size_t inlen)
 	} else if (*inptr == '+')
 		inptr++;
 
-	for ( ; inptr < inend; inptr++) {
+	for (; inptr < inend; inptr++) {
 		if (!(*inptr >= '0' && *inptr <= '9'))
 			return -1;
 		else
@@ -3828,7 +3829,7 @@ decode_int (const gchar *in, size_t inlen)
 }
 
 #if 0
-static int
+static gint
 get_days_in_month (gint month, gint year)
 {
         switch (month) {
@@ -3856,8 +3857,8 @@ get_days_in_month (gint month, gint year)
 }
 #endif
 
-static int
-get_wday (const gchar *in, size_t inlen)
+static gint
+get_wday (const gchar *in, gsize inlen)
 {
 	gint wday;
 
@@ -3874,8 +3875,8 @@ get_wday (const gchar *in, size_t inlen)
 	return -1;  /* unknown week day */
 }
 
-static int
-get_mday (const gchar *in, size_t inlen)
+static gint
+get_mday (const gchar *in, gsize inlen)
 {
 	gint mday;
 
@@ -3889,8 +3890,8 @@ get_mday (const gchar *in, size_t inlen)
 	return mday;
 }
 
-static int
-get_month (const gchar *in, size_t inlen)
+static gint
+get_month (const gchar *in, gsize inlen)
 {
 	gint i;
 
@@ -3907,8 +3908,8 @@ get_month (const gchar *in, size_t inlen)
 	return -1;  /* unknown month */
 }
 
-static int
-get_year (const gchar *in, size_t inlen)
+static gint
+get_year (const gchar *in, gsize inlen)
 {
 	gint year;
 
@@ -3927,7 +3928,7 @@ get_year (const gchar *in, size_t inlen)
 }
 
 static gboolean
-get_time (const gchar *in, size_t inlen, gint *hour, gint *min, gint *sec)
+get_time (const gchar *in, gsize inlen, gint *hour, gint *min, gint *sec)
 {
 	register const gchar *inptr;
 	gint *val, colons = 0;
@@ -3959,11 +3960,11 @@ get_time (const gchar *in, size_t inlen, gint *hour, gint *min, gint *sec)
 	return TRUE;
 }
 
-static int
+static gint
 get_tzone (struct _date_token **token)
 {
 	const gchar *inptr, *inend;
-	size_t inlen;
+	gsize inlen;
 	gint i, t;
 
 	for (i = 0; *token && i < 2; *token = (*token)->next, i++) {
@@ -3983,7 +3984,7 @@ get_tzone (struct _date_token **token)
 			}
 
 			for (t = 0; t < 15; t++) {
-				size_t len = strlen (tz_offsets[t].name);
+				gsize len = strlen (tz_offsets[t].name);
 
 				if (len != inlen)
 					continue;
@@ -4293,7 +4294,7 @@ void
 camel_header_raw_append_parse(struct _camel_header_raw **list, const gchar *header, gint offset)
 {
 	register const gchar *in;
-	size_t fieldlen;
+	gsize fieldlen;
 	gchar *name;
 
 	in = header;
@@ -4446,7 +4447,7 @@ camel_header_msgid_generate (void)
 #define COUNT_LOCK() pthread_mutex_lock (&count_lock)
 #define COUNT_UNLOCK() pthread_mutex_unlock (&count_lock)
 	gchar host[MAXHOSTNAMELEN];
-	gchar *name;
+	const gchar *name;
 	static gint count = 0;
 	gchar *msgid;
 	gint retval;
@@ -4464,7 +4465,7 @@ camel_header_msgid_generate (void)
 		name = "localhost.localdomain";
 
 	COUNT_LOCK ();
-	msgid = g_strdup_printf ("%d %d %d camel %s", (int) time (NULL), getpid (), count++, name);
+	msgid = g_strdup_printf ("%d %d %d camel %s", (gint) time (NULL), getpid (), count++, name);
 	COUNT_UNLOCK ();
 
 	if (ai)
@@ -4475,8 +4476,8 @@ camel_header_msgid_generate (void)
 
 
 static struct {
-	gchar *name;
-	gchar *pattern;
+	const gchar *name;
+	const gchar *pattern;
 	regex_t regex;
 } mail_list_magic[] = {
 	/* List-Post: <mailto:gnome-hackers gnome org> */
@@ -4534,7 +4535,7 @@ mailing_list_init(void)
 		errcode = regcomp(&mail_list_magic[i].regex, mail_list_magic[i].pattern, REG_EXTENDED|REG_ICASE);
 		if (errcode != 0) {
 			gchar *errstr;
-			size_t len;
+			gsize len;
 
 			len = regerror(errcode, &mail_list_magic[i].regex, NULL, 0);
 			errstr = g_malloc0(len + 1);
@@ -4811,9 +4812,9 @@ camel_header_address_list_format (struct _camel_header_address *a)
 }
 
 gchar *
-camel_header_address_fold (const gchar *in, size_t headerlen)
+camel_header_address_fold (const gchar *in, gsize headerlen)
 {
-	size_t len, outlen;
+	gsize len, outlen;
 	const gchar *inptr = in, *space, *p, *n;
 	GString *out;
 	gchar *ret;
@@ -4887,9 +4888,9 @@ camel_header_address_fold (const gchar *in, size_t headerlen)
 /* simple header folding */
 /* will work even if the header is already folded */
 gchar *
-camel_header_fold(const gchar *in, size_t headerlen)
+camel_header_fold(const gchar *in, gsize headerlen)
 {
-	size_t len, outlen, tmplen;
+	gsize len, outlen, tmplen;
 	const gchar *inptr = in, *space, *p, *n;
 	GString *out;
 	gchar *ret;
diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h
index 4bfbe30..8bd7b2d 100644
--- a/camel/camel-mime-utils.h
+++ b/camel/camel-mime-utils.h
@@ -174,8 +174,8 @@ void camel_header_raw_clear (struct _camel_header_raw **list);
 gchar *camel_header_raw_check_mailing_list (struct _camel_header_raw **list);
 
 /* fold a header */
-gchar *camel_header_address_fold (const gchar *in, size_t headerlen);
-gchar *camel_header_fold (const gchar *in, size_t headerlen);
+gchar *camel_header_address_fold (const gchar *in, gsize headerlen);
+gchar *camel_header_fold (const gchar *in, gsize headerlen);
 gchar *camel_header_unfold (const gchar *in);
 
 /* decode a header which is a simple token */
@@ -230,27 +230,27 @@ void camel_header_mime_decode (const gchar *in, gint *maj, gint *min);
 
 #ifndef CAMEL_DISABLE_DEPRECATED
 /* do incremental base64/quoted-printable (de/en)coding */
-size_t camel_base64_decode_step (guchar *in, size_t len, guchar *out, gint *state, guint *save);
+gsize camel_base64_decode_step (guchar *in, gsize len, guchar *out, gint *state, guint *save);
 
-size_t camel_base64_encode_step (guchar *in, size_t inlen, gboolean break_lines, guchar *out, gint *state, gint *save);
-size_t camel_base64_encode_close (guchar *in, size_t inlen, gboolean break_lines, guchar *out, gint *state, gint *save);
+gsize camel_base64_encode_step (guchar *in, gsize inlen, gboolean break_lines, guchar *out, gint *state, gint *save);
+gsize camel_base64_encode_close (guchar *in, gsize inlen, gboolean break_lines, guchar *out, gint *state, gint *save);
 #endif
 
-size_t camel_uudecode_step (guchar *in, size_t inlen, guchar *out, gint *state, guint32 *save);
+gsize camel_uudecode_step (guchar *in, gsize inlen, guchar *out, gint *state, guint32 *save);
 
-size_t camel_uuencode_step (guchar *in, size_t len, guchar *out, guchar *uubuf, gint *state,
+gsize camel_uuencode_step (guchar *in, gsize len, guchar *out, guchar *uubuf, gint *state,
 		      guint32 *save);
-size_t camel_uuencode_close (guchar *in, size_t len, guchar *out, guchar *uubuf, gint *state,
+gsize camel_uuencode_close (guchar *in, gsize len, guchar *out, guchar *uubuf, gint *state,
 		       guint32 *save);
 
-size_t camel_quoted_decode_step (guchar *in, size_t len, guchar *out, gint *savestate, gint *saveme);
+gsize camel_quoted_decode_step (guchar *in, gsize len, guchar *out, gint *savestate, gint *saveme);
 
-size_t camel_quoted_encode_step (guchar *in, size_t len, guchar *out, gint *state, gint *save);
-size_t camel_quoted_encode_close (guchar *in, size_t len, guchar *out, gint *state, gint *save);
+gsize camel_quoted_encode_step (guchar *in, gsize len, guchar *out, gint *state, gint *save);
+gsize camel_quoted_encode_close (guchar *in, gsize len, guchar *out, gint *state, gint *save);
 
 #ifndef CAMEL_DISABLE_DEPRECATED
-gchar *camel_base64_encode_simple (const gchar *data, size_t len);
-size_t camel_base64_decode_simple (gchar *data, size_t len);
+gchar *camel_base64_encode_simple (const gchar *data, gsize len);
+gsize camel_base64_decode_simple (gchar *data, gsize len);
 #endif
 
 /* camel ctype type functions for rfc822/rfc2047/other, which are non-locale specific */
@@ -269,18 +269,18 @@ enum {
 
 extern unsigned short camel_mime_special_table[256];
 
-#define camel_mime_is_ctrl(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_CTRL) != 0)
-#define camel_mime_is_lwsp(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_LWSP) != 0)
-#define camel_mime_is_tspecial(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_TSPECIAL) != 0)
-#define camel_mime_is_type(x, t) ((camel_mime_special_table[(unsigned char)(x)] & (t)) != 0)
-#define camel_mime_is_ttoken(x) ((camel_mime_special_table[(unsigned char)(x)] & (CAMEL_MIME_IS_TSPECIAL|CAMEL_MIME_IS_LWSP|CAMEL_MIME_IS_CTRL)) == 0)
-#define camel_mime_is_atom(x) ((camel_mime_special_table[(unsigned char)(x)] & (CAMEL_MIME_IS_SPECIAL|CAMEL_MIME_IS_SPACE|CAMEL_MIME_IS_CTRL)) == 0)
-#define camel_mime_is_dtext(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_DSPECIAL) == 0)
-#define camel_mime_is_fieldname(x) ((camel_mime_special_table[(unsigned char)(x)] & (CAMEL_MIME_IS_CTRL|CAMEL_MIME_IS_SPACE)) == 0)
-#define camel_mime_is_qpsafe(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_QPSAFE) != 0)
-#define camel_mime_is_especial(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_ESPECIAL) != 0)
-#define camel_mime_is_psafe(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_PSAFE) != 0)
-#define camel_mime_is_attrchar(x) ((camel_mime_special_table[(unsigned char)(x)] & CAMEL_MIME_IS_ATTRCHAR) != 0)
+#define camel_mime_is_ctrl(x) ((camel_mime_special_table[(guchar)(x)] & CAMEL_MIME_IS_CTRL) != 0)
+#define camel_mime_is_lwsp(x) ((camel_mime_special_table[(guchar)(x)] & CAMEL_MIME_IS_LWSP) != 0)
+#define camel_mime_is_tspecial(x) ((camel_mime_special_table[(guchar)(x)] & CAMEL_MIME_IS_TSPECIAL) != 0)
+#define camel_mime_is_type(x, t) ((camel_mime_special_table[(guchar)(x)] & (t)) != 0)
+#define camel_mime_is_ttoken(x) ((camel_mime_special_table[(guchar)(x)] & (CAMEL_MIME_IS_TSPECIAL|CAMEL_MIME_IS_LWSP|CAMEL_MIME_IS_CTRL)) == 0)
+#define camel_mime_is_atom(x) ((camel_mime_special_table[(guchar)(x)] & (CAMEL_MIME_IS_SPECIAL|CAMEL_MIME_IS_SPACE|CAMEL_MIME_IS_CTRL)) == 0)
+#define camel_mime_is_dtext(x) ((camel_mime_special_table[(guchar)(x)] & CAMEL_MIME_IS_DSPECIAL) == 0)
+#define camel_mime_is_fieldname(x) ((camel_mime_special_table[(guchar)(x)] & (CAMEL_MIME_IS_CTRL|CAMEL_MIME_IS_SPACE)) == 0)
+#define camel_mime_is_qpsafe(x) ((camel_mime_special_table[(guchar)(x)] & CAMEL_MIME_IS_QPSAFE) != 0)
+#define camel_mime_is_especial(x) ((camel_mime_special_table[(guchar)(x)] & CAMEL_MIME_IS_ESPECIAL) != 0)
+#define camel_mime_is_psafe(x) ((camel_mime_special_table[(guchar)(x)] & CAMEL_MIME_IS_PSAFE) != 0)
+#define camel_mime_is_attrchar(x) ((camel_mime_special_table[(guchar)(x)] & CAMEL_MIME_IS_ATTRCHAR) != 0)
 
 G_END_DECLS
 
diff --git a/camel/camel-movemail.c b/camel/camel-movemail.c
index a713959..08cc888 100644
--- a/camel/camel-movemail.c
+++ b/camel/camel-movemail.c
@@ -61,7 +61,7 @@ static void movemail_external (const gchar *source, const gchar *dest,
 #endif
 
 #ifdef HAVE_BROKEN_SPOOL
-static gint camel_movemail_copy_filter(gint fromfd, gint tofd, off_t start, size_t bytes, CamelMimeFilter *filter);
+static gint camel_movemail_copy_filter(gint fromfd, gint tofd, off_t start, gsize bytes, CamelMimeFilter *filter);
 static gint camel_movemail_solaris (gint oldsfd, gint dfd, CamelException *ex);
 #else
 /* these could probably be exposed as a utility? (but only mbox needs it) */
@@ -69,7 +69,7 @@ static gint camel_movemail_copy_file(gint sfd, gint dfd, CamelException *ex);
 #endif
 
 #if 0
-static gint camel_movemail_copy(gint fromfd, gint tofd, off_t start, size_t bytes);
+static gint camel_movemail_copy(gint fromfd, gint tofd, off_t start, gsize bytes);
 #endif
 
 /**
@@ -241,7 +241,7 @@ movemail_external (const gchar *source, const gchar *dest, CamelException *ex)
 #endif
 
 #ifndef HAVE_BROKEN_SPOOL
-static int
+static gint
 camel_movemail_copy_file(gint sfd, gint dfd, CamelException *ex)
 {
 	gint nread, nwrote;
@@ -282,8 +282,8 @@ camel_movemail_copy_file(gint sfd, gint dfd, CamelException *ex)
 #endif
 
 #if 0
-static int
-camel_movemail_copy(gint fromfd, gint tofd, off_t start, size_t bytes)
+static gint
+camel_movemail_copy(gint fromfd, gint tofd, off_t start, gsize bytes)
 {
         gchar buffer[4096];
         gint written = 0;
@@ -334,8 +334,8 @@ camel_movemail_copy(gint fromfd, gint tofd, off_t start, size_t bytes)
 #define PRE_SIZE (32)
 
 #ifdef HAVE_BROKEN_SPOOL
-static int
-camel_movemail_copy_filter(gint fromfd, gint tofd, off_t start, size_t bytes, CamelMimeFilter *filter)
+static gint
+camel_movemail_copy_filter(gint fromfd, gint tofd, off_t start, gsize bytes, CamelMimeFilter *filter)
 {
         gchar buffer[4096+PRE_SIZE];
         gint written = 0;
@@ -400,7 +400,7 @@ camel_movemail_copy_filter(gint fromfd, gint tofd, off_t start, size_t bytes, Ca
 
 /* write the headers back out again, but not he Content-Length header, because we dont
    want	to maintain it! */
-static int
+static gint
 solaris_header_write(gint fd, struct _camel_header_raw *header)
 {
         struct iovec iv[4];
@@ -446,7 +446,7 @@ solaris_header_write(gint fd, struct _camel_header_raw *header)
 /* Well, since Solaris is a tad broken wrt its 'mbox' folder format,
    we must convert it to a real mbox format.  Thankfully this is
    mostly pretty easy */
-static int
+static gint
 camel_movemail_solaris (gint oldsfd, gint dfd, CamelException *ex)
 {
 	CamelMimeParser *mp;
@@ -495,7 +495,7 @@ camel_movemail_solaris (gint oldsfd, gint dfd, CamelException *ex)
 
 			cl = camel_mime_parser_header(mp, "content-length", NULL);
 			if (cl == NULL) {
-				g_warning("Required Content-Length header is missing from solaris mail box @ %d", (int)camel_mime_parser_tell(mp));
+				g_warning("Required Content-Length header is missing from solaris mail box @ %d", (gint)camel_mime_parser_tell(mp));
 				camel_mime_parser_drop_step(mp);
 				camel_mime_parser_drop_step(mp);
 				camel_mime_parser_step(mp, &buffer, &len);
diff --git a/camel/camel-msgport.c b/camel/camel-msgport.c
index 96cdf15..1bca3c7 100644
--- a/camel/camel-msgport.c
+++ b/camel/camel-msgport.c
@@ -64,7 +64,7 @@ struct _CamelMsgPort {
 #endif
 };
 
-static int
+static gint
 msgport_pipe (gint *fds)
 {
 #ifndef G_OS_WIN32
@@ -195,7 +195,7 @@ out0:
 }
 
 #ifdef HAVE_NSS
-static int
+static gint
 msgport_prpipe (PRFileDesc **fds)
 {
 #ifdef G_OS_WIN32
diff --git a/camel/camel-multipart-signed.c b/camel/camel-multipart-signed.c
index 99419b9..a87ffb2 100644
--- a/camel/camel-multipart-signed.c
+++ b/camel/camel-multipart-signed.c
@@ -59,7 +59,7 @@ static CamelMimePart *signed_remove_part_at (CamelMultipart *multipart, guint in
 static CamelMimePart *signed_get_part (CamelMultipart *multipart, guint index);
 static guint signed_get_number (CamelMultipart *multipart);
 
-static ssize_t write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
+static gssize write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
 static void set_mime_type_field (CamelDataWrapper *data_wrapper, CamelContentType *mime_type);
 static gint construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
 static gint signed_construct_from_parser (CamelMultipart *multipart, struct _CamelMimeParser *mp);
@@ -180,11 +180,11 @@ camel_multipart_signed_new (void)
 	return multipart;
 }
 
-static int
+static gint
 skip_content(CamelMimeParser *cmp)
 {
 	gchar *buf;
-	size_t len;
+	gsize len;
 	gint state;
 
 	switch (camel_mime_parser_state(cmp)) {
@@ -224,7 +224,7 @@ skip_content(CamelMimeParser *cmp)
 	return 0;
 }
 
-static int
+static gint
 parse_content(CamelMultipartSigned *mps)
 {
 	CamelMimeParser *cmp;
@@ -232,7 +232,7 @@ parse_content(CamelMultipartSigned *mps)
 	CamelStreamMem *mem;
 	const gchar *boundary;
 	gchar *buf;
-	size_t len;
+	gsize len;
 	gint state;
 
 	boundary = camel_multipart_get_boundary(mp);
@@ -441,7 +441,7 @@ set_stream(CamelMultipartSigned *mps, CamelStream *mem)
 	}
 }
 
-static int
+static gint
 construct_from_stream(CamelDataWrapper *data_wrapper, CamelStream *stream)
 {
 	CamelMultipartSigned *mps = (CamelMultipartSigned *)data_wrapper;
@@ -455,14 +455,14 @@ construct_from_stream(CamelDataWrapper *data_wrapper, CamelStream *stream)
 	return 0;
 }
 
-static int
+static gint
 signed_construct_from_parser(CamelMultipart *multipart, struct _CamelMimeParser *mp)
 {
 	gint err;
 	CamelContentType *content_type;
 	CamelMultipartSigned *mps = (CamelMultipartSigned *)multipart;
 	gchar *buf;
-	size_t len;
+	gsize len;
 	CamelStream *mem;
 
 	/* we *must not* be in multipart state, otherwise the mime parser will
@@ -487,14 +487,14 @@ signed_construct_from_parser(CamelMultipart *multipart, struct _CamelMimeParser
 		return 0;
 }
 
-static ssize_t
+static gssize
 write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
 {
 	CamelMultipartSigned *mps = (CamelMultipartSigned *)data_wrapper;
 	CamelMultipart *mp = (CamelMultipart *)mps;
 	const gchar *boundary;
-	ssize_t total = 0;
-	ssize_t count;
+	gssize total = 0;
+	gssize count;
 
 	/* we have 3 basic cases:
 	   1. constructed, we write out the data wrapper stream we got
diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c
index 3ed7d7b..f75ff92 100644
--- a/camel/camel-multipart.c
+++ b/camel/camel-multipart.c
@@ -54,7 +54,7 @@ static guint                 get_number        (CamelMultipart *multipart);
 static void                  set_boundary      (CamelMultipart *multipart,
 						const gchar *boundary);
 static const gchar *         get_boundary      (CamelMultipart *multipart);
-static ssize_t               write_to_stream   (CamelDataWrapper *data_wrapper,
+static gssize               write_to_stream   (CamelDataWrapper *data_wrapper,
 						CamelStream *stream);
 
 static gint construct_from_parser(CamelMultipart *multipart, struct _CamelMimeParser *mp);
@@ -363,8 +363,8 @@ set_boundary (CamelMultipart *multipart, const gchar *boundary)
 
 		/* Generate a fairly random boundary string. */
 		bgen = g_strdup_printf ("%p:%lu:%lu", (gpointer) multipart,
-					(unsigned long) getpid(),
-					(unsigned long) time(NULL));
+					(gulong) getpid(),
+					(gulong) time(NULL));
 
 		checksum = g_checksum_new (G_CHECKSUM_MD5);
 		g_checksum_update (checksum, (guchar *) bgen, -1);
@@ -444,13 +444,13 @@ is_offline (CamelDataWrapper *data_wrapper)
 }
 
 /* this is MIME specific, doesn't belong here really */
-static ssize_t
+static gssize
 write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
 {
 	CamelMultipart *multipart = CAMEL_MULTIPART (data_wrapper);
 	const gchar *boundary;
-	ssize_t total = 0;
-	ssize_t count;
+	gssize total = 0;
+	gssize count;
 	GList *node;
 
 	/* get the bundary text */
@@ -550,14 +550,14 @@ camel_multipart_set_postface(CamelMultipart *multipart, const gchar *postface)
 	}
 }
 
-static int
+static gint
 construct_from_parser(CamelMultipart *multipart, struct _CamelMimeParser *mp)
 {
 	gint err;
 	CamelContentType *content_type;
 	CamelMimePart *bodypart;
 	gchar *buf;
-	size_t len;
+	gsize len;
 
 	g_assert(camel_mime_parser_state(mp) == CAMEL_MIME_PARSER_STATE_MULTIPART);
 
diff --git a/camel/camel-multipart.h b/camel/camel-multipart.h
index 4af66e8..cec7ba9 100644
--- a/camel/camel-multipart.h
+++ b/camel/camel-multipart.h
@@ -90,7 +90,7 @@ const gchar *        camel_multipart_get_boundary   (CamelMultipart *multipart);
 void		    camel_multipart_set_preface	   (CamelMultipart *multipart, const gchar *preface);
 void		    camel_multipart_set_postface   (CamelMultipart *multipart, const gchar *postface);
 
-int		    camel_multipart_construct_from_parser(CamelMultipart *multipart, struct _CamelMimeParser *parser);
+gint		    camel_multipart_construct_from_parser(CamelMultipart *multipart, struct _CamelMimeParser *parser);
 
 G_END_DECLS
 
diff --git a/camel/camel-net-utils.c b/camel/camel-net-utils.c
index 208e2b2..baba063 100644
--- a/camel/camel-net-utils.c
+++ b/camel/camel-net-utils.c
@@ -165,7 +165,7 @@ G_LOCK_DEFINE_STATIC (gethost_mutex);
 /* some helpful utils for IPv6 lookups */
 #define IPv6_BUFLEN_MIN  (sizeof (gchar *) * 3)
 
-static int
+static gint
 ai_to_herr (gint error)
 {
 	switch (error) {
@@ -199,9 +199,9 @@ ai_to_herr (gint error)
 
 #endif /* ENABLE_IPv6 */
 
-static int
+static gint
 camel_gethostbyname_r (const gchar *name, struct hostent *host,
-		       gchar *buf, size_t buflen, gint *herr)
+		       gchar *buf, gsize buflen, gint *herr)
 {
 #ifdef ENABLE_IPv6
 	struct addrinfo hints, *res;
@@ -310,9 +310,9 @@ camel_gethostbyname_r (const gchar *name, struct hostent *host,
 #endif /* ENABLE_IPv6 */
 }
 
-static int
+static gint
 camel_gethostbyaddr_r (const gchar *addr, gint addrlen, gint type, struct hostent *host,
-		       gchar *buf, size_t buflen, gint *herr)
+		       gchar *buf, gsize buflen, gint *herr)
 {
 #ifdef ENABLE_IPv6
 	gint retval, len;
@@ -441,7 +441,7 @@ cs_freeinfo(struct _addrinfo_msg *msg)
 }
 
 /* returns -1 if we didn't wait for reply from thread */
-static int
+static gint
 cs_waitinfo(gpointer (worker)(gpointer), struct _addrinfo_msg *msg, const gchar *error, CamelException *ex)
 {
 	CamelMsgPort *reply_port;
diff --git a/camel/camel-net-utils.h b/camel/camel-net-utils.h
index 8e02069..10e8719 100644
--- a/camel/camel-net-utils.h
+++ b/camel/camel-net-utils.h
@@ -56,7 +56,7 @@ struct addrinfo {
 	gint ai_family;
 	gint ai_socktype;
 	gint ai_protocol;
-	size_t ai_addrlen;
+	gsize ai_addrlen;
 	struct sockaddr *ai_addr;
 	gchar *ai_canonname;
 	struct addrinfo *ai_next;
diff --git a/camel/camel-nntp-address.c b/camel/camel-nntp-address.c
index 366d202..7f489d6 100644
--- a/camel/camel-nntp-address.c
+++ b/camel/camel-nntp-address.c
@@ -80,7 +80,7 @@ camel_nntp_address_get_type(void)
 }
 
 /* since newsgropus are 7bit ascii, decode/unformat are the same */
-static int
+static gint
 nntp_decode(CamelAddress *a, const gchar *raw)
 {
 	struct _camel_header_newsgroup *ha, *n;
@@ -122,7 +122,7 @@ nntp_encode(CamelAddress *a)
 	return ret;
 }
 
-static int
+static gint
 nntp_cat (CamelAddress *dest, const CamelAddress *source)
 {
 	gint i;
diff --git a/camel/camel-nntp-address.h b/camel/camel-nntp-address.h
index e6b022b..2dde5d8 100644
--- a/camel/camel-nntp-address.h
+++ b/camel/camel-nntp-address.h
@@ -46,7 +46,7 @@ struct _CamelNNTPAddressClass {
 CamelType		camel_nntp_address_get_type	(void);
 CamelNNTPAddress   *camel_nntp_address_new	(void);
 
-int			camel_nntp_address_add	(CamelNNTPAddress *a, const gchar *name);
+gint			camel_nntp_address_add	(CamelNNTPAddress *a, const gchar *name);
 gboolean		camel_nntp_address_get	(const CamelNNTPAddress *a, gint index, const gchar **namep);
 
 G_END_DECLS
diff --git a/camel/camel-object.c b/camel/camel-object.c
index c14264d..9c82514 100644
--- a/camel/camel-object.c
+++ b/camel/camel-object.c
@@ -231,7 +231,7 @@ cobject_finalise(CamelObject *o)
 	o->klass = NULL;
 }
 
-static int
+static gint
 cobject_getv(CamelObject *o, CamelException *ex, CamelArgGetV *args)
 {
 	gint i;
@@ -264,7 +264,7 @@ cobject_getv(CamelObject *o, CamelException *ex, CamelArgGetV *args)
 	return 0;
 }
 
-static int
+static gint
 cobject_setv(CamelObject *o, CamelException *ex, CamelArgV *args)
 {
 	gint i;
@@ -401,7 +401,7 @@ done:
 
 */
 
-static int
+static gint
 cobject_state_read(CamelObject *obj, FILE *fp)
 {
 	guint32 i, count, version;
@@ -483,7 +483,7 @@ cobject_state_read(CamelObject *obj, FILE *fp)
 }
 
 /* TODO: should pass exception around */
-static int
+static gint
 cobject_state_write(CamelObject *obj, FILE *fp)
 {
 	gint32 count, i;
@@ -617,20 +617,19 @@ cobject_class_finalise(CamelObjectClass * klass)
 
 /* CamelInterface base methods */
 
-static void
+G_GNUC_NORETURN static void
 cinterface_init(CamelObject *o, CamelObjectClass *klass)
 {
 	g_error("Cannot instantiate interfaces, trying to instantiate '%s'", klass->name);
-	abort();
 }
 
-static int
+static gint
 cinterface_getv(CamelObject *o, CamelException *ex, CamelArgGetV *args)
 {
 	return 0;
 }
 
-static int
+static gint
 cinterface_setv(CamelObject *o, CamelException *ex, CamelArgV *args)
 {
 	return 0;
@@ -701,7 +700,7 @@ camel_type_class_init(CamelObjectClass *klass, CamelObjectClass *type)
 static CamelType
 co_type_register(CamelType parent, const gchar * name,
 		 /*guint ver, guint rev,*/
-		 size_t object_size, size_t klass_size,
+		 gsize object_size, gsize klass_size,
 		 CamelObjectClassInitFunc class_init,
 		 CamelObjectClassFinalizeFunc class_finalise,
 		 CamelObjectInitFunc object_init,
@@ -709,7 +708,7 @@ co_type_register(CamelType parent, const gchar * name,
 {
 	CamelObjectClass *klass;
 	/*int offset;
-	  size_t size;*/
+	  gsize size;*/
 
 	TYPE_LOCK();
 
@@ -787,7 +786,7 @@ co_type_register(CamelType parent, const gchar * name,
 CamelType
 camel_type_register(CamelType parent, const gchar * name,
 		    /*guint ver, guint rev,*/
-		    size_t object_size, size_t klass_size,
+		    gsize object_size, gsize klass_size,
 		    CamelObjectClassInitFunc class_init,
 		    CamelObjectClassFinalizeFunc class_finalise,
 		    CamelObjectInitFunc object_init,
@@ -803,7 +802,7 @@ camel_type_register(CamelType parent, const gchar * name,
 
 CamelType
 camel_interface_register(CamelType parent, const gchar *name,
-			 size_t class_size,
+			 gsize class_size,
 			 CamelObjectClassInitFunc class_init,
 			 CamelObjectClassFinalizeFunc class_finalise)
 {
@@ -1279,7 +1278,7 @@ camel_object_get_hooks(CamelObject *o)
 	return o->hooks;
 }
 
-unsigned int
+guint
 camel_object_hook_event(gpointer vo, const gchar * name, CamelObjectEventHookFunc func, gpointer data)
 {
 	CamelObject *obj = vo;
@@ -2368,7 +2367,7 @@ camel_object_bag_remove(CamelObjectBag *inbag, gpointer vo)
 
 /* ********************************************************************** */
 
-gpointer camel_iterator_new(CamelIteratorVTable *klass, size_t size)
+gpointer camel_iterator_new(CamelIteratorVTable *klass, gsize size)
 {
 	CamelIterator *it;
 
diff --git a/camel/camel-object.h b/camel/camel-object.h
index 1c8d58a..4b2216b 100644
--- a/camel/camel-object.h
+++ b/camel/camel-object.h
@@ -27,7 +27,7 @@
 
 #include <glib.h>
 #include <stdio.h>		/* FILE */
-#include <stdlib.h>		/* size_t */
+#include <stdlib.h>		/* gsize */
 #include <stdarg.h>
 #include <pthread.h>
 
@@ -197,8 +197,8 @@ struct _CamelInterface {
 /* The type system .... it's pretty simple..... */
 void camel_type_init (void);
 CamelType camel_type_register(CamelType parent, const gchar * name, /*guint ver, guint rev,*/
-			      size_t instance_size,
-			      size_t classfuncs_size,
+			      gsize instance_size,
+			      gsize classfuncs_size,
 			      CamelObjectClassInitFunc class_init,
 			      CamelObjectClassFinalizeFunc  class_finalize,
 			      CamelObjectInitFunc instance_init,
@@ -206,7 +206,7 @@ CamelType camel_type_register(CamelType parent, const gchar * name, /*guint ver,
 
 #ifndef CAMEL_DISABLE_DEPRECATED
 CamelType camel_interface_register(CamelType parent, const gchar *name,
-				   size_t classfuncs_size,
+				   gsize classfuncs_size,
 				   CamelObjectClassInitFunc class_init,
 				   CamelObjectClassFinalizeFunc class_finalize);
 #endif /* CAMEL_DISABLE_DEPRECATED */
@@ -339,7 +339,7 @@ struct _CamelIterator {
 	/* subclasses adds new fields afterwards */
 };
 
-gpointer camel_iterator_new(CamelIteratorVTable *klass, size_t size);
+gpointer camel_iterator_new(CamelIteratorVTable *klass, gsize size);
 void camel_iterator_free(gpointer it);
 gconstpointer camel_iterator_next(gpointer it, CamelException *ex);
 void camel_iterator_reset(gpointer it);
diff --git a/camel/camel-offline-folder.c b/camel/camel-offline-folder.c
index c1cffd5..ad27750 100644
--- a/camel/camel-offline-folder.c
+++ b/camel/camel-offline-folder.c
@@ -173,7 +173,7 @@ camel_offline_folder_finalize (CamelObject *object)
 	;
 }
 
-static int
+static gint
 offline_folder_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	CamelArgGetV props;
@@ -210,7 +210,7 @@ offline_folder_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args
 	return 0;
 }
 
-static int
+static gint
 offline_folder_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
 {
 	CamelOfflineFolder *folder = (CamelOfflineFolder *) object;
diff --git a/camel/camel-operation.c b/camel/camel-operation.c
index d64abfe..c21e4f0 100644
--- a/camel/camel-operation.c
+++ b/camel/camel-operation.c
@@ -92,7 +92,7 @@ static pthread_once_t operation_once = PTHREAD_ONCE_INIT;
 
 typedef struct _CamelOperationMsg {
 	CamelMsg msg;
-} CamelOperationMsg ;
+} CamelOperationMsg;
 
 static void
 co_createspecific(void)
diff --git a/camel/camel-partition-table.c b/camel/camel-partition-table.c
index 1215323..5292ae7 100644
--- a/camel/camel-partition-table.c
+++ b/camel/camel-partition-table.c
@@ -360,7 +360,7 @@ void camel_partition_table_remove(CamelPartitionTable *cpi, const gchar *key)
 	camel_block_file_unref_block(cpi->blocks, block);
 }
 
-static int
+static gint
 keys_cmp(gconstpointer ap, gconstpointer bp)
 {
 	const CamelPartitionKey *a = ap;
@@ -839,7 +839,7 @@ camel_key_table_set_flags(CamelKeyTable *ki, camel_key_t keyid, guint flags, gui
 #else
 	if (kb->used >=127 || index >= kb->used) {
 		g_warning("Block %x: Invalid index or content: index %d used %d\n", blockid, index, kb->used);
-		return ;
+		return;
 	}
 #endif
 
diff --git a/camel/camel-provider.c b/camel/camel-provider.c
index 4e96c95..4af72ee 100644
--- a/camel/camel-provider.c
+++ b/camel/camel-provider.c
@@ -260,7 +260,9 @@ camel_provider_register(CamelProvider *provider)
 		l = l->next;
 	}
 
-	g_hash_table_insert(provider_table, provider->protocol, provider);
+	g_hash_table_insert (
+		provider_table,
+		(gpointer) provider->protocol, provider);
 
 	UNLOCK();
 }
@@ -347,7 +349,7 @@ camel_provider_get(const gchar *url_string, CamelException *ex)
 {
 	CamelProvider *provider = NULL;
 	gchar *protocol;
-	size_t len;
+	gsize len;
 
 	g_return_val_if_fail (url_string != NULL, NULL);
 	g_return_val_if_fail (provider_table != NULL, NULL);
diff --git a/camel/camel-provider.h b/camel/camel-provider.h
index 67f17d7..46c352c 100644
--- a/camel/camel-provider.h
+++ b/camel/camel-provider.h
@@ -135,8 +135,8 @@ typedef enum {
 
 typedef struct {
 	CamelProviderConfType type;
-	gchar *name, *depname;
-	gchar *text, *value;
+	const gchar *name, *depname;
+	const gchar *text, *value;
 } CamelProviderConfEntry;
 
 /* Some defaults */
@@ -148,10 +148,10 @@ typedef gint (*CamelProviderAutoDetectFunc) (CamelURL *url, GHashTable **auto_de
 
 typedef struct {
 	/* Provider name used in CamelURLs. */
-	gchar *protocol;
+	const gchar *protocol;
 
 	/* Provider name as used by people. (May be the same as protocol) */
-	gchar *name;
+	const gchar *name;
 
 	/* Description of the provider. A novice user should be able
 	 * to read this description, and the information provided by
@@ -159,13 +159,13 @@ typedef struct {
 	 * this provider is relevant to him, and if so, which
 	 * information goes with it.
 	 */
-	gchar *description;
+	const gchar *description;
 
 	/* The category of message that this provider works with.
 	 * (evolution-mail will only list a provider in the store/transport
 	 * config dialogs if its domain is "mail".)
 	 */
-	gchar *domain;
+	const gchar *domain;
 
 	/* Flags describing the provider, flags describing its URLs */
 	gint flags, url_flags;
@@ -197,7 +197,7 @@ typedef struct {
 	/* gettext translation domain (NULL for providers in the
 	 * evolution source tree).
 	 */
-	gchar *translation_domain;
+	const gchar *translation_domain;
 
 	/* This string points to the provider's gconf key value
 	 */
diff --git a/camel/camel-sasl-digest-md5.c b/camel/camel-sasl-digest-md5.c
index cdd22a6..b6f3ade 100644
--- a/camel/camel-sasl-digest-md5.c
+++ b/camel/camel-sasl-digest-md5.c
@@ -67,7 +67,7 @@ enum {
 };
 
 typedef struct {
-	gchar *name;
+	const gchar *name;
 	guint type;
 } DataType;
 
@@ -670,8 +670,8 @@ generate_response (struct _DigestChallenge *challenge, const gchar *host,
 
 	/* generate the cnonce */
 	bgen = g_strdup_printf ("%p:%lu:%lu", (gpointer) resp,
-				(unsigned long) getpid (),
-				(unsigned long) time (NULL));
+				(gulong) getpid (),
+				(gulong) time (NULL));
 	checksum = g_checksum_new (G_CHECKSUM_MD5);
 	g_checksum_update (checksum, (guchar *) bgen, -1);
 	g_checksum_get_digest (checksum, digest, &length);
@@ -731,7 +731,7 @@ digest_response (struct _DigestResponse *resp)
 		/* Encode the username using the requested charset */
 		gchar *username, *outbuf;
 		const gchar *charset;
-		size_t len, outlen;
+		gsize len, outlen;
 		const gchar *inbuf;
 		iconv_t cd;
 
@@ -746,7 +746,7 @@ digest_response (struct _DigestResponse *resp)
 
 		outbuf = username = g_malloc0 (outlen + 1);
 		inbuf = resp->username;
-		if (cd == (iconv_t) -1 || camel_iconv (cd, &inbuf, &len, &outbuf, &outlen) == (size_t) -1) {
+		if (cd == (iconv_t) -1 || camel_iconv (cd, &inbuf, &len, &outbuf, &outlen) == (gsize) -1) {
 			/* We can't convert to UTF-8 - pretend we never got a charset param? */
 			g_free (resp->charset);
 			resp->charset = NULL;
diff --git a/camel/camel-sasl-ntlm.c b/camel/camel-sasl-ntlm.c
index 060da3e..79c70af 100644
--- a/camel/camel-sasl-ntlm.c
+++ b/camel/camel-sasl-ntlm.c
@@ -201,7 +201,7 @@ static void md4sum                (const guchar *in,
 /* DES */
 typedef guint32 DES_KS[16][2]; /* Single-key DES key schedule */
 
-static void deskey                (DES_KS, guchar *, int);
+static void deskey                (DES_KS, guchar *, gint);
 
 static void des                   (DES_KS, guchar *);
 
@@ -221,7 +221,7 @@ ntlm_lanmanager_hash (const gchar *password, gchar hash[21])
 	gint i;
 
 	for (i = 0; i < 14 && password [i]; i++)
-		lm_password [i] = toupper ((unsigned char) password [i]);
+		lm_password [i] = toupper ((guchar) password [i]);
 
 	for (; i < 15; i++)
 		lm_password [i] = '\0';
diff --git a/camel/camel-search-private.c b/camel/camel-search-private.c
index 7b60f30..d007d36 100644
--- a/camel/camel-search-private.c
+++ b/camel/camel-search-private.c
@@ -295,7 +295,7 @@ camel_ustrstrcase (const gchar *haystack, const gchar *needle)
 		return 1;                              \
 } G_STMT_END
 
-static int
+static gint
 camel_ustrcasecmp (const gchar *ps1, const gchar *ps2)
 {
 	gunichar u1, u2 = 0;
@@ -327,8 +327,8 @@ camel_ustrcasecmp (const gchar *ps1, const gchar *ps2)
 	return 0;
 }
 
-static int
-camel_ustrncasecmp (const gchar *ps1, const gchar *ps2, size_t len)
+static gint
+camel_ustrncasecmp (const gchar *ps1, const gchar *ps2, gsize len)
 {
 	gunichar u1, u2 = 0;
 	const guchar *s1 = (const guchar *)ps1;
@@ -364,7 +364,7 @@ camel_ustrncasecmp (const gchar *ps1, const gchar *ps2, size_t len)
 }
 
 /* value is the match value suitable for exact match if required */
-static int
+static gint
 header_match(const gchar *value, const gchar *match, camel_search_match_t how)
 {
 	const guchar *p;
diff --git a/camel/camel-search-sql-sexp.c b/camel/camel-search-sql-sexp.c
index d50a48a..7d3cc7a 100644
--- a/camel/camel-search-sql-sexp.c
+++ b/camel/camel-search-sql-sexp.c
@@ -560,7 +560,7 @@ sql_exp (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
 
 /* 'builtin' functions */
 static struct {
-	gchar *name;
+	const gchar *name;
 	ESExpFunc *func;
 	gint immediate :1;
 } symbols[] = {
@@ -605,7 +605,7 @@ camel_sexp_to_sql_sexp (const gchar *sql)
 	for(i=0;i<sizeof(symbols)/sizeof(symbols[0]);i++) {
 		if (symbols[i].immediate)
 			e_sexp_add_ifunction(sexp, 0, symbols[i].name,
-					    symbols[i].func, NULL);
+					     (ESExpIFunc *) symbols[i].func, NULL);
 		else
 			e_sexp_add_function(sexp, 0, symbols[i].name,
 					    symbols[i].func, NULL);
diff --git a/camel/camel-search-sql.c b/camel/camel-search-sql.c
index a818d49..083f870 100644
--- a/camel/camel-search-sql.c
+++ b/camel/camel-search-sql.c
@@ -59,30 +59,30 @@ gchar * escape_values (gchar *str);
 
 static GScannerConfig config =
         {
-                (
+                ((gchar *)
                         " \t\n\r"
-                        )                       /* cset_skip_characters */,
-                (
+                        )               /* cset_skip_characters */,
+                ((gchar *)
                         G_CSET_a_2_z
                         G_CSET_A_2_Z
-                        )                       /* cset_identifier_first */,
-                (
+                        )               /* cset_identifier_first */,
+                ((gchar *)
                         G_CSET_a_2_z
                         "_-0123456789"
                         G_CSET_A_2_Z
-                        )                       /* cset_identifier_nth */,
-                ( "" )               /* cpair_comment_single */,
-                FALSE                    /* case_sensitive */,
+                        )               /* cset_identifier_nth */,
+                ((gchar *) "" )         /* cpair_comment_single */,
+                FALSE                   /* case_sensitive */,
                 TRUE                    /* skip_comment_multi */,
                 TRUE                    /* skip_comment_single */,
                 TRUE                    /* scan_comment_multi */,
                 TRUE                    /* scan_identifier */,
                 TRUE                    /* scan_identifier_1char */,
                 FALSE                   /* scan_identifier_NULL */,
-                TRUE                   /* scan_symbols */,
+                TRUE                    /* scan_symbols */,
                 FALSE                   /* scan_binary */,
                 FALSE                   /* scan_octal */,
-                FALSE                    /* scan_float */,
+                FALSE                   /* scan_float */,
                 FALSE                   /* scan_hex */,
                 FALSE                   /* scan_hex_dollar */,
                 TRUE                    /* scan_string_sq */,
@@ -103,8 +103,8 @@ typedef struct Node {
 	gchar post_token; /* post token to apppend with substitute */
 	gchar rval; /* rhs value for binary ops */
 	gint level; /* depth in the hier */
-	gint prefix:1 ; /* unary operator to be searched ?*/
-	gint sys_node:1 ; /* is it a predefined term ? */
+	gint prefix:1; /* unary operator to be searched ?*/
+	gint sys_node:1; /* is it a predefined term ? */
 	gint ignore_lhs:1; /* ignore lhs value ?*/
 	gint swap :1;
 	gint prenode :1;
@@ -133,20 +133,20 @@ typedef struct Node {
  * */
 
 /* Configuration of your sexp expression */
-static Node elements[] =  { {"header-contains", "LIKE", 3, '%', '%', 0, 0, 0 , 1, 0, 0, 0, 0, 0},
-			    {"system-flag", "=", 2, ' ', ' ', '1', 0, 1, 1, 0, 0, 0, 0, 0},
-			    {"match-all", "", 0, ' ', ' ', 0, 0, 0, 1, 0, 0, 0, 0, 0},
-			    {"cast-int", "", 0, ' ', ' ', 0, 0, 0, 1, 0, 0, 0, 0, 0},
-			    { "header-matches", "LIKE", 3, '%', '%', 0, 0, 1, 1, 0, 0, 0, 0, 0},
-			    { "header-ends-with", "LIKE", 3, '%', ' ', 0, 0, 0, 1, 0, 0, 0, 0, 0},
-			    { "header-exists", "NOTNULL", 2, ' ', ' ', ' ', 0, 0, 1, 0, 0, 0, 0, 0},
-			    { "user-tag", "usertags", 3, '%', '%', 0, 0, 1, 1, 1, 0, 0, 0, 0},
-			    { "user-flag", "labels LIKE", 2, '%', '%', 0, 0, 0, 1, 0, 1, 0, 0, 0},
-			    { "header-starts-with", "LIKE", 3, ' ', '%', 0, 0, 0, 1, 0, 0, 0, 0, 0},
-			    { "get-sent-date", "dsent", 2, ' ', ' ', 0, 0, 1, 1, 0, 0, 0, 0, 1, 0 },
-			    { "get-received-date", "dreceived", 2, ' ', ' ', 0, 0, 1, 1, 0, 0, 0, 0, 1, 0 },
-			    { "get-size", "size", 2, ' ', ' ', ' ', 0, 1, 1, 0, 0, 0, 0, 1},
-			    {"match-threads", "", 0, ' ', ' ', 0, 0, 0, 1, 0, 0, 0, 0, 0},
+static Node elements[] =  { { (gchar *) "header-contains", (gchar *) "LIKE", 3, '%', '%', 0, 0, 0 , 1, 0, 0, 0, 0, 0},
+			    { (gchar *) "system-flag", (gchar *) "=", 2, ' ', ' ', '1', 0, 1, 1, 0, 0, 0, 0, 0},
+			    { (gchar *) "match-all", (gchar *) "", 0, ' ', ' ', 0, 0, 0, 1, 0, 0, 0, 0, 0},
+			    { (gchar *) "cast-int", (gchar *) "", 0, ' ', ' ', 0, 0, 0, 1, 0, 0, 0, 0, 0},
+			    { (gchar *) "header-matches", (gchar *) "LIKE", 3, '%', '%', 0, 0, 1, 1, 0, 0, 0, 0, 0},
+			    { (gchar *) "header-ends-with", (gchar *) "LIKE", 3, '%', ' ', 0, 0, 0, 1, 0, 0, 0, 0, 0},
+			    { (gchar *) "header-exists", (gchar *) "NOTNULL", 2, ' ', ' ', ' ', 0, 0, 1, 0, 0, 0, 0, 0},
+			    { (gchar *) "user-tag", (gchar *) "usertags", 3, '%', '%', 0, 0, 1, 1, 1, 0, 0, 0, 0},
+			    { (gchar *) "user-flag", (gchar *) "labels LIKE", 2, '%', '%', 0, 0, 0, 1, 0, 1, 0, 0, 0},
+			    { (gchar *) "header-starts-with", (gchar *) "LIKE", 3, ' ', '%', 0, 0, 0, 1, 0, 0, 0, 0, 0},
+			    { (gchar *) "get-sent-date", (gchar *) "dsent", 2, ' ', ' ', 0, 0, 1, 1, 0, 0, 0, 0, 1, 0 },
+			    { (gchar *) "get-received-date", (gchar *) "dreceived", 2, ' ', ' ', 0, 0, 1, 1, 0, 0, 0, 0, 1, 0 },
+			    { (gchar *) "get-size", (gchar *) "size", 2, ' ', ' ', ' ', 0, 1, 1, 0, 0, 0, 0, 1},
+			    { (gchar *) "match-threads", (gchar *) "", 0, ' ', ' ', 0, 0, 0, 1, 0, 0, 0, 0, 0},
 };
 #if 0
 	{ "get-sent-date", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, get_sent_date), 1 },
@@ -171,15 +171,7 @@ free_node (Node *node)
 	g_free (node);
 }
 
-static void
-g_list_dump (GList *l)
-{
-	while (l) {
-		 printf("%s\t", (gchar *)l->data);
-		l = l->next;
-	}
-}
-
+#if 0
 static void
 g_node_dump (GList *l)
 {
@@ -191,8 +183,8 @@ g_node_dump (GList *l)
 		l = l->next;
 	}
 	printf("\n");
-
 }
+#endif
 
 gchar *
 escape_values (gchar *str)
@@ -365,7 +357,7 @@ camel_sexp_to_sql (const gchar *txt)
 
 			if (g_ascii_strcasecmp (pnode->token, "user-flag") == 0) {
 				    /* Colloct all after '+' and append them to one token. Go till you find ')' */
-				    token = g_scanner_get_next_token (scanner) ;
+				    token = g_scanner_get_next_token (scanner);
 				    while (token != G_TOKEN_RIGHT_PAREN) {
 					    astr = g_strdup_printf ("%s%s", bstr?bstr:"", scanner->value.v_string);
 					    g_free (bstr); bstr = astr;
@@ -375,8 +367,8 @@ camel_sexp_to_sql (const gchar *txt)
 			} else {
 				/* should be the date fns*/
 			/* Colloct all after '+' and append them to one token. Go till you find ')' */
-				token = g_scanner_get_next_token (scanner) ;
-				while (token >= 0 && !g_scanner_eof(scanner) && lvl >=0 ) {
+				token = g_scanner_get_next_token (scanner);
+				while (!g_scanner_eof(scanner) && lvl >=0 ) {
 					if (token == G_TOKEN_RIGHT_PAREN) {
 						d(printf(")\n"));
 						lvl--;
@@ -424,8 +416,8 @@ camel_sexp_to_sql (const gchar *txt)
 			gint lvl=0, lval=0;
 
 			/* Colloct all after '+' and append them to one token. Go till you find ')' */
-			token = g_scanner_get_next_token (scanner) ;
-			while (token >= 0 && !g_scanner_eof(scanner) && lvl >=0 ) {
+			token = g_scanner_get_next_token (scanner);
+			while (!g_scanner_eof(scanner) && lvl >=0 ) {
 				if (token == G_TOKEN_RIGHT_PAREN) {
 					lvl--;
 					token = g_scanner_get_next_token (scanner);
@@ -451,7 +443,7 @@ camel_sexp_to_sql (const gchar *txt)
 			d(printf("lvl = %ld\n", lval));
 			node = g_new0 (Node, 1);
 			node->token = bstr;
-			node->exact_token = g_strdup_printf("%ld", (long)lval);
+			node->exact_token = g_strdup_printf("%ld", (glong)lval);
 			node->nodes = pnode->nodes > 0 ? pnode->nodes - 1:0;
 			node->prefix = 0;
 			node->rval = ' ';
@@ -481,7 +473,7 @@ camel_sexp_to_sql (const gchar *txt)
 			Node *pnode = operands->data, *node;
 
 			node = g_new0 (Node, 1);
-			node->token = g_strdup_printf ("%ld", scanner->value.v_int) ;
+			node->token = g_strdup_printf ("%ld", scanner->value.v_int);
 			node->exact_token = g_strdup_printf ("%ld", scanner->value.v_int);
 			node->nodes = pnode->nodes > 0 ? pnode->nodes - 1:0;
 			node->prefix = 0;
@@ -537,11 +529,11 @@ camel_sexp_to_sql (const gchar *txt)
 					pnode = NULL;
 
 				if (len == 3) {
-					gchar *prefix = NULL;
+					const gchar *prefix = NULL;
 					gchar *str, *sqstr, *escstr;
 					gint dyn_lvl;
 					Node *opnode = operators->data;
-					gchar *temp_op="";
+					const gchar *temp_op="";
 
 					if (n3->level < n2->level)
 						dyn_lvl = n2->level;
diff --git a/camel/camel-seekable-stream.c b/camel/camel-seekable-stream.c
index f788391..0156c1d 100644
--- a/camel/camel-seekable-stream.c
+++ b/camel/camel-seekable-stream.c
@@ -147,7 +147,7 @@ camel_seekable_stream_tell (CamelSeekableStream *stream)
 	return CSS_CLASS (stream)->tell (stream);
 }
 
-static int
+static gint
 set_bounds (CamelSeekableStream *stream, off_t start, off_t end)
 {
 	/* store the bounds */
@@ -183,7 +183,7 @@ camel_seekable_stream_set_bounds (CamelSeekableStream *stream,
 }
 
 /* a default implementation of reset for seekable streams */
-static int
+static gint
 reset (CamelStream *stream)
 {
 	CamelSeekableStream *seekable_stream;
diff --git a/camel/camel-seekable-stream.h b/camel/camel-seekable-stream.h
index c5af679..2c7c93a 100644
--- a/camel/camel-seekable-stream.h
+++ b/camel/camel-seekable-stream.h
@@ -71,7 +71,7 @@ CamelType camel_seekable_stream_get_type (void);
 off_t    camel_seekable_stream_seek            (CamelSeekableStream *stream, off_t offset,
 						CamelStreamSeekPolicy policy);
 off_t	 camel_seekable_stream_tell	       (CamelSeekableStream *stream);
-int	 camel_seekable_stream_set_bounds      (CamelSeekableStream *stream, off_t start, off_t end);
+gint	 camel_seekable_stream_set_bounds      (CamelSeekableStream *stream, off_t start, off_t end);
 
 G_END_DECLS
 
diff --git a/camel/camel-seekable-substream.c b/camel/camel-seekable-substream.c
index a56e1d3..9caed31 100644
--- a/camel/camel-seekable-substream.c
+++ b/camel/camel-seekable-substream.c
@@ -32,10 +32,10 @@ static CamelSeekableStreamClass *parent_class = NULL;
 /* Returns the class for a CamelSeekableSubStream */
 #define CSS_CLASS(so) CAMEL_SEEKABLE_SUBSTREAM_CLASS (CAMEL_OBJECT(so)->klass)
 
-static	ssize_t	 stream_read  (CamelStream *stream, gchar *buffer, size_t n);
-static	ssize_t	 stream_write (CamelStream *stream, const gchar *buffer, size_t n);
-static	int	 stream_flush (CamelStream *stream);
-static	int	 stream_close (CamelStream *stream);
+static	gssize	 stream_read  (CamelStream *stream, gchar *buffer, gsize n);
+static	gssize	 stream_write (CamelStream *stream, const gchar *buffer, gsize n);
+static	gint	 stream_flush (CamelStream *stream);
+static	gint	 stream_close (CamelStream *stream);
 static	gboolean eos	      (CamelStream *stream);
 static	off_t	 stream_seek  (CamelSeekableStream *stream, off_t offset,
 			       CamelStreamSeekPolicy policy);
@@ -142,13 +142,13 @@ parent_reset (CamelSeekableSubstream *seekable_substream, CamelSeekableStream *p
 	return camel_seekable_stream_seek (parent, (off_t) seekable_stream->position, CAMEL_STREAM_SET) == seekable_stream->position;
 }
 
-static ssize_t
-stream_read (CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelSeekableStream *parent;
 	CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream);
 	CamelSeekableSubstream *seekable_substream = CAMEL_SEEKABLE_SUBSTREAM (stream);
-	ssize_t v;
+	gssize v;
 
 	if (n == 0)
 		return 0;
@@ -179,13 +179,13 @@ stream_read (CamelStream *stream, gchar *buffer, size_t n)
 	return v;
 }
 
-static ssize_t
-stream_write (CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelSeekableStream *parent;
 	CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM(stream);
 	CamelSeekableSubstream *seekable_substream = CAMEL_SEEKABLE_SUBSTREAM(stream);
-	ssize_t v;
+	gssize v;
 
 	if (n == 0)
 		return 0;
@@ -217,7 +217,7 @@ stream_write (CamelStream *stream, const gchar *buffer, size_t n)
 
 }
 
-static int
+static gint
 stream_flush (CamelStream *stream)
 {
 	CamelSeekableSubstream *sus = (CamelSeekableSubstream *)stream;
@@ -225,7 +225,7 @@ stream_flush (CamelStream *stream)
 	return camel_stream_flush(CAMEL_STREAM(sus->parent_stream));
 }
 
-static int
+static gint
 stream_close (CamelStream *stream)
 {
 	/* we dont really want to close the substream ... */
diff --git a/camel/camel-service.c b/camel/camel-service.c
index 25e449a..129a6be 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -148,7 +148,7 @@ camel_service_get_type (void)
 }
 
 
-static int
+static gint
 service_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
 {
 	CamelService *service = (CamelService *) object;
@@ -214,7 +214,7 @@ service_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
 	return CAMEL_OBJECT_CLASS (parent_class)->setv (object, ex, args);
 }
 
-static int
+static gint
 service_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	CamelService *service = (CamelService *) object;
diff --git a/camel/camel-service.h b/camel/camel-service.h
index bac314f..ad44173 100644
--- a/camel/camel-service.h
+++ b/camel/camel-service.h
@@ -97,9 +97,9 @@ typedef struct {
 
 /* query_auth_types returns a GList of these */
 typedef struct {
-	gchar *name;               /* user-friendly name */
-	gchar *description;
-	gchar *authproto;
+	const gchar *name;               /* user-friendly name */
+	const gchar *description;
+	const gchar *authproto;
 
 	gboolean need_password;   /* needs a password to authenticate */
 } CamelServiceAuthType;
diff --git a/camel/camel-session.c b/camel/camel-session.c
index 5ffbe8c..dc3a2fb 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -601,7 +601,7 @@ session_thread_proxy (CamelSessionThreadMsg *msg,
 	camel_session_thread_msg_free(session, msg);
 }
 
-static int
+static gint
 session_thread_queue (CamelSession *session,
                       CamelSessionThreadMsg *msg,
                       gint flags)
diff --git a/camel/camel-smime-context.c b/camel/camel-smime-context.c
index a672406..4e55dfd 100644
--- a/camel/camel-smime-context.c
+++ b/camel/camel-smime-context.c
@@ -76,7 +76,7 @@ static CamelCipherContextClass *parent_class = NULL;
 
 /* used for decode content callback, for streaming decode */
 static void
-sm_write_stream(gpointer arg, const gchar *buf, unsigned long len)
+sm_write_stream(gpointer arg, const gchar *buf, gulong len)
 {
 	camel_stream_write((CamelStream *)arg, buf, len);
 }
@@ -219,7 +219,7 @@ sm_id_to_hash(CamelCipherContext *context, const gchar *id)
 }
 
 static const gchar *
-nss_error_to_string (long errorcode)
+nss_error_to_string (glong errorcode)
 {
 	#define cs(a,b) case a: return b;
 
@@ -407,7 +407,7 @@ nss_error_to_string (long errorcode)
 static void
 set_nss_error (CamelException *ex, const gchar *def_error)
 {
-	long err_code;
+	glong err_code;
 
 	g_return_if_fail (def_error != NULL);
 
@@ -422,7 +422,7 @@ set_nss_error (CamelException *ex, const gchar *def_error)
 		if (!err_str)
 			err_str = "Uknown error.";
 
-		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "%s (%d) - %s", err_str, (int) err_code, def_error);
+		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "%s (%d) - %s", err_str, (gint) err_code, def_error);
 	}
 }
 
@@ -563,7 +563,7 @@ fail:
 	return NULL;
 }
 
-static int
+static gint
 sm_sign(CamelCipherContext *context, const gchar *userid, CamelCipherHash hash, CamelMimePart *ipart, CamelMimePart *opart, CamelException *ex)
 {
 	gint res = -1;
@@ -953,7 +953,7 @@ fail:
 	return valid;
 }
 
-static int
+static gint
 sm_encrypt(CamelCipherContext *context, const gchar *userid, GPtrArray *recipients, CamelMimePart *ipart, CamelMimePart *opart, CamelException *ex)
 {
 	struct _CamelSMIMEContextPrivate *p = ((CamelSMIMEContext *)context)->priv;
@@ -1194,7 +1194,7 @@ fail:
 	return valid;
 }
 
-static int
+static gint
 sm_import_keys(CamelCipherContext *context, CamelStream *istream, CamelException *ex)
 {
 	camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("import keys: unimplemented"));
@@ -1202,7 +1202,7 @@ sm_import_keys(CamelCipherContext *context, CamelStream *istream, CamelException
 	return -1;
 }
 
-static int
+static gint
 sm_export_keys(CamelCipherContext *context, GPtrArray *keys, CamelStream *ostream, CamelException *ex)
 {
 	camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("export keys: unimplemented"));
diff --git a/camel/camel-store-summary.c b/camel/camel-store-summary.c
index 9d7270f..1458c7b 100644
--- a/camel/camel-store-summary.c
+++ b/camel/camel-store-summary.c
@@ -59,10 +59,10 @@ static gint summary_header_save(CamelStoreSummary *, FILE *);
 
 static CamelStoreInfo * store_info_new(CamelStoreSummary *, const gchar *);
 static CamelStoreInfo * store_info_load(CamelStoreSummary *, FILE *);
-static int		 store_info_save(CamelStoreSummary *, FILE *, CamelStoreInfo *);
+static gint		 store_info_save(CamelStoreSummary *, FILE *, CamelStoreInfo *);
 static void		 store_info_free(CamelStoreSummary *, CamelStoreInfo *);
 
-static const gchar *store_info_string(CamelStoreSummary *, const CamelStoreInfo *, int);
+static const gchar *store_info_string(CamelStoreSummary *, const CamelStoreInfo *, gint);
 static void store_info_set_string(CamelStoreSummary *, CamelStoreInfo *, int, const gchar *);
 
 static void camel_store_summary_class_init (CamelStoreSummaryClass *klass);
@@ -772,7 +772,7 @@ camel_store_summary_remove_index(CamelStoreSummary *s, gint index)
 	}
 }
 
-static int
+static gint
 summary_header_load(CamelStoreSummary *s, FILE *in)
 {
 	gint32 version, flags, count;
@@ -802,7 +802,7 @@ summary_header_load(CamelStoreSummary *s, FILE *in)
 	return 0;
 }
 
-static int
+static gint
 summary_header_save(CamelStoreSummary *s, FILE *out)
 {
 	fseek(out, 0, SEEK_SET);
@@ -922,7 +922,7 @@ store_info_load(CamelStoreSummary *s, FILE *in)
 	return NULL;
 }
 
-static int
+static gint
 store_info_save(CamelStoreSummary *s, FILE *out, CamelStoreInfo *info)
 {
 	io(printf("Saving folder info\n"));
diff --git a/camel/camel-store-summary.h b/camel/camel-store-summary.h
index f28f8e7..a8268cf 100644
--- a/camel/camel-store-summary.h
+++ b/camel/camel-store-summary.h
@@ -119,11 +119,11 @@ struct _CamelStoreSummaryClass {
 	/* create/save/load an individual message info */
 	CamelStoreInfo * (*store_info_new)(CamelStoreSummary *, const gchar *path);
 	CamelStoreInfo * (*store_info_load)(CamelStoreSummary *, FILE *);
-	int		  (*store_info_save)(CamelStoreSummary *, FILE *, CamelStoreInfo *);
+	gint		  (*store_info_save)(CamelStoreSummary *, FILE *, CamelStoreInfo *);
 	void		  (*store_info_free)(CamelStoreSummary *, CamelStoreInfo *);
 
 	/* virtualise access methods */
-	const gchar *(*store_info_string)(CamelStoreSummary *, const CamelStoreInfo *, int);
+	const gchar *(*store_info_string)(CamelStoreSummary *, const CamelStoreInfo *, gint);
 	void (*store_info_set_string)(CamelStoreSummary *, CamelStoreInfo *, int, const gchar *);
 };
 
diff --git a/camel/camel-store.c b/camel/camel-store.c
index c4b002b..6205964 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -192,14 +192,14 @@ camel_store_get_type (void)
 	return camel_store_type;
 }
 
-static int
+static gint
 store_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
 {
 	/* CamelStore doesn't currently have anything to set */
 	return CAMEL_OBJECT_CLASS (parent_class)->setv (object, ex, args);
 }
 
-static int
+static gint
 store_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	/* CamelStore doesn't currently have anything to get */
@@ -261,8 +261,9 @@ construct (CamelService *service, CamelSession *session,
 
 	if (camel_db_create_folders_table (store->cdb_r, ex))
 		g_warning ("something went wrong terribly during db creation \n");
-	else
+	else {
 		d(printf ("folders table successfully created \n"));
+	}
 
 	if (camel_exception_is_set (ex))
 		return;
@@ -998,7 +999,7 @@ camel_folder_info_new (void)
 	return g_slice_new0 (CamelFolderInfo);
 }
 
-static int
+static gint
 folder_info_cmp (gconstpointer ap, gconstpointer bp)
 {
 	const CamelFolderInfo *a = ((CamelFolderInfo **)ap)[0];
@@ -1085,8 +1086,9 @@ camel_folder_info_build (GPtrArray *folders, const gchar *namespace,
 				sep = strrchr (path, separator);
 				if (sep)
 					*sep = '\0';
-				else
+				else {
 					d(g_warning ("huh, no \"%c\" in \"%s\"?", separator, fi->uri));
+				}
 
 				pfi->full_name = g_strdup (path);
 
diff --git a/camel/camel-stream-buffer.c b/camel/camel-stream-buffer.c
index dd87644..73b4c81 100644
--- a/camel/camel-stream-buffer.c
+++ b/camel/camel-stream-buffer.c
@@ -41,8 +41,8 @@ enum {
 
 #define BUF_SIZE 1024
 
-static ssize_t stream_read (CamelStream *stream, gchar *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const gchar *buffer, size_t n);
+static gssize stream_read (CamelStream *stream, gchar *buffer, gsize n);
+static gssize stream_write (CamelStream *stream, const gchar *buffer, gsize n);
 static gint stream_flush (CamelStream *stream);
 static gint stream_close (CamelStream *stream);
 static gboolean stream_eos (CamelStream *stream);
@@ -226,12 +226,12 @@ camel_stream_buffer_new_with_vbuf (CamelStream *stream, CamelStreamBufferMode mo
 	return CAMEL_STREAM (sbf);
 }
 
-static ssize_t
-stream_read (CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
-	ssize_t bytes_read = 1;
-	ssize_t bytes_left;
+	gssize bytes_read = 1;
+	gssize bytes_left;
 	gchar *bptr = buffer;
 
 	g_return_val_if_fail( (sbf->mode & CAMEL_STREAM_BUFFER_MODE) == CAMEL_STREAM_BUFFER_READ, 0);
@@ -255,7 +255,7 @@ stream_read (CamelStream *stream, gchar *buffer, size_t n)
 			} else {
 				bytes_read = camel_stream_read(sbf->stream, (gchar *) sbf->buf, sbf->size);
 				if (bytes_read>0) {
-					size_t bytes_used = bytes_read > n ? n : bytes_read;
+					gsize bytes_used = bytes_read > n ? n : bytes_read;
 					sbf->ptr = sbf->buf;
 					sbf->end = sbf->buf+bytes_read;
 					memcpy(bptr, sbf->ptr, bytes_used);
@@ -272,14 +272,14 @@ stream_read (CamelStream *stream, gchar *buffer, size_t n)
 		}
 	}
 
-	return (ssize_t)(bptr - buffer);
+	return (gssize)(bptr - buffer);
 }
 
 /* only returns the number passed in, or -1 on an error */
-static ssize_t
-stream_write_all(CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write_all(CamelStream *stream, const gchar *buffer, gsize n)
 {
-	size_t left = n, w;
+	gsize left = n, w;
 
 	while (left > 0) {
 		w = camel_stream_write(stream, buffer, left);
@@ -292,12 +292,12 @@ stream_write_all(CamelStream *stream, const gchar *buffer, size_t n)
 	return n;
 }
 
-static ssize_t
-stream_write (CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
-	ssize_t total = n;
-	ssize_t left, todo;
+	gssize total = n;
+	gssize left, todo;
 
 	g_return_val_if_fail( (sbf->mode & CAMEL_STREAM_BUFFER_MODE) == CAMEL_STREAM_BUFFER_WRITE, 0);
 
@@ -332,13 +332,13 @@ stream_write (CamelStream *stream, const gchar *buffer, size_t n)
 	return total;
 }
 
-static int
+static gint
 stream_flush (CamelStream *stream)
 {
 	CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
 
 	if ((sbf->mode & CAMEL_STREAM_BUFFER_MODE) == CAMEL_STREAM_BUFFER_WRITE) {
-		size_t len = sbf->ptr - sbf->buf;
+		gsize len = sbf->ptr - sbf->buf;
 
 		if (camel_stream_write (sbf->stream, (const gchar *) sbf->buf, len) == -1)
 			return -1;
@@ -351,7 +351,7 @@ stream_flush (CamelStream *stream)
 	return camel_stream_flush(sbf->stream);
 }
 
-static int
+static gint
 stream_close (CamelStream *stream)
 {
 	CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
@@ -424,7 +424,7 @@ camel_stream_buffer_gets(CamelStreamBuffer *sbf, gchar *buf, guint max)
 	sbf->ptr = (guchar *) inptr;
 	*outptr = 0;
 
-	return (int)(outptr - buf);
+	return (gint)(outptr - buf);
 }
 
 /**
diff --git a/camel/camel-stream-filter.c b/camel/camel-stream-filter.c
index 8dd86f1..ca7439d 100644
--- a/camel/camel-stream-filter.c
+++ b/camel/camel-stream-filter.c
@@ -49,7 +49,7 @@ struct _CamelStreamFilterPrivate {
 	gchar *buffer;		/* READ_SIZE bytes */
 
 	gchar *filtered;		/* the filtered data */
-	size_t filteredlen;
+	gsize filteredlen;
 
 	guint last_was_read:1;	/* was the last op read or write? */
 	guint flushed:1;        /* were the filters flushed? */
@@ -63,8 +63,8 @@ struct _CamelStreamFilterPrivate {
 static void camel_stream_filter_class_init (CamelStreamFilterClass *klass);
 static void camel_stream_filter_init       (CamelStreamFilter *obj);
 
-static	ssize_t   do_read       (CamelStream *stream, gchar *buffer, size_t n);
-static	ssize_t   do_write      (CamelStream *stream, const gchar *buffer, size_t n);
+static	gssize   do_read       (CamelStream *stream, gchar *buffer, gsize n);
+static	gssize   do_write      (CamelStream *stream, const gchar *buffer, gsize n);
 static	gint       do_flush      (CamelStream *stream);
 static	gint       do_close      (CamelStream *stream);
 static	gboolean  do_eos        (CamelStream *stream);
@@ -213,12 +213,12 @@ camel_stream_filter_remove(CamelStreamFilter *stream, gint id)
 	}
 }
 
-static ssize_t
-do_read (CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+do_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelStreamFilter *filter = (CamelStreamFilter *)stream;
 	struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
-	ssize_t size;
+	gssize size;
 	struct _filter *f;
 
 	p->last_was_read = TRUE;
@@ -226,7 +226,7 @@ do_read (CamelStream *stream, gchar *buffer, size_t n)
 	g_check(p->realbuffer);
 
 	if (p->filteredlen<=0) {
-		size_t presize = READ_PAD;
+		gsize presize = READ_PAD;
 
 		size = camel_stream_read(filter->source, p->buffer, READ_SIZE);
 		if (size <= 0) {
@@ -252,7 +252,7 @@ do_read (CamelStream *stream, gchar *buffer, size_t n)
 			p->filteredlen = size;
 
 			d(printf ("\n\nOriginal content (%s): '", ((CamelObject *)filter->source)->klass->name));
-			d(fwrite(p->filtered, sizeof(char), p->filteredlen, stdout));
+			d(fwrite(p->filtered, sizeof(gchar), p->filteredlen, stdout));
 			d(printf("'\n"));
 
 			while (f) {
@@ -261,7 +261,7 @@ do_read (CamelStream *stream, gchar *buffer, size_t n)
 				g_check(p->realbuffer);
 
 				d(printf ("Filtered content (%s): '", ((CamelObject *)f->filter)->klass->name));
-				d(fwrite(p->filtered, sizeof(char), p->filteredlen, stdout));
+				d(fwrite(p->filtered, sizeof(gchar), p->filteredlen, stdout));
 				d(printf("'\n"));
 
 				f = f->next;
@@ -282,19 +282,19 @@ do_read (CamelStream *stream, gchar *buffer, size_t n)
 /* Note: Since the caller expects to write out as much as they asked us to
    write (for 'success'), we return what they asked us to write (for 'success')
    rather than the true number of written bytes */
-static ssize_t
-do_write (CamelStream *stream, const gchar *buf, size_t n)
+static gssize
+do_write (CamelStream *stream, const gchar *buf, gsize n)
 {
 	CamelStreamFilter *filter = (CamelStreamFilter *)stream;
 	struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
 	struct _filter *f;
-	size_t presize, len, left = n;
+	gsize presize, len, left = n;
 	gchar *buffer, realbuffer[READ_SIZE+READ_PAD];
 
 	p->last_was_read = FALSE;
 
 	d(printf ("\n\nWriting: Original content (%s): '", ((CamelObject *)filter->source)->klass->name));
-	d(fwrite(buf, sizeof(char), n, stdout));
+	d(fwrite(buf, sizeof(gchar), n, stdout));
 	d(printf("'\n"));
 
 	g_check(p->realbuffer);
@@ -315,7 +315,7 @@ do_write (CamelStream *stream, const gchar *buf, size_t n)
 			g_check(p->realbuffer);
 
 			d(printf ("Filtered content (%s): '", ((CamelObject *)f->filter)->klass->name));
-			d(fwrite(buffer, sizeof(char), len, stdout));
+			d(fwrite(buffer, sizeof(gchar), len, stdout));
 			d(printf("'\n"));
 
 			f = f->next;
@@ -330,33 +330,33 @@ do_write (CamelStream *stream, const gchar *buf, size_t n)
 	return n;
 }
 
-static int
+static gint
 do_flush (CamelStream *stream)
 {
 	CamelStreamFilter *filter = (CamelStreamFilter *)stream;
 	struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
 	struct _filter *f;
 	gchar *buffer;
-	size_t presize;
-	size_t len;
+	gsize presize;
+	gsize len;
 
 	if (p->last_was_read)
 		return 0;
 
-	buffer = "";
+	buffer = (gchar *) "";
 	len = 0;
 	presize = 0;
 	f = p->filters;
 
 	d(printf ("\n\nFlushing: Original content (%s): '", ((CamelObject *)filter->source)->klass->name));
-	d(fwrite(buffer, sizeof(char), len, stdout));
+	d(fwrite(buffer, sizeof(gchar), len, stdout));
 	d(printf("'\n"));
 
 	while (f) {
 		camel_mime_filter_complete(f->filter, buffer, len, presize, &buffer, &len, &presize);
 
 		d(printf ("Filtered content (%s): '", ((CamelObject *)f->filter)->klass->name));
-		d(fwrite(buffer, sizeof(char), len, stdout));
+		d(fwrite(buffer, sizeof(gchar), len, stdout));
 		d(printf("'\n"));
 
 		f = f->next;
@@ -366,7 +366,7 @@ do_flush (CamelStream *stream)
 	return camel_stream_flush(filter->source);
 }
 
-static int
+static gint
 do_close (CamelStream *stream)
 {
 	CamelStreamFilter *filter = (CamelStreamFilter *)stream;
@@ -393,7 +393,7 @@ do_eos (CamelStream *stream)
 	return camel_stream_eos(filter->source);
 }
 
-static int
+static gint
 do_reset (CamelStream *stream)
 {
 	CamelStreamFilter *filter = (CamelStreamFilter *)stream;
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
index 8d3ac83..17b6bce 100644
--- a/camel/camel-stream-fs.c
+++ b/camel/camel-stream-fs.c
@@ -45,8 +45,8 @@ static CamelSeekableStreamClass *parent_class = NULL;
 /* Returns the class for a CamelStreamFS */
 #define CSFS_CLASS(so) CAMEL_STREAM_FS_CLASS (CAMEL_OBJECT_GET_CLASS(so))
 
-static ssize_t stream_read   (CamelStream *stream, gchar *buffer, size_t n);
-static ssize_t stream_write  (CamelStream *stream, const gchar *buffer, size_t n);
+static gssize stream_read   (CamelStream *stream, gchar *buffer, gsize n);
+static gssize stream_write  (CamelStream *stream, const gchar *buffer, gsize n);
 static gint stream_flush  (CamelStream *stream);
 static gint stream_close  (CamelStream *stream);
 static off_t stream_seek (CamelSeekableStream *stream, off_t offset,
@@ -212,12 +212,12 @@ camel_stream_fs_new_with_name_and_bounds (const gchar *name, gint flags,
 }
 
 
-static ssize_t
-stream_read (CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
 	CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
-	ssize_t nread;
+	gssize nread;
 
 	if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
 		n = MIN (seekable->bound_end - seekable->position, n);
@@ -230,12 +230,12 @@ stream_read (CamelStream *stream, gchar *buffer, size_t n)
 	return nread;
 }
 
-static ssize_t
-stream_write (CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream);
 	CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
-	ssize_t nwritten;
+	gssize nwritten;
 
 	if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
 		n = MIN (seekable->bound_end - seekable->position, n);
@@ -246,13 +246,13 @@ stream_write (CamelStream *stream, const gchar *buffer, size_t n)
 	return nwritten;
 }
 
-static int
+static gint
 stream_flush (CamelStream *stream)
 {
 	return fsync(((CamelStreamFs *)stream)->fd);
 }
 
-static int
+static gint
 stream_close (CamelStream *stream)
 {
 	if (close (((CamelStreamFs *)stream)->fd) == -1)
diff --git a/camel/camel-stream-mem.c b/camel/camel-stream-mem.c
index d75c48c..c83eb23 100644
--- a/camel/camel-stream-mem.c
+++ b/camel/camel-stream-mem.c
@@ -39,8 +39,8 @@ static CamelSeekableStreamClass *parent_class = NULL;
 /* Returns the class for a CamelStreamMem */
 #define CSM_CLASS(so) CAMEL_STREAM_MEM_CLASS(CAMEL_OBJECT_GET_CLASS(so))
 
-static ssize_t stream_read (CamelStream *stream, gchar *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const gchar *buffer, size_t n);
+static gssize stream_read (CamelStream *stream, gchar *buffer, gsize n);
+static gssize stream_write (CamelStream *stream, const gchar *buffer, gsize n);
 static gboolean stream_eos (CamelStream *stream);
 static off_t stream_seek (CamelSeekableStream *stream, off_t offset,
 			  CamelStreamSeekPolicy policy);
@@ -75,7 +75,7 @@ camel_stream_mem_init (CamelObject *object)
 }
 
 /* could probably be a util method */
-static void clear_mem(gpointer p, size_t len)
+static void clear_mem(gpointer p, gsize len)
 {
 	gchar *s = p;
 
@@ -139,7 +139,7 @@ camel_stream_mem_new (void)
  * Returns: a new #CamelStreamMem
  **/
 CamelStream *
-camel_stream_mem_new_with_buffer (const gchar *buffer, size_t len)
+camel_stream_mem_new_with_buffer (const gchar *buffer, gsize len)
 {
 	GByteArray *ba;
 
@@ -226,7 +226,7 @@ camel_stream_mem_set_byte_array (CamelStreamMem *mem, GByteArray *buffer)
  * and so may have resource implications to consider.
  **/
 void
-camel_stream_mem_set_buffer (CamelStreamMem *mem, const gchar *buffer, size_t len)
+camel_stream_mem_set_buffer (CamelStreamMem *mem, const gchar *buffer, gsize len)
 {
 	GByteArray *ba;
 
@@ -251,12 +251,12 @@ camel_stream_mem_finalize (CamelObject *object)
 	}
 }
 
-static ssize_t
-stream_read (CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (stream);
 	CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
-	ssize_t nread;
+	gssize nread;
 
 	if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
 		n = MIN(seekable->bound_end - seekable->position, n);
@@ -271,12 +271,12 @@ stream_read (CamelStream *stream, gchar *buffer, size_t n)
 	return nread;
 }
 
-static ssize_t
-stream_write (CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (stream);
 	CamelSeekableStream *seekable = CAMEL_SEEKABLE_STREAM (stream);
-	ssize_t nwrite = n;
+	gssize nwrite = n;
 
 	if (seekable->bound_end != CAMEL_STREAM_UNBOUND)
 		nwrite = MIN(seekable->bound_end - seekable->position, n);
diff --git a/camel/camel-stream-mem.h b/camel/camel-stream-mem.h
index 298d2f1..8bcd851 100644
--- a/camel/camel-stream-mem.h
+++ b/camel/camel-stream-mem.h
@@ -58,14 +58,14 @@ CamelType camel_stream_mem_get_type (void);
 /* public methods */
 CamelStream *camel_stream_mem_new(void);
 CamelStream *camel_stream_mem_new_with_byte_array(GByteArray *buffer);
-CamelStream *camel_stream_mem_new_with_buffer(const gchar *buffer, size_t len);
+CamelStream *camel_stream_mem_new_with_buffer(const gchar *buffer, gsize len);
 
 /* 'secure' data, currently just clears memory on finalise */
 void camel_stream_mem_set_secure(CamelStreamMem *mem);
 
 /* these are really only here for implementing classes */
 void camel_stream_mem_set_byte_array(CamelStreamMem *mem, GByteArray *buffer);
-void camel_stream_mem_set_buffer(CamelStreamMem *mem, const gchar *buffer, size_t len);
+void camel_stream_mem_set_buffer(CamelStreamMem *mem, const gchar *buffer, gsize len);
 
 G_END_DECLS
 
diff --git a/camel/camel-stream-null.c b/camel/camel-stream-null.c
index da71c0f..a93393a 100644
--- a/camel/camel-stream-null.c
+++ b/camel/camel-stream-null.c
@@ -34,8 +34,8 @@ static CamelObjectClass *parent_class = NULL;
 #define CS_CLASS(so) CAMEL_STREAM_NULL_CLASS(CAMEL_OBJECT_GET_CLASS(so))
 
 /* dummy implementations, for a NULL stream */
-static ssize_t   stream_read       (CamelStream *stream, gchar *buffer, size_t n) { return 0; }
-static ssize_t   stream_write      (CamelStream *stream, const gchar *buffer, size_t n) { ((CamelStreamNull *)stream)->written += n; return n; }
+static gssize   stream_read       (CamelStream *stream, gchar *buffer, gsize n) { return 0; }
+static gssize   stream_write      (CamelStream *stream, const gchar *buffer, gsize n) { ((CamelStreamNull *)stream)->written += n; return n; }
 static gint       stream_close      (CamelStream *stream) { return 0; }
 static gint       stream_flush      (CamelStream *stream) { return 0; }
 static gboolean  stream_eos        (CamelStream *stream) { return TRUE; }
diff --git a/camel/camel-stream-null.h b/camel/camel-stream-null.h
index 1fc21d5..4fdb077 100644
--- a/camel/camel-stream-null.h
+++ b/camel/camel-stream-null.h
@@ -36,7 +36,7 @@ typedef struct _CamelStreamNullClass CamelStreamNullClass;
 struct _CamelStreamNull {
 	CamelStream parent;
 
-	size_t written;
+	gsize written;
 };
 
 struct _CamelStreamNullClass {
diff --git a/camel/camel-stream-process.c b/camel/camel-stream-process.c
index 651cd88..04ce7d6 100644
--- a/camel/camel-stream-process.c
+++ b/camel/camel-stream-process.c
@@ -50,8 +50,8 @@ static CamelObjectClass *parent_class = NULL;
 #define CS_CLASS(so) CAMEL_STREAM_PROCESS_CLASS(CAMEL_OBJECT_GET_CLASS(so))
 
 /* dummy implementations, for a PROCESS stream */
-static ssize_t   stream_read       (CamelStream *stream, gchar *buffer, size_t n);
-static ssize_t   stream_write      (CamelStream *stream, const gchar *buffer, size_t n);
+static gssize   stream_read       (CamelStream *stream, gchar *buffer, gsize n);
+static gssize   stream_write      (CamelStream *stream, const gchar *buffer, gsize n);
 static gint       stream_close      (CamelStream *stream);
 static gint       stream_flush      (CamelStream *stream);
 
@@ -120,29 +120,29 @@ camel_stream_process_new (void)
 }
 
 
-static ssize_t
-stream_read (CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelStreamProcess *stream_process = CAMEL_STREAM_PROCESS (stream);
 
 	return camel_read (stream_process->sockfd, buffer, n);
 }
 
-static ssize_t
-stream_write (CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelStreamProcess *stream_process = CAMEL_STREAM_PROCESS (stream);
 
 	return camel_write (stream_process->sockfd, buffer, n);
 }
 
-static int
+static gint
 stream_flush (CamelStream *stream)
 {
 	return 0;
 }
 
-static int
+static gint
 stream_close (CamelStream *object)
 {
 	CamelStreamProcess *stream = CAMEL_STREAM_PROCESS (object);
@@ -191,7 +191,7 @@ stream_close (CamelStream *object)
 	return 0;
 }
 
-static void
+G_GNUC_NORETURN static void
 do_exec_command (gint fd, const gchar *command, gchar **env)
 {
 	gint i, maxopen;
@@ -225,7 +225,7 @@ do_exec_command (gint fd, const gchar *command, gchar **env)
 
 	/* Set up child's environment. We _add_ to it, don't use execle,
 	   because otherwise we'd destroy stuff like SSH_AUTH_SOCK etc. */
-	for ( ; env && *env; env++)
+	for (; env && *env; env++)
 		putenv(*env);
 
 	execl ("/bin/sh", "/bin/sh", "-c", command, NULL);
diff --git a/camel/camel-stream-vfs.c b/camel/camel-stream-vfs.c
index 2b65d3f..d3ba109 100644
--- a/camel/camel-stream-vfs.c
+++ b/camel/camel-stream-vfs.c
@@ -41,8 +41,8 @@ static CamelStreamClass *parent_class = NULL;
 /* Returns the class for a CamelStreamVFS */
 #define CSVFS_CLASS(so) CAMEL_STREAM_VFS_CLASS (CAMEL_OBJECT_GET_CLASS(so))
 
-static ssize_t stream_read   (CamelStream *stream, gchar *buffer, size_t n);
-static ssize_t stream_write  (CamelStream *stream, const gchar *buffer, size_t n);
+static gssize stream_read   (CamelStream *stream, gchar *buffer, gsize n);
+static gssize stream_write  (CamelStream *stream, const gchar *buffer, gsize n);
 static gint stream_flush  (CamelStream *stream);
 static gint stream_close  (CamelStream *stream);
 
@@ -186,8 +186,8 @@ camel_stream_vfs_is_writable (CamelStreamVFS *stream_vfs)
 	return G_IS_OUTPUT_STREAM (stream_vfs->stream);
 }
 
-static ssize_t
-stream_read (CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	gssize nread;
 	GError *error = NULL;
@@ -208,8 +208,8 @@ stream_read (CamelStream *stream, gchar *buffer, size_t n)
 	return nread;
 }
 
-static ssize_t
-stream_write (CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	gboolean success;
 	gsize bytes_written;
@@ -227,7 +227,7 @@ stream_write (CamelStream *stream, const gchar *buffer, size_t n)
 	return success ? bytes_written : -1;
 }
 
-static int
+static gint
 stream_flush (CamelStream *stream)
 {
 	CamelStreamVFS *stream_vfs = CAMEL_STREAM_VFS (stream);
@@ -248,7 +248,7 @@ stream_flush (CamelStream *stream)
 	return 0;
 }
 
-static int
+static gint
 stream_close (CamelStream *stream)
 {
 	CamelStreamVFS *stream_vfs = CAMEL_STREAM_VFS (stream);
diff --git a/camel/camel-stream.c b/camel/camel-stream.c
index a9685c9..368c7da 100644
--- a/camel/camel-stream.c
+++ b/camel/camel-stream.c
@@ -37,8 +37,8 @@ static CamelObjectClass *parent_class = NULL;
 #define CS_CLASS(so) CAMEL_STREAM_CLASS(CAMEL_OBJECT_GET_CLASS(so))
 
 /* default implementations, do very little */
-static ssize_t   stream_read       (CamelStream *stream, gchar *buffer, size_t n) { return 0; }
-static ssize_t   stream_write      (CamelStream *stream, const gchar *buffer, size_t n) { return n; }
+static gssize   stream_read       (CamelStream *stream, gchar *buffer, gsize n) { return 0; }
+static gssize   stream_write      (CamelStream *stream, const gchar *buffer, gsize n) { return n; }
 static gint       stream_close      (CamelStream *stream) { return 0; }
 static gint       stream_flush      (CamelStream *stream) { return 0; }
 static gboolean  stream_eos        (CamelStream *stream) { return stream->eos; }
@@ -89,8 +89,8 @@ camel_stream_get_type (void)
  * Returns: the number of bytes actually read, or %-1 on error and set
  * errno.
  **/
-ssize_t
-camel_stream_read (CamelStream *stream, gchar *buffer, size_t n)
+gssize
+camel_stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
 	g_return_val_if_fail (n == 0 || buffer, -1);
@@ -110,8 +110,8 @@ camel_stream_read (CamelStream *stream, gchar *buffer, size_t n)
  * Returns: the number of bytes written to the stream, or %-1 on error
  * along with setting errno.
  **/
-ssize_t
-camel_stream_write (CamelStream *stream, const gchar *buffer, size_t n)
+gssize
+camel_stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
 	g_return_val_if_fail (n == 0 || buffer, -1);
@@ -201,7 +201,7 @@ camel_stream_reset (CamelStream *stream)
  *
  * Returns: the number of characters written or %-1 on error.
  **/
-ssize_t
+gssize
 camel_stream_write_string (CamelStream *stream, const gchar *string)
 {
 	return camel_stream_write (stream, string, strlen (string));
@@ -217,12 +217,12 @@ camel_stream_write_string (CamelStream *stream, const gchar *string)
  *
  * Returns: the number of characters written or %-1 on error.
  **/
-ssize_t
+gssize
 camel_stream_printf (CamelStream *stream, const gchar *fmt, ... )
 {
 	va_list args;
 	gchar *string;
-	ssize_t ret;
+	gssize ret;
 
 	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
 
@@ -250,13 +250,13 @@ camel_stream_printf (CamelStream *stream, const gchar *fmt, ... )
  * Returns: %-1 on error, or the number of bytes succesfully
  * copied across streams.
  **/
-ssize_t
+gssize
 camel_stream_write_to_stream (CamelStream *stream, CamelStream *output_stream)
 {
 	gchar tmp_buf[4096];
-	ssize_t total = 0;
-	ssize_t nb_read;
-	ssize_t nb_written;
+	gssize total = 0;
+	gssize nb_read;
+	gssize nb_written;
 
 	g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
 	g_return_val_if_fail (CAMEL_IS_STREAM (output_stream), -1);
@@ -269,7 +269,7 @@ camel_stream_write_to_stream (CamelStream *stream, CamelStream *output_stream)
 			nb_written = 0;
 
 			while (nb_written < nb_read) {
-				ssize_t len = camel_stream_write (output_stream, tmp_buf + nb_written,
+				gssize len = camel_stream_write (output_stream, tmp_buf + nb_written,
 								  nb_read - nb_written);
 				if (len < 0)
 					return -1;
diff --git a/camel/camel-stream.h b/camel/camel-stream.h
index 41081f0..e7dd918 100644
--- a/camel/camel-stream.h
+++ b/camel/camel-stream.h
@@ -49,8 +49,8 @@ typedef struct {
 
 	/* Virtual methods */
 
-	ssize_t   (*read)       (CamelStream *stream, gchar *buffer, size_t n);
-	ssize_t   (*write)      (CamelStream *stream, const gchar *buffer, size_t n);
+	gssize   (*read)       (CamelStream *stream, gchar *buffer, gsize n);
+	gssize   (*write)      (CamelStream *stream, const gchar *buffer, gsize n);
 	gint       (*close)      (CamelStream *stream);
 	gint       (*flush)      (CamelStream *stream);
 	gboolean  (*eos)        (CamelStream *stream);
@@ -62,22 +62,22 @@ typedef struct {
 CamelType camel_stream_get_type (void);
 
 /* public methods */
-ssize_t    camel_stream_read       (CamelStream *stream, gchar *buffer, size_t n);
-ssize_t    camel_stream_write      (CamelStream *stream, const gchar *buffer, size_t n);
+gssize    camel_stream_read       (CamelStream *stream, gchar *buffer, gsize n);
+gssize    camel_stream_write      (CamelStream *stream, const gchar *buffer, gsize n);
 gint        camel_stream_flush      (CamelStream *stream);
 gint        camel_stream_close      (CamelStream *stream);
 gboolean   camel_stream_eos        (CamelStream *stream);
 gint        camel_stream_reset      (CamelStream *stream);
 
 /* utility macros and funcs */
-ssize_t camel_stream_write_string (CamelStream *stream, const gchar *string);
-ssize_t camel_stream_printf (CamelStream *stream, const gchar *fmt, ... ) G_GNUC_PRINTF (2, 3);
-ssize_t camel_stream_vprintf (CamelStream *stream, const gchar *fmt, va_list ap);
+gssize camel_stream_write_string (CamelStream *stream, const gchar *string);
+gssize camel_stream_printf (CamelStream *stream, const gchar *fmt, ... ) G_GNUC_PRINTF (2, 3);
+gssize camel_stream_vprintf (CamelStream *stream, const gchar *fmt, va_list ap);
 
 /* Write a whole stream to another stream, until eof or error on
  * either stream.
  */
-ssize_t camel_stream_write_to_stream (CamelStream *stream, CamelStream *output_stream);
+gssize camel_stream_write_to_stream (CamelStream *stream, CamelStream *output_stream);
 
 G_END_DECLS
 
diff --git a/camel/camel-string-utils.c b/camel/camel-string-utils.c
index 7044e71..95041e4 100644
--- a/camel/camel-string-utils.c
+++ b/camel/camel-string-utils.c
@@ -42,7 +42,7 @@ camel_strcase_hash (gconstpointer v)
 	const gchar *p = (gchar *) v;
 	guint h = 0, g;
 
-	for ( ; *p != '\0'; p++) {
+	for (; *p != '\0'; p++) {
 		h = (h << 4) + g_ascii_toupper (*p);
 		if ((g = h & 0xf0000000)) {
 			h = h ^ (g >> 24);
diff --git a/camel/camel-tcp-stream-openssl.c b/camel/camel-tcp-stream-openssl.c
index 1d59849..3c7666f 100644
--- a/camel/camel-tcp-stream-openssl.c
+++ b/camel/camel-tcp-stream-openssl.c
@@ -55,8 +55,8 @@ static CamelTcpStreamClass *parent_class = NULL;
 /* Returns the class for a CamelTcpStreamSSL */
 #define CTSR_CLASS(so) CAMEL_TCP_STREAM_SSL_CLASS (CAMEL_OBJECT_GET_CLASS (so))
 
-static ssize_t stream_read (CamelStream *stream, gchar *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const gchar *buffer, size_t n);
+static gssize stream_read (CamelStream *stream, gchar *buffer, gsize n);
+static gssize stream_write (CamelStream *stream, const gchar *buffer, gsize n);
 static gint stream_flush  (CamelStream *stream);
 static gint stream_close  (CamelStream *stream);
 
@@ -214,7 +214,7 @@ camel_tcp_stream_ssl_new_raw (CamelService *service, const gchar *expected_host,
 }
 
 
-static int
+static gint
 ssl_errno (SSL *ssl, gint ret)
 {
 	switch (SSL_get_error (ssl, ret)) {
@@ -272,12 +272,12 @@ camel_tcp_stream_ssl_enable_ssl (CamelTcpStreamSSL *stream)
 }
 
 
-static ssize_t
-stream_read (CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelTcpStreamSSL *openssl = CAMEL_TCP_STREAM_SSL (stream);
 	SSL *ssl = openssl->priv->ssl;
-	ssize_t nread;
+	gssize nread;
 	gint cancel_fd;
 
 	if (camel_operation_cancel_check (NULL)) {
@@ -340,12 +340,12 @@ stream_read (CamelStream *stream, gchar *buffer, size_t n)
 	return nread;
 }
 
-static ssize_t
-stream_write (CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelTcpStreamSSL *openssl = CAMEL_TCP_STREAM_SSL (stream);
 	SSL *ssl = openssl->priv->ssl;
-	ssize_t w, written = 0;
+	gssize w, written = 0;
 	gint cancel_fd;
 
 	if (camel_operation_cancel_check (NULL)) {
@@ -423,7 +423,7 @@ stream_write (CamelStream *stream, const gchar *buffer, size_t n)
 	return written;
 }
 
-static int
+static gint
 stream_flush (CamelStream *stream)
 {
 	return 0;
@@ -443,7 +443,7 @@ close_ssl_connection (SSL *ssl)
 	}
 }
 
-static int
+static gint
 stream_close (CamelStream *stream)
 {
 	close_ssl_connection (((CamelTcpStreamSSL *)stream)->priv->ssl);
@@ -458,7 +458,7 @@ stream_close (CamelStream *stream)
 
 /* this is a 'cancellable' connect, cancellable from camel_operation_cancel etc */
 /* returns -1 & errno == EINTR if the connection was cancelled */
-static int
+static gint
 socket_connect (struct hostent *h, gint port)
 {
 #ifdef ENABLE_IPv6
@@ -544,7 +544,7 @@ socket_connect (struct hostent *h, gint port)
 			errno = EINTR;
 			return -1;
 		} else {
-			len = sizeof (int);
+			len = sizeof (gint);
 
 			if (getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &len) == -1) {
 				close (fd);
@@ -636,7 +636,7 @@ x509_strerror (gint err)
 	}
 }
 
-static int
+static gint
 ssl_verify (gint ok, X509_STORE_CTX *ctx)
 {
 	guchar md5sum[16], fingerprint[40], *f;
@@ -763,7 +763,7 @@ open_ssl_connection (CamelService *service, gint sockfd, CamelTcpStreamSSL *open
 	return ssl;
 }
 
-static int
+static gint
 stream_connect (CamelTcpStream *stream, struct hostent *host, gint port)
 {
 	CamelTcpStreamSSL *openssl = CAMEL_TCP_STREAM_SSL (stream);
@@ -789,7 +789,7 @@ stream_connect (CamelTcpStream *stream, struct hostent *host, gint port)
 }
 
 
-static int
+static gint
 get_sockopt_level (const CamelSockOptData *data)
 {
 	switch (data->option) {
@@ -801,7 +801,7 @@ get_sockopt_level (const CamelSockOptData *data)
 	}
 }
 
-static int
+static gint
 get_sockopt_optname (const CamelSockOptData *data)
 {
 	switch (data->option) {
@@ -828,7 +828,7 @@ get_sockopt_optname (const CamelSockOptData *data)
 	}
 }
 
-static int
+static gint
 stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
 {
 	gint optname, optlen;
@@ -855,7 +855,7 @@ stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
 			   (socklen_t *) &optlen);
 }
 
-static int
+static gint
 stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data)
 {
 	gint optname;
diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c
index 93e2268..baa1fca 100644
--- a/camel/camel-tcp-stream-raw.c
+++ b/camel/camel-tcp-stream-raw.c
@@ -53,8 +53,8 @@ static CamelTcpStreamClass *parent_class = NULL;
 /* Returns the class for a CamelTcpStreamRaw */
 #define CTSR_CLASS(so) CAMEL_TCP_STREAM_RAW_CLASS (CAMEL_OBJECT_GET_CLASS (so))
 
-static ssize_t stream_read (CamelStream *stream, gchar *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const gchar *buffer, size_t n);
+static gssize stream_read (CamelStream *stream, gchar *buffer, gsize n);
+static gssize stream_write (CamelStream *stream, const gchar *buffer, gsize n);
 static gint stream_flush  (CamelStream *stream);
 static gint stream_close  (CamelStream *stream);
 
@@ -125,17 +125,17 @@ camel_tcp_stream_raw_get_type (void)
 }
 
 #ifdef SIMULATE_FLAKY_NETWORK
-static ssize_t
-flaky_tcp_write (gint fd, const gchar *buffer, size_t buflen)
+static gssize
+flaky_tcp_write (gint fd, const gchar *buffer, gsize buflen)
 {
-	size_t len = buflen;
-	ssize_t nwritten;
+	gsize len = buflen;
+	gssize nwritten;
 	gint val;
 
 	if (buflen == 0)
 		return 0;
 
-	val = 1 + (int) (10.0 * rand () / (RAND_MAX + 1.0));
+	val = 1 + (gint) (10.0 * rand () / (RAND_MAX + 1.0));
 
 	switch (val) {
 	case 1:
@@ -153,11 +153,11 @@ flaky_tcp_write (gint fd, const gchar *buffer, size_t buflen)
 	case 4:
 	case 5:
 	case 6:
-		len = 1 + (size_t) (buflen * rand () / (RAND_MAX + 1.0));
+		len = 1 + (gsize) (buflen * rand () / (RAND_MAX + 1.0));
 		len = MIN (len, buflen);
 		/* fall through... */
 	default:
-		printf ("flaky_tcp_write (%d, ..., %d): (%d) '%.*s'", fd, buflen, len, (int) len, buffer);
+		printf ("flaky_tcp_write (%d, ..., %d): (%d) '%.*s'", fd, buflen, len, (gint) len, buffer);
 		nwritten = write (fd, buffer, len);
 		if (nwritten < 0)
 			printf (" errno => %s\n", g_strerror (errno));
@@ -172,17 +172,17 @@ flaky_tcp_write (gint fd, const gchar *buffer, size_t buflen)
 
 #define write(fd, buffer, buflen) flaky_tcp_write (fd, buffer, buflen)
 
-static ssize_t
-flaky_tcp_read (gint fd, gchar *buffer, size_t buflen)
+static gssize
+flaky_tcp_read (gint fd, gchar *buffer, gsize buflen)
 {
-	size_t len = buflen;
-	ssize_t nread;
+	gsize len = buflen;
+	gssize nread;
 	gint val;
 
 	if (buflen == 0)
 		return 0;
 
-	val = 1 + (int) (10.0 * rand () / (RAND_MAX + 1.0));
+	val = 1 + (gint) (10.0 * rand () / (RAND_MAX + 1.0));
 
 	switch (val) {
 	case 1:
@@ -204,7 +204,7 @@ flaky_tcp_read (gint fd, gchar *buffer, size_t buflen)
 	case 8:
 	case 9:
 	case 10:
-		len = 1 + (size_t) (10.0 * rand () / (RAND_MAX + 1.0));
+		len = 1 + (gsize) (10.0 * rand () / (RAND_MAX + 1.0));
 		len = MIN (len, buflen);
 		/* fall through... */
 	default:
@@ -244,29 +244,29 @@ camel_tcp_stream_raw_new (void)
 	return CAMEL_STREAM (stream);
 }
 
-static ssize_t
-stream_read (CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelTcpStreamRaw *raw = CAMEL_TCP_STREAM_RAW (stream);
 
 	return camel_read_socket (raw->sockfd, buffer, n);
 }
 
-static ssize_t
-stream_write (CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelTcpStreamRaw *raw = CAMEL_TCP_STREAM_RAW (stream);
 
 	return camel_write_socket (raw->sockfd, buffer, n);
 }
 
-static int
+static gint
 stream_flush (CamelStream *stream)
 {
 	return 0;
 }
 
-static int
+static gint
 stream_close (CamelStream *stream)
 {
 	if (SOCKET_CLOSE (((CamelTcpStreamRaw *)stream)->sockfd) == -1)
@@ -278,7 +278,7 @@ stream_close (CamelStream *stream)
 
 /* this is a 'cancellable' connect, cancellable from camel_operation_cancel etc */
 /* returns -1 & errno == EINTR if the connection was cancelled */
-static int
+static gint
 socket_connect(struct addrinfo *h)
 {
 	struct timeval tv;
@@ -373,7 +373,7 @@ socket_connect(struct addrinfo *h)
 			errno = EINTR;
 			return -1;
 		} else {
-			len = sizeof (int);
+			len = sizeof (gint);
 
 			if (getsockopt (fd, SOL_SOCKET, SO_ERROR, (gchar *) &ret, &len) == -1) {
 				errnosav = errno;
@@ -401,7 +401,7 @@ socket_connect(struct addrinfo *h)
 	return fd;
 }
 
-static int
+static gint
 stream_connect (CamelTcpStream *stream, struct addrinfo *host)
 {
 	CamelTcpStreamRaw *raw = CAMEL_TCP_STREAM_RAW (stream);
@@ -419,7 +419,7 @@ stream_connect (CamelTcpStream *stream, struct addrinfo *host)
 	return -1;
 }
 
-static int
+static gint
 get_sockopt_level (const CamelSockOptData *data)
 {
 	switch (data->option) {
@@ -431,7 +431,7 @@ get_sockopt_level (const CamelSockOptData *data)
 	}
 }
 
-static int
+static gint
 get_sockopt_optname (const CamelSockOptData *data)
 {
 	switch (data->option) {
@@ -460,7 +460,7 @@ get_sockopt_optname (const CamelSockOptData *data)
 	}
 }
 
-static int
+static gint
 stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
 {
 	gint optname, optlen;
@@ -490,7 +490,7 @@ stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
 			   (socklen_t *) &optlen);
 }
 
-static int
+static gint
 stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data)
 {
 	gint optname;
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index 65918d0..0449e83 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -72,8 +72,8 @@ static CamelTcpStreamClass *parent_class = NULL;
 /* Returns the class for a CamelTcpStreamSSL */
 #define CTSS_CLASS(so) CAMEL_TCP_STREAM_SSL_CLASS (CAMEL_OBJECT_GET_CLASS (so))
 
-static ssize_t stream_read (CamelStream *stream, gchar *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const gchar *buffer, size_t n);
+static gssize stream_read (CamelStream *stream, gchar *buffer, gsize n);
+static gssize stream_write (CamelStream *stream, const gchar *buffer, gsize n);
 static gint stream_flush  (CamelStream *stream);
 static gint stream_close  (CamelStream *stream);
 
@@ -335,12 +335,12 @@ camel_tcp_stream_ssl_enable_ssl (CamelTcpStreamSSL *ssl)
 }
 
 
-static ssize_t
-stream_read (CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelTcpStreamSSL *tcp_stream_ssl = CAMEL_TCP_STREAM_SSL (stream);
 	PRFileDesc *cancel_fd;
-	ssize_t nread;
+	gssize nread;
 
 	if (camel_operation_cancel_check (NULL)) {
 		errno = EINTR;
@@ -418,11 +418,11 @@ stream_read (CamelStream *stream, gchar *buffer, size_t n)
 	return nread;
 }
 
-static ssize_t
-stream_write (CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelTcpStreamSSL *tcp_stream_ssl = CAMEL_TCP_STREAM_SSL (stream);
-	ssize_t w, written = 0;
+	gssize w, written = 0;
 	PRFileDesc *cancel_fd;
 
 	if (camel_operation_cancel_check (NULL)) {
@@ -513,14 +513,14 @@ stream_write (CamelStream *stream, const gchar *buffer, size_t n)
 	return written;
 }
 
-static int
+static gint
 stream_flush (CamelStream *stream)
 {
 	/*return PR_Sync (((CamelTcpStreamSSL *)stream)->priv->sockfd);*/
 	return 0;
 }
 
-static int
+static gint
 stream_close (CamelStream *stream)
 {
 	if (((CamelTcpStreamSSL *)stream)->priv->sockfd == NULL) {
@@ -1083,7 +1083,7 @@ enable_ssl (CamelTcpStreamSSL *ssl, PRFileDesc *fd)
 	return ssl_fd;
 }
 
-static int
+static gint
 sockaddr_to_praddr(struct sockaddr *s, gint len, PRNetAddr *addr)
 {
 	/* We assume the ip addresses are the same size - they have to be anyway.
@@ -1123,7 +1123,7 @@ sockaddr_to_praddr(struct sockaddr *s, gint len, PRNetAddr *addr)
 	return -1;
 }
 
-static int
+static gint
 socket_connect(CamelTcpStream *stream, struct addrinfo *host)
 {
 	CamelTcpStreamSSL *ssl = CAMEL_TCP_STREAM_SSL (stream);
@@ -1218,7 +1218,7 @@ socket_connect(CamelTcpStream *stream, struct addrinfo *host)
 	return 0;
 }
 
-static int
+static gint
 stream_connect(CamelTcpStream *stream, struct addrinfo *host)
 {
 	while (host) {
@@ -1230,7 +1230,7 @@ stream_connect(CamelTcpStream *stream, struct addrinfo *host)
 	return -1;
 }
 
-static int
+static gint
 stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
 {
 	PRSocketOptionData sodata;
@@ -1246,7 +1246,7 @@ stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
 	return 0;
 }
 
-static int
+static gint
 stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data)
 {
 	PRSocketOptionData sodata;
diff --git a/camel/camel-tcp-stream.c b/camel/camel-tcp-stream.c
index 38dbfc5..1798a4b 100644
--- a/camel/camel-tcp-stream.c
+++ b/camel/camel-tcp-stream.c
@@ -82,7 +82,7 @@ camel_tcp_stream_get_type (void)
 }
 
 
-static int
+static gint
 tcp_connect (CamelTcpStream *stream, struct addrinfo *host)
 {
 	w(g_warning ("CamelTcpStream::connect called on default implementation"));
@@ -107,7 +107,7 @@ camel_tcp_stream_connect (CamelTcpStream *stream, struct addrinfo *host)
 	return CTS_CLASS (stream)->connect (stream, host);
 }
 
-static int
+static gint
 tcp_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
 {
 	w(g_warning ("CamelTcpStream::getsockopt called on default implementation"));
@@ -131,7 +131,7 @@ camel_tcp_stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
 	return CTS_CLASS (stream)->getsockopt (stream, data);
 }
 
-static int
+static gint
 tcp_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data)
 {
 	w(g_warning ("CamelTcpStream::setsockopt called on default implementation"));
diff --git a/camel/camel-tcp-stream.h b/camel/camel-tcp-stream.h
index f310a0e..8e2e7f3 100644
--- a/camel/camel-tcp-stream.h
+++ b/camel/camel-tcp-stream.h
@@ -84,9 +84,9 @@ typedef struct _CamelSockOptData {
 		gboolean    mcast_loopback;      /* IP multicast loopback */
 		gboolean    no_delay;            /* Don't delay send to coalesce packets */
 		gboolean    broadcast;           /* Enable broadcast */
-		size_t      max_segment;         /* Maximum segment size */
-		size_t      recv_buffer_size;    /* Receive buffer size */
-		size_t      send_buffer_size;    /* Send buffer size */
+		gsize      max_segment;         /* Maximum segment size */
+		gsize      recv_buffer_size;    /* Receive buffer size */
+		gsize      send_buffer_size;    /* Send buffer size */
 		CamelLinger linger;              /* Time to linger on close if data present */
 	} value;
 } CamelSockOptData;
diff --git a/camel/camel-text-index.c b/camel/camel-text-index.c
index e13bdd7..65227fb 100644
--- a/camel/camel-text-index.c
+++ b/camel/camel-text-index.c
@@ -85,7 +85,7 @@ struct _CamelTextIndexCursorPrivate {
 
 	gint record_index;
 
-	size_t record_count;
+	gsize record_count;
 	camel_key_t *records;
 
 	gchar *current;
@@ -253,7 +253,7 @@ text_index_add_name_to_word(CamelIndex *idx, const gchar *word, camel_key_t name
 	}
 }
 
-static int
+static gint
 text_index_sync(CamelIndex *idx)
 {
 	struct _CamelTextIndexPrivate *p = CTI_PRIVATE(idx);
@@ -337,7 +337,7 @@ static void tmp_name(const gchar *in, gchar *o)
 	}
 }
 
-static int
+static gint
 text_index_compress(CamelIndex *idx)
 {
 	gint ret;
@@ -354,7 +354,7 @@ text_index_compress(CamelIndex *idx)
 }
 
 /* Attempt to recover index space by compressing the indices */
-static int
+static gint
 text_index_compress_nosync(CamelIndex *idx)
 {
 	CamelTextIndex *newidx;
@@ -367,7 +367,7 @@ text_index_compress_nosync(CamelIndex *idx)
 	gchar *name = NULL;
 	guint flags;
 	gchar *newpath, *savepath, *oldpath;
-	size_t count, newcount;
+	gsize count, newcount;
 	camel_key_t *records, newrecords[256];
 	struct _CamelTextIndexRoot *rb;
 
@@ -425,8 +425,9 @@ text_index_compress_nosync(CamelIndex *idx)
 			rb->names++;
 			camel_partition_table_add(newp->name_hash, name, newkeyid);
 			g_hash_table_insert(remap, GINT_TO_POINTER(oldkeyid), GINT_TO_POINTER(newkeyid));
-		} else
+		} else {
 			io(printf("deleted name '%s'\n", name));
+		}
 		g_free(name);
 		name = NULL;
 		deleted |= flags;
@@ -446,7 +447,7 @@ text_index_compress_nosync(CamelIndex *idx)
 		}
 		while (data) {
 			if (camel_key_file_read(oldp->links, &data, &count, &records) == -1) {
-				io(printf("could not read from old keys at %d for word '%s'\n", (int)data, name));
+				io(printf("could not read from old keys at %d for word '%s'\n", (gint)data, name));
 				goto fail;
 			}
 			for (i=0;i<count;i++) {
@@ -525,7 +526,7 @@ fail:
 	return ret;
 }
 
-static int
+static gint
 text_index_delete(CamelIndex *idx)
 {
 	struct _CamelTextIndexPrivate *p = CTI_PRIVATE(idx);
@@ -539,7 +540,7 @@ text_index_delete(CamelIndex *idx)
 	return ret;
 }
 
-static int
+static gint
 text_index_rename(CamelIndex *idx, const gchar *path)
 {
 	struct _CamelTextIndexPrivate *p = CTI_PRIVATE(idx);
@@ -575,7 +576,7 @@ text_index_rename(CamelIndex *idx, const gchar *path)
 	return 0;
 }
 
-static int
+static gint
 text_index_has_name(CamelIndex *idx, const gchar *name)
 {
 	struct _CamelTextIndexPrivate *p = CTI_PRIVATE(idx);
@@ -636,7 +637,7 @@ hash_write_word(gchar *word, gpointer data, CamelIndexName *idn)
 	text_index_add_name_to_word(idn->index, word, tin->priv->nameid);
 }
 
-static int
+static gint
 text_index_write_name(CamelIndex *idx, CamelIndexName *idn)
 {
 	/* force 'flush' of any outstanding data */
@@ -1267,7 +1268,7 @@ camel_text_index_validate(CamelTextIndex *idx)
 	camel_block_t data;
 	gchar *oldword;
 	camel_key_t *records;
-	size_t count;
+	gsize count;
 
 	GHashTable *names, *deleted, *words, *keys, *name_word, *word_word;
 
@@ -1361,7 +1362,7 @@ camel_text_index_validate(CamelTextIndex *idx)
 				printf("Warning, read failed for word '%s', at data '%u'\n", word, data);
 				data = 0;
 			} else {
-				printf("(%d)\n", (int)count);
+				printf("(%d)\n", (gint)count);
 				g_free(records);
 			}
 		}
@@ -1464,8 +1465,8 @@ camel_utf8_next(const guchar **ptr, const guchar *ptrend)
 	return 0;
 }
 
-static size_t
-text_index_name_add_buffer(CamelIndexName *idn, const gchar *buffer, size_t len)
+static gsize
+text_index_name_add_buffer(CamelIndexName *idn, const gchar *buffer, gsize len)
 {
 	CamelTextIndexNamePrivate *p = CIN_PRIVATE(idn);
 	const guchar *ptr, *ptrend;
diff --git a/camel/camel-transport.c b/camel/camel-transport.c
index c14ceec..139b2c7 100644
--- a/camel/camel-transport.c
+++ b/camel/camel-transport.c
@@ -91,14 +91,14 @@ camel_transport_get_type (void)
 }
 
 
-static int
+static gint
 transport_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
 {
 	/* CamelTransport doesn't currently have anything to set */
 	return CAMEL_OBJECT_CLASS (parent_class)->setv (object, ex, args);
 }
 
-static int
+static gint
 transport_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	/* CamelTransport doesn't currently have anything to get */
diff --git a/camel/camel-trie.c b/camel/camel-trie.c
index 55d3643..e0fbc90 100644
--- a/camel/camel-trie.c
+++ b/camel/camel-trie.c
@@ -61,7 +61,7 @@ struct _CamelTrie {
 
 
 static inline gunichar
-trie_utf8_getc (const guchar **in, size_t inlen)
+trie_utf8_getc (const guchar **in, gsize inlen)
 {
 	register const guchar *inptr = *in;
 	const guchar *inend = inptr + inlen;
@@ -337,7 +337,7 @@ camel_trie_search (CamelTrie *trie, const gchar *buffer, gsize buflen,
                    gint *matched_id)
 {
 	const guchar *inptr, *inend, *prev, *pat;
-	register size_t inlen = buflen;
+	register gsize inlen = buflen;
 	struct _trie_state *q;
 	struct _trie_match *m = NULL; /* init to please gcc */
 	gunichar c;
diff --git a/camel/camel-uid-cache.h b/camel/camel-uid-cache.h
index 742bbbc..9acc06b 100644
--- a/camel/camel-uid-cache.h
+++ b/camel/camel-uid-cache.h
@@ -36,8 +36,8 @@ typedef struct {
 	gchar *filename;
 	GHashTable *uids;
 	guint level;
-	size_t expired;
-	size_t size;
+	gsize expired;
+	gsize size;
 	gint fd;
 } CamelUIDCache;
 
diff --git a/camel/camel-url-scanner.c b/camel/camel-url-scanner.c
index 36da666..2f77abc 100644
--- a/camel/camel-url-scanner.c
+++ b/camel/camel-url-scanner.c
@@ -74,7 +74,7 @@ camel_url_scanner_add (CamelUrlScanner *scanner, urlpattern_t *pattern)
 
 
 gboolean
-camel_url_scanner_scan (CamelUrlScanner *scanner, const gchar *in, size_t inlen, urlmatch_t *match)
+camel_url_scanner_scan (CamelUrlScanner *scanner, const gchar *in, gsize inlen, urlmatch_t *match)
 {
 	const gchar *pos;
 	const guchar *inptr, *inend;
@@ -140,13 +140,13 @@ enum {
 	IS_URLSAFE      = (1 << 7)
 };
 
-#define is_ctrl(x) ((url_scanner_table[(unsigned char)(x)] & IS_CTRL) != 0)
-#define is_lwsp(x) ((url_scanner_table[(unsigned char)(x)] & IS_LWSP) != 0)
-#define is_atom(x) ((url_scanner_table[(unsigned char)(x)] & (IS_SPECIAL|IS_SPACE|IS_CTRL)) == 0)
-#define is_alpha(x) ((url_scanner_table[(unsigned char)(x)] & IS_ALPHA) != 0)
-#define is_digit(x) ((url_scanner_table[(unsigned char)(x)] & IS_DIGIT) != 0)
-#define is_domain(x) ((url_scanner_table[(unsigned char)(x)] & IS_DOMAIN) != 0)
-#define is_urlsafe(x) ((url_scanner_table[(unsigned char)(x)] & (IS_ALPHA|IS_DIGIT|IS_URLSAFE)) != 0)
+#define is_ctrl(x) ((url_scanner_table[(guchar)(x)] & IS_CTRL) != 0)
+#define is_lwsp(x) ((url_scanner_table[(guchar)(x)] & IS_LWSP) != 0)
+#define is_atom(x) ((url_scanner_table[(guchar)(x)] & (IS_SPECIAL|IS_SPACE|IS_CTRL)) == 0)
+#define is_alpha(x) ((url_scanner_table[(guchar)(x)] & IS_ALPHA) != 0)
+#define is_digit(x) ((url_scanner_table[(guchar)(x)] & IS_DIGIT) != 0)
+#define is_domain(x) ((url_scanner_table[(guchar)(x)] & IS_DOMAIN) != 0)
+#define is_urlsafe(x) ((url_scanner_table[(guchar)(x)] & (IS_ALPHA|IS_DIGIT|IS_URLSAFE)) != 0)
 
 
 static const struct {
@@ -175,7 +175,7 @@ is_open_brace (gchar c)
 }
 
 static char
-url_stop_at_brace (const gchar *in, size_t so, gchar *open_brace)
+url_stop_at_brace (const gchar *in, gsize so, gchar *open_brace)
 {
 	gint i;
 
diff --git a/camel/camel-url-scanner.h b/camel/camel-url-scanner.h
index fc8cc74..dcf7cd5 100644
--- a/camel/camel-url-scanner.h
+++ b/camel/camel-url-scanner.h
@@ -47,8 +47,8 @@ gboolean camel_url_addrspec_start (const gchar *in, const gchar *pos, const gcha
 gboolean camel_url_addrspec_end (const gchar *in, const gchar *pos, const gchar *inend, urlmatch_t *match);
 
 typedef struct {
-	gchar *pattern;
-	gchar *prefix;
+	const gchar *pattern;
+	const gchar *prefix;
 	CamelUrlScanFunc start;
 	CamelUrlScanFunc end;
 } urlpattern_t;
@@ -60,7 +60,7 @@ void camel_url_scanner_free (CamelUrlScanner *scanner);
 
 void camel_url_scanner_add (CamelUrlScanner *scanner, urlpattern_t *pattern);
 
-gboolean camel_url_scanner_scan (CamelUrlScanner *scanner, const gchar *in, size_t inlen, urlmatch_t *match);
+gboolean camel_url_scanner_scan (CamelUrlScanner *scanner, const gchar *in, gsize inlen, urlmatch_t *match);
 
 G_END_DECLS
 
diff --git a/camel/camel-url.c b/camel/camel-url.c
index 6bb2abe..956d576 100644
--- a/camel/camel-url.c
+++ b/camel/camel-url.c
@@ -84,7 +84,7 @@ camel_url_new_with_base (CamelURL *base, const gchar *url_string)
 
 	/* Find protocol: initial [a-z+.-]* substring until ":" */
 	p = url_string;
-	while (p < end && (isalnum ((unsigned char)*p) ||
+	while (p < end && (isalnum ((guchar)*p) ||
 			   *p == '.' || *p == '+' || *p == '-'))
 		p++;
 
@@ -229,7 +229,7 @@ camel_url_new_with_base (CamelURL *base, const gchar *url_string)
 			last = base->path ? strrchr (base->path, '/') : NULL;
 			if (last) {
 				newpath = g_strdup_printf ("%.*s/%s",
-							   (int)(last - base->path),
+							   (gint)(last - base->path),
 							   base->path,
 							   url->path);
 			} else
@@ -604,7 +604,7 @@ append_url_encoded (GString *str, const gchar *in, const gchar *extra_enc_chars)
 	while (*s) {
 		if (url_encoded_char[*s] ||
 		    (extra_enc_chars && strchr (extra_enc_chars, *s)))
-			g_string_append_printf (str, "%%%02x", (int)*s++);
+			g_string_append_printf (str, "%%%02x", (gint)*s++);
 		else
 			g_string_append_c (str, *s++);
 	}
@@ -684,7 +684,7 @@ camel_url_hash (gconstpointer v)
 	return hash;
 }
 
-static int
+static gint
 check_equal (gchar *s1, gchar *s2)
 {
 	if (s1 == NULL) {
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 4ffb104..1b614a9 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -476,8 +476,8 @@ count_folder (CamelFolder *f, gchar *expr, CamelException *ex)
 {
 	return camel_folder_count_by_expression(f, expr, ex);
 }
-static int
-count_result (CamelFolderSummary *summary, gchar *query, CamelException *ex)
+static gint
+count_result (CamelFolderSummary *summary, const gchar *query, CamelException *ex)
 {
 	CamelFolder *folder = summary->folder;
 	CamelVeeFolder *vf = (CamelVeeFolder *)folder;
@@ -613,9 +613,9 @@ vee_sync(CamelFolder *folder, gboolean expunge, CamelException *ex)
 #endif
 	if (vf->priv->unread_vfolder == 1) {
 		/* Cleanup Junk/Trash uids */
+		GSList *del = NULL;
 		gint i, count;
 		count = folder->summary->uids->len;
-		GSList *del = NULL;
 
 		for (i=0; i < count; i++) {
 			CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)camel_folder_summary_index (folder->summary, i);
@@ -793,7 +793,7 @@ vee_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArray *uids
 						vuid = g_malloc(strlen(uid)+9);
 						memcpy(vuid, hash, 8);
 						strcpy(vuid+8, uid);
-						g_ptr_array_add(result, camel_pstring_strdup(vuid));
+						g_ptr_array_add(result, (gpointer) camel_pstring_strdup(vuid));
 						g_free(vuid);
 					}
 					camel_folder_search_free(f, matches);
@@ -1088,7 +1088,7 @@ folder_added_uid(gchar *uidin, gpointer value, struct _update_data *u)
 
 
 /* build query contents for a single folder */
-static int
+static gint
 vee_rebuild_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException *ex)
 {
 	GPtrArray *match, *all;
@@ -1979,7 +1979,7 @@ vee_set_expression(CamelVeeFolder *vf, const gchar *query)
 }
 
 /* This entire code will be useless, since we sync the counts always. */
-static int
+static gint
 vf_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	CamelFolder *folder = (CamelFolder *)object;
diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c
index 9d2e7ae..5e34075 100644
--- a/camel/camel-vee-store.c
+++ b/camel/camel-vee-store.c
@@ -40,7 +40,6 @@ static CamelFolder *vee_get_folder (CamelStore *store, const gchar *folder_name,
 static void vee_delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex);
 static void vee_rename_folder(CamelStore *store, const gchar *old, const gchar *new, CamelException *ex);
 
-static void vee_sync (CamelStore *store, gint expunge, CamelException *ex);
 static CamelFolder *vee_get_trash  (CamelStore *store, CamelException *ex);
 static CamelFolder *vee_get_junk  (CamelStore *store, CamelException *ex);
 
@@ -86,7 +85,6 @@ camel_vee_store_class_init (CamelVeeStoreClass *klass)
 	store_class->free_folder_info = camel_store_free_folder_info_full;
 	((CamelServiceClass *)store_class)->construct = construct;
 
-	/* store_class->sync = vee_sync; */
 	store_class->get_trash = vee_get_trash;
 	store_class->get_junk = vee_get_junk;
 }
@@ -221,12 +219,6 @@ vee_get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, Came
 	return (CamelFolder *)vf;
 }
 
-static void
-vee_sync(CamelStore *store, gint expunge, CamelException *ex)
-{
-	/* noop */;
-}
-
 static CamelFolder *
 vee_get_trash (CamelStore *store, CamelException *ex)
 {
@@ -239,7 +231,7 @@ vee_get_junk (CamelStore *store, CamelException *ex)
 	return NULL;
 }
 
-static int
+static gint
 vee_folder_cmp(gconstpointer ap, gconstpointer bp)
 {
 	return strcmp(((CamelFolder **)ap)[0]->full_name, ((CamelFolder **)bp)[0]->full_name);
diff --git a/camel/camel-vtrash-folder.c b/camel/camel-vtrash-folder.c
index 261608b..2383e03 100644
--- a/camel/camel-vtrash-folder.c
+++ b/camel/camel-vtrash-folder.c
@@ -116,7 +116,7 @@ camel_vtrash_folder_new (CamelStore *parent_store, camel_vtrash_folder_t type)
 }
 
 /* This entire code will be useless, since we sync the counts always. */
-static int
+static gint
 vtrash_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	CamelFolder *folder = (CamelFolder *)object;
@@ -311,345 +311,6 @@ vtrash_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 	}
 }
 
-/* FIXME[disk-summary] rewrite the same way as camel-vee-summary.c */
-static GPtrArray *
-vtrash_search_by_expression(CamelFolder *folder, const gchar *expression, CamelException *ex)
-{
-	GList *node;
-	GPtrArray *matches, *result = g_ptr_array_new(), *uids = g_ptr_array_new();
-	struct _CamelVeeFolderPrivate *p = ((CamelVeeFolder *)folder)->priv;
-	GPtrArray *infos = camel_folder_get_summary(folder);
-
-	/* we optimise the search by only searching for messages which we have anyway */
-	CAMEL_VEE_FOLDER_LOCK(folder, subfolder_lock);
-	node = p->folders;
-	while (node) {
-		CamelFolder *f = node->data;
-		gint i;
-		gchar hash[8];
-
-		camel_vee_folder_hash_folder(f, hash);
-
-		for (i=0;i<infos->len;i++) {
-			CamelVeeMessageInfo  *vmi = (CamelVeeMessageInfo *) camel_folder_summary_uid (folder->summary, infos->pdata[i]);
-			if (!vmi)
-				continue;
-			/* if (camel_message_info_flags(mi) & ((CamelVTrashFolder *)folder)->bit) */
-			if (vmi->summary == f->summary) /* Belongs to this folder */
-				g_ptr_array_add(uids, (gpointer)camel_pstring_strdup(infos->pdata[i]+8));
-			camel_message_info_free (vmi);
-		}
-
-                /* FIXME[disk-summary] search in the DB of the folder, for
-		 * the expression, with the vtrash bit (junk/trash) */
-		if (uids->len > 0
-		    && (matches = camel_folder_search_by_uids(f, expression, uids, NULL))) {
-			for (i = 0; i < matches->len; i++) {
-				gchar *uid = matches->pdata[i], *vuid;
-
-				vuid = g_malloc(strlen(uid)+9);
-				memcpy(vuid, hash, 8);
-				strcpy(vuid+8, uid);
-				g_ptr_array_add(result, (gpointer) camel_pstring_strdup(vuid));
-				g_free (vuid);
-			}
-			camel_folder_search_free(f, matches);
-		}
-		g_ptr_array_set_size(uids, 0);
-
-		node = g_list_next(node);
-	}
-	camel_folder_free_summary (folder, infos);
-	CAMEL_VEE_FOLDER_UNLOCK(folder, subfolder_lock);
-
-	g_ptr_array_foreach (uids, (GFunc) camel_pstring_free, NULL);
-	g_ptr_array_free(uids, TRUE);
-
-	return result;
-}
-
-static GPtrArray *
-vtrash_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArray *uids, CamelException *ex)
-{
-	GList *node;
-	GPtrArray *matches, *result = g_ptr_array_new(), *folder_uids = g_ptr_array_new();
-	struct _CamelVeeFolderPrivate *p = ((CamelVeeFolder *)folder)->priv;
-
-	CAMEL_VEE_FOLDER_LOCK(folder, subfolder_lock);
-
-	node = p->folders;
-	while (node) {
-		CamelFolder *f = node->data;
-		gint i;
-		gchar hash[8];
-
-		camel_vee_folder_hash_folder(f, hash);
-
-		/* map the vfolder uid's to the source folder uid's first */
-		/* FIXME[disk-summary] check this. is it uids od folder_uids */
-		/*g_ptr_array_set_size(uids, 0);*/
-		g_ptr_array_set_size (folder_uids, 0);
-		for (i=0;i<uids->len;i++) {
-			gchar *uid = uids->pdata[i];
-
-			/*if (strlen(uid) >= 8 && strncmp(uid, hash, 8) == 0) {*/
-			if (strncmp(uid, hash, 8) == 0) {
-#if 0
-				CamelMessageInfo *mi;
-				/* FIXME[disk-summary] is it really reqd, if
-				 * so uncomment it */
-				mi = camel_folder_get_message_info(f, uid+8);
-				if (mi) {
-					if(camel_message_info_flags(mi) & ((CamelVTrashFolder *)folder)->bit)
-						g_ptr_array_add(folder_uids, uid+8);
-					camel_folder_free_message_info(f, mi);
-				}
-#endif
-			}
-		}
-
-		if (folder_uids->len > 0
-		    && (matches = camel_folder_search_by_uids(f, expression, folder_uids, ex))) {
-			for (i = 0; i < matches->len; i++) {
-				gchar *uid = matches->pdata[i], *vuid;
-
-				vuid = g_malloc(strlen(uid)+9);
-				memcpy(vuid, hash, 8);
-				strcpy(vuid+8, uid);
-				g_ptr_array_add(result, (gpointer) camel_pstring_strdup(vuid));
-				g_free (vuid);
-			}
-			camel_folder_search_free(f, matches);
-		}
-		node = g_list_next(node);
-	}
-
-	CAMEL_VEE_FOLDER_UNLOCK(folder, subfolder_lock);
-
-	g_ptr_array_free(folder_uids, TRUE);
-
-	return result;
-}
-
-static void
-vtrash_uid_removed(CamelVTrashFolder *vf, const gchar *uid, gchar hash[8])
-{
-	gchar *vuid;
-
-	vuid = g_alloca(strlen(uid)+9);
-	memcpy(vuid, hash, 8);
-	strcpy(vuid+8, uid);
-	camel_folder_change_info_remove_uid(((CamelVeeFolder *)vf)->changes, vuid);
-	camel_folder_summary_remove_uid(((CamelFolder *)vf)->summary, vuid);
-}
-
-static void
-vtrash_uid_added(CamelVTrashFolder *vf, const gchar *uid, CamelFolderSummary *ssummary, gchar hash[8])
-{
-	gchar *vuid;
-	CamelVeeMessageInfo *vinfo;
-
-	vuid = g_alloca(strlen(uid)+9);
-	memcpy(vuid, hash, 8);
-	strcpy(vuid+8, uid);
-	vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(((CamelFolder *)vf)->summary, vuid);
-	if (vinfo == NULL) {
-		CamelMessageInfo *tinfo;
-		tinfo = (CamelMessageInfo *) camel_vee_summary_add((CamelVeeSummary *)((CamelFolder *)vf)->summary, ssummary, uid, hash);
-		if (tinfo) {
-			camel_folder_change_info_add_uid(((CamelVeeFolder *)vf)->changes, vuid);
-			camel_message_info_free (tinfo);
-		}
-	}
-}
-
-static void
-vtrash_folder_changed(CamelVeeFolder *vf, CamelFolder *sub, CamelFolderChangeInfo *changes)
-{
-	CamelMessageInfo *info;
-	gchar hash[8];
-	CamelFolderChangeInfo *vf_changes = NULL;
-	gint i;
-
-	camel_vee_folder_hash_folder(sub, hash);
-
-	CAMEL_VEE_FOLDER_LOCK(vf, summary_lock);
-
-	/* remove any removed that we also have */
-	for (i=0;i<changes->uid_removed->len;i++)
-		vtrash_uid_removed((CamelVTrashFolder *)vf, (const gchar *)changes->uid_removed->pdata[i], hash);
-
-	/* check any changed still deleted/junked */
-	for (i=0;i<changes->uid_changed->len;i++) {
-		const gchar *uid = changes->uid_changed->pdata[i];
-
-		info = camel_folder_get_message_info(sub, uid);
-		if (info == NULL)
-			continue;
-
-		if ((camel_message_info_flags(info) & ((CamelVTrashFolder *)vf)->bit) == 0)
-			vtrash_uid_removed((CamelVTrashFolder *)vf, uid, hash);
-		else
-			vtrash_uid_added((CamelVTrashFolder *)vf, uid, sub->summary, hash);
-
-		camel_message_info_free(info);
-	}
-
-	/* add any new ones which are already matching */
-	for (i=0;i<changes->uid_added->len;i++) {
-		const gchar *uid = changes->uid_added->pdata[i];
-
-		info = camel_folder_get_message_info(sub, uid);
-		if (info == NULL)
-			continue;
-
-		if ((camel_message_info_flags(info) & ((CamelVTrashFolder *)vf)->bit) != 0)
-			vtrash_uid_added((CamelVTrashFolder *)vf, uid, sub->summary, hash);
-
-		camel_message_info_free(info);
-	}
-
-	if (camel_folder_change_info_changed(((CamelVeeFolder *)vf)->changes)) {
-		vf_changes = ((CamelVeeFolder *)vf)->changes;
-		((CamelVeeFolder *)vf)->changes = camel_folder_change_info_new();
-	}
-
-	CAMEL_VEE_FOLDER_UNLOCK(vf, summary_lock);
-
-	if (vf_changes) {
-		camel_object_trigger_event(vf, "folder_changed", vf_changes);
-		camel_folder_change_info_free(vf_changes);
-	}
-}
-
-static void
-vtrash_add_folder(CamelVeeFolder *vf, CamelFolder *sub)
-{
-	GPtrArray *infos=NULL;
-	gint i;
-	gchar hash[8], *shash;
-	CamelFolderChangeInfo *vf_changes = NULL;
-
-	camel_vee_folder_hash_folder(sub, hash);
-	shash = g_strdup_printf("%c%c%c%c%c%c%c%c", hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7]);
-	if (!g_hash_table_lookup (vf->hashes, shash))
-		g_hash_table_insert (vf->hashes, g_strdup(shash), sub->summary);
-
-	CAMEL_VEE_FOLDER_LOCK(vf, summary_lock);
-
-	if (((CamelVTrashFolder *)vf)->bit == CAMEL_MESSAGE_DELETED) {
-		infos = camel_db_get_folder_deleted_uids (sub->parent_store->cdb_w, sub->full_name, NULL);
-		if (infos) {
-			((CamelFolder *)vf)->summary->saved_count += infos->len;
-			((CamelFolder *)vf)->summary->deleted_count += infos->len;
-		}
-	}
-	else if (((CamelVTrashFolder *)vf)->bit == CAMEL_MESSAGE_JUNK)
-		infos = camel_db_get_folder_junk_uids (sub->parent_store->cdb_w, sub->full_name, NULL);
-
-	if (!infos) {
-		CAMEL_VEE_FOLDER_UNLOCK(vf, summary_lock);
-		g_free (shash);
-		return;
-	}
-
-	for (i=0;i<infos->len;i++) {
-		gchar *uid = infos->pdata[i];
-		vtrash_uid_added((CamelVTrashFolder *)vf, uid, sub->summary, hash);
-	}
-
-	g_ptr_array_foreach (infos, (GFunc) camel_pstring_free, NULL);
-	g_ptr_array_free (infos, TRUE);
-
-	if (camel_folder_change_info_changed(vf->changes)) {
-		vf_changes = vf->changes;
-		vf->changes = camel_folder_change_info_new();
-	}
-
-	CAMEL_VEE_FOLDER_UNLOCK(vf, summary_lock);
-
-	if (vf_changes) {
-		camel_object_trigger_event(vf, "folder_changed", vf_changes);
-		camel_folder_change_info_free(vf_changes);
-	}
-
-	g_free(shash);
-}
-
-static void
-vtrash_remove_folder(CamelVeeFolder *vf, CamelFolder *sub)
-{
-	GPtrArray *infos;
-	gint i;
-	gchar hash[8], *shash;
-	CamelFolderChangeInfo *vf_changes = NULL;
-	CamelFolderSummary *ssummary = sub->summary;
-	gint start, last;
-
-
-
-	CAMEL_VEE_FOLDER_LOCK(vf, summary_lock);
-
-	start = -1;
-	last = -1;
-	infos = camel_folder_get_summary ((CamelFolder *) vf);
-	for (i=0;i<infos->len;i++) {
-
-		CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *) camel_folder_summary_uid (((CamelFolder *)vf)->summary, infos->pdata[i]);
-		if (mi == NULL)
-			continue;
-		if (mi->summary == NULL) {
-			camel_message_info_free (mi);
-			continue;
-		}
-
-		if (mi->summary == ssummary) {
-			const gchar *uid = camel_message_info_uid(mi);
-
-			camel_folder_change_info_remove_uid(vf->changes, uid);
-
-			if (last == -1) {
-				last = start = i;
-			} else if (last+1 == i) {
-				last = i;
-			} else {
-				camel_folder_summary_remove_range(((CamelFolder *)vf)->summary, start, last);
-				i -= (last-start)+1;
-				start = last = i;
-			}
-		}
-		camel_message_info_free (mi);
-	}
-	camel_folder_free_summary(sub, infos);
-
-	if (last != -1)
-		camel_folder_summary_remove_range(((CamelFolder *)vf)->summary, start, last);
-
-	if (camel_folder_change_info_changed(vf->changes)) {
-		vf_changes = vf->changes;
-		vf->changes = camel_folder_change_info_new();
-	}
-
-	CAMEL_VEE_FOLDER_UNLOCK(vf, summary_lock);
-
-	camel_vee_folder_hash_folder(sub, hash);
-	shash = g_strdup_printf("%c%c%c%c%c%c%c%c", hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7]);
-	if (g_hash_table_lookup (vf->hashes, shash))
-		g_hash_table_remove (vf->hashes, shash);
-	g_free(shash);
-	if (vf_changes) {
-		camel_object_trigger_event(vf, "folder_changed", vf_changes);
-		camel_folder_change_info_free(vf_changes);
-	}
-}
-
-static int
-vtrash_rebuild_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException *ex)
-{
-	/* we should always be in sync */
-	return 0;
-}
-
 static void
 camel_vtrash_folder_class_init (CamelVTrashFolderClass *klass)
 {
@@ -662,14 +323,4 @@ camel_vtrash_folder_class_init (CamelVTrashFolderClass *klass)
 
 	folder_class->append_message = vtrash_append_message;
 	folder_class->transfer_messages_to = vtrash_transfer_messages_to;
-	/* Not required, lets use the base class search function */
-	/* folder_class->search_by_expression = vtrash_search_by_expression; */
-	/* folder_class->search_by_uids = vtrash_search_by_uids; */
-#if 0
-	((CamelVeeFolderClass *)klass)->add_folder = vtrash_add_folder;
-	((CamelVeeFolderClass *)klass)->remove_folder = vtrash_remove_folder;
-	((CamelVeeFolderClass *)klass)->rebuild_folder = vtrash_rebuild_folder;
-
-	((CamelVeeFolderClass *)klass)->folder_changed = vtrash_folder_changed;
-#endif
 }
diff --git a/camel/db-scrap-tools/db.c b/camel/db-scrap-tools/db.c
index 1aaccb8..c156c45 100644
--- a/camel/db-scrap-tools/db.c
+++ b/camel/db-scrap-tools/db.c
@@ -6,7 +6,7 @@
 
 sqlite3 *db;
 
-static int
+static gint
 callback (gpointer data, gint argc, gchar **argv, gchar **azColName)
 {
 	gint i;
@@ -18,7 +18,7 @@ callback (gpointer data, gint argc, gchar **argv, gchar **azColName)
 	return 0;
 }
 
-static int
+static gint
 select_stmt (const gchar * stmt) {
 	gchar *errmsg;
 	gint   ret;
@@ -35,7 +35,7 @@ select_stmt (const gchar * stmt) {
 	return ret;
 }
 
-static int
+static gint
 sql_stmt(const gchar * stmt) {
 	gchar *errmsg;
 	gint   ret;
@@ -52,7 +52,7 @@ sql_stmt(const gchar * stmt) {
 
 #define CREATE_STMT "CREATE TABLE %s (uid TEXT PRIMARY KEY, gflags INTEGER, isize INTEGER, dsent INTEGER, dreceived INTEGER, jsubject TEXT, ffrom TEXT, tto TEXT, cc TEXT, mlist TEXT, part TEXT, userflags TEXT, usertags TEXT, bdata TEXT)"
 
-static int
+static gint
 create_table (const gchar *tablename)
 {
 	gchar *cmd = malloc (sizeof(CREATE_STMT)+20);
diff --git a/camel/providers/groupwise/camel-groupwise-folder.c b/camel/providers/groupwise/camel-groupwise-folder.c
index cec0aab..436dfef 100644
--- a/camel/providers/groupwise/camel-groupwise-folder.c
+++ b/camel/providers/groupwise/camel-groupwise-folder.c
@@ -83,6 +83,8 @@ struct _CamelGroupwiseFolderPrivate {
 
 };
 
+extern gint camel_application_is_exiting;
+
 /*prototypes*/
 static void groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *destination, GPtrArray **transferred_uids, gboolean delete_originals, CamelException *ex);
 static gint gw_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args);
@@ -126,7 +128,6 @@ groupwise_folder_get_message( CamelFolder *folder, const gchar *uid, CamelExcept
 	EGwConnection *cnc;
 	EGwItem *item;
 	CamelStream *stream, *cache_stream;
-	gint errno;
 
 	/* see if it is there in cache */
 
@@ -182,7 +183,7 @@ groupwise_folder_get_message( CamelFolder *folder, const gchar *uid, CamelExcept
 		return NULL;
 	}
 
-	container_id =  g_strdup (camel_groupwise_store_container_id_lookup (gw_store, folder->full_name)) ;
+	container_id =  g_strdup (camel_groupwise_store_container_id_lookup (gw_store, folder->full_name));
 
 	cnc = cnc_lookup (priv);
 
@@ -242,9 +243,10 @@ groupwise_populate_details_from_item (CamelMimeMessage *msg, EGwItem *item)
 	type = e_gw_item_get_item_type (item);
 
 	if (type == E_GW_ITEM_TYPE_APPOINTMENT  || type == E_GW_ITEM_TYPE_NOTE || type == E_GW_ITEM_TYPE_TASK) {
+		time_t actual_time;
 		gint offset = 0;
 		dtstring = e_gw_item_get_start_date (item);
-		time_t actual_time = e_gw_connection_get_date_from_string (dtstring);
+		actual_time = e_gw_connection_get_date_from_string (dtstring);
 		camel_mime_message_set_date (msg, actual_time, offset);
 		return;
 	}
@@ -353,7 +355,7 @@ groupwise_msg_set_recipient_list (CamelMimeMessage *msg, EGwItem *item)
 		gchar *status_opt = NULL;
 		gboolean enabled;
 
-		for (rl = recipient_list ; rl != NULL ; rl = rl->next) {
+		for (rl = recipient_list; rl != NULL; rl = rl->next) {
 			EGwItemRecipient *recp = (EGwItemRecipient *) rl->data;
 			enabled = recp->status_enabled;
 
@@ -714,7 +716,7 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 	}
 	cnc = cnc_lookup (priv);
 
-	container_id =  camel_groupwise_store_container_id_lookup (gw_store, folder->full_name) ;
+	container_id =  camel_groupwise_store_container_id_lookup (gw_store, folder->full_name);
 
 	CAMEL_SERVICE_REC_LOCK (gw_store, connect_lock);
 	if (!camel_groupwise_store_connected (gw_store, ex)) {
@@ -725,11 +727,11 @@ groupwise_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 	CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
 
 	if (folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED)
-		return ;
+		return;
 
 	count = camel_folder_summary_count (folder->summary);
 	CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
-	for (i=0 ; i < count ; i++) {
+	for (i=0; i < count; i++) {
 		guint32 flags = 0;
 		info = camel_folder_summary_index (folder->summary, i);
 		gw_info = (CamelGroupwiseMessageInfo *) info;
@@ -991,8 +993,6 @@ static void
 update_update (CamelSession *session, CamelSessionThreadMsg *msg)
 {
 
-	extern gint camel_application_is_exiting;
-
 	struct _folder_update_msg *m = (struct _folder_update_msg *)msg;
 	EGwConnectionStatus status;
 	CamelException *ex = NULL;
@@ -1030,7 +1030,7 @@ update_update (CamelSession *session, CamelSessionThreadMsg *msg)
 
 		if (camel_application_is_exiting) {
 				CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
-				return ;
+				return;
 		}
 
 		item_list = NULL;
@@ -1150,7 +1150,7 @@ groupwise_refresh_info(CamelFolder *folder, CamelException *ex)
 	}
 }
 
-static int
+static gint
 check_for_new_mails_count (CamelGroupwiseSummary *gw_summary, GSList *ids)
 {
 	CamelFolderSummary *summary = (CamelFolderSummary *) gw_summary;
@@ -1171,7 +1171,7 @@ check_for_new_mails_count (CamelGroupwiseSummary *gw_summary, GSList *ids)
 	return count;
 }
 
-static int
+static gint
 compare_ids (gpointer a, gpointer b, gpointer data)
 {
 	EGwItem *item1 = (EGwItem *) a;
@@ -1184,7 +1184,7 @@ compare_ids (gpointer a, gpointer b, gpointer data)
 	return strcmp (id1, id2);
 }
 
-static int
+static gint
 get_merge_lists_new_count (CamelGroupwiseSummary *summary, GSList *new, GSList *modified, GSList **merged)
 {
 	GSList *l, *element;
@@ -1263,7 +1263,7 @@ groupwise_refresh_folder(CamelFolder *folder, CamelException *ex)
 		return;
 	}
 
-	container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, folder->full_name)) ;
+	container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, folder->full_name));
 
 	if (!container_id) {
 		d (printf ("\nERROR - Container id not present. Cannot refresh info for %s\n", folder->full_name));
@@ -1310,7 +1310,7 @@ groupwise_refresh_folder(CamelFolder *folder, CamelException *ex)
 
 	/*Get the New Items*/
 	if (!is_proxy) {
-		gchar *source;
+		const gchar *source;
 
 		if ( !strcmp (folder->full_name, RECEIVED) || !strcmp(folder->full_name, SENT) ) {
 			source = NULL;
@@ -1468,8 +1468,8 @@ gw_update_cache (CamelFolder *folder, GList *list, CamelException *ex, gboolean
 
 	camel_operation_start (NULL, _("Fetching summary information for new messages in %s"), folder->name);
 
-	for ( ; item_list != NULL ; item_list = g_list_next (item_list) ) {
-		EGwItem *temp_item ;
+	for (; item_list != NULL; item_list = g_list_next (item_list) ) {
+		EGwItem *temp_item;
 		EGwItem *item;
 		EGwItemType type = E_GW_ITEM_TYPE_UNKNOWN;
 		EGwItemOrganizer *org;
@@ -1725,7 +1725,7 @@ gw_update_summary ( CamelFolder *folder, GList *list,CamelException *ex)
 		is_junk = TRUE;
 	}
 
-	for (; item_list != NULL ; item_list = g_list_next (item_list) ) {
+	for (; item_list != NULL; item_list = g_list_next (item_list) ) {
 		EGwItem *item = (EGwItem *)item_list->data;
 		EGwItemType type = E_GW_ITEM_TYPE_UNKNOWN;
 		EGwItemOrganizer *org;
@@ -1876,7 +1876,6 @@ groupwise_folder_item_to_msg( CamelFolder *folder,
 	EGwConnectionStatus status;
 	EGwConnection *cnc;
 	CamelMultipart *multipart = NULL;
-	gint errno;
 	gchar *body = NULL;
 	gint body_len = 0;
 	const gchar *uid = NULL;
@@ -1924,7 +1923,7 @@ groupwise_folder_item_to_msg( CamelFolder *folder,
 		} /* if Mime.822 or TEXT.htm */
 
 		if (!ignore_mime_822) {
-			for (al = attach_list ; al != NULL ; al = al->next) {
+			for (al = attach_list; al != NULL; al = al->next) {
 				EGwItemAttachment *attach = (EGwItemAttachment *)al->data;
 				if (!g_ascii_strcasecmp (attach->name, "Mime.822")) {
 					if (attach->size > MAX_ATTACHMENT_SIZE) {
@@ -2033,7 +2032,7 @@ groupwise_folder_item_to_msg( CamelFolder *folder,
 		gboolean has_boundary = FALSE;
 		GSList *al;
 
-		for (al = attach_list ; al != NULL ; al = al->next) {
+		for (al = attach_list; al != NULL; al = al->next) {
 			EGwItemAttachment *attach = (EGwItemAttachment *)al->data;
 			gchar *attachment = NULL;
 			gint len = 0;
@@ -2263,7 +2262,7 @@ groupwise_append_message (CamelFolder *folder, CamelMimeMessage *message,
 
 	CAMEL_SERVICE_REC_LOCK (folder->parent_store, connect_lock);
 	/*Get the container id*/
-	container_id = camel_groupwise_store_container_id_lookup (gw_store, folder->full_name) ;
+	container_id = camel_groupwise_store_container_id_lookup (gw_store, folder->full_name);
 
 	item = camel_groupwise_util_item_from_message (cnc, message, CAMEL_ADDRESS (message->from));
 	/*Set the source*/
@@ -2311,11 +2310,11 @@ groupwise_append_message (CamelFolder *folder, CamelMimeMessage *message,
 
 /* A function to compare uids, inspired by strcmp .
 This code was used in some other provider also , imap4rev1 iirc */
-static int
+static gint
 uid_compar (gconstpointer va, gconstpointer vb)
 {
 	const gchar **sa = (const gchar **)va, **sb = (const gchar **)vb;
-	unsigned long a, b;
+	gulong a, b;
 
 	a = strtoul (*sa, NULL, 10);
 	b = strtoul (*sb, NULL, 10);
@@ -2362,10 +2361,10 @@ groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
 		*transferred_uids = NULL;
 
 	if (delete_originals)
-		source_container_id = camel_groupwise_store_container_id_lookup (gw_store, source->full_name) ;
+		source_container_id = camel_groupwise_store_container_id_lookup (gw_store, source->full_name);
 	else
 		source_container_id = NULL;
-	dest_container_id = camel_groupwise_store_container_id_lookup (gw_store, destination->full_name) ;
+	dest_container_id = camel_groupwise_store_container_id_lookup (gw_store, destination->full_name);
 
 	CAMEL_SERVICE_REC_LOCK (source->parent_store, connect_lock);
 	/* check for offline operation */
@@ -2569,7 +2568,7 @@ groupwise_expunge (CamelFolder *folder, CamelException *ex)
 
 	changes = camel_folder_change_info_new ();
 
-	container_id =  g_strdup (camel_groupwise_store_container_id_lookup (groupwise_store, folder->full_name)) ;
+	container_id =  g_strdup (camel_groupwise_store_container_id_lookup (groupwise_store, folder->full_name));
 
 	max = camel_folder_summary_count (folder->summary);
 	for (i = 0; i < max; i++) {
@@ -2727,14 +2726,14 @@ camel_groupwise_folder_get_type (void)
 	return camel_groupwise_folder_type;
 }
 
-static int
+static gint
 gw_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	CamelFolder *folder = (CamelFolder *)object;
 	gint i, count = 0;
 	guint32 tag;
 
-	for (i=0 ; i<args->argc ; i++) {
+	for (i=0; i<args->argc; i++) {
 		CamelArgGet *arg = &args->argv[i];
 
 		tag = arg->tag;
@@ -2825,9 +2824,9 @@ convert_to_calendar (EGwItem *item, gchar **str, gint *len)
 
 	recp_list = e_gw_item_get_recipient_list (item);
 	if (recp_list) {
-		GSList *rl ;
+		GSList *rl;
 
-		for (rl = recp_list ; rl != NULL ; rl = rl->next) {
+		for (rl = recp_list; rl != NULL; rl = rl->next) {
 			EGwItemRecipient *recp = (EGwItemRecipient *) rl->data;
 			g_string_append_printf (gstr,
 					"ATTENDEE;CN= %s;ROLE= REQ-PARTICIPANT:\nMAILTO:%s\n",
@@ -2854,7 +2853,7 @@ convert_to_calendar (EGwItem *item, gchar **str, gint *len)
 	if (attach_list) {
 		GSList *al;
 
-		for (al = attach_list ; al != NULL ; al = al->next) {
+		for (al = attach_list; al != NULL; al = al->next) {
 			EGwItemAttachment *attach = (EGwItemAttachment *)al->data;
 			g_string_append_printf (gstr, "ATTACH:%s\n", attach->id);
 		}
@@ -2920,7 +2919,7 @@ convert_to_task (EGwItem *item, gchar **str, gint *len)
 	if (recp_list) {
 		GSList *rl;
 
-		for (rl = recp_list ; rl != NULL ; rl = rl->next) {
+		for (rl = recp_list; rl != NULL; rl = rl->next) {
 			EGwItemRecipient *recp = (EGwItemRecipient *) rl->data;
 			g_string_append_printf (gstr,
 					"ATTENDEE;CN= %s;ROLE= REQ-PARTICIPANT:\nMAILTO:%s\n",
diff --git a/camel/providers/groupwise/camel-groupwise-folder.h b/camel/providers/groupwise/camel-groupwise-folder.h
index 95d30a5..e1a5544 100644
--- a/camel/providers/groupwise/camel-groupwise-folder.h
+++ b/camel/providers/groupwise/camel-groupwise-folder.h
@@ -78,8 +78,8 @@ struct _CamelGroupwiseFolderClass {
 CamelType camel_groupwise_folder_get_type (void);
 
 /* implemented */
-CamelFolder * camel_gw_folder_new(CamelStore *store, const gchar *folder_dir, const gchar *folder_name, CamelException *ex) ;
-void gw_update_summary ( CamelFolder *folder, GList *item_list,CamelException *ex) ;
+CamelFolder * camel_gw_folder_new(CamelStore *store, const gchar *folder_dir, const gchar *folder_name, CamelException *ex);
+void gw_update_summary ( CamelFolder *folder, GList *item_list,CamelException *ex);
 void groupwise_refresh_folder(CamelFolder *folder, CamelException *ex);
 
 G_END_DECLS
diff --git a/camel/providers/groupwise/camel-groupwise-journal.c b/camel/providers/groupwise/camel-groupwise-journal.c
index 023ad48..91042ff 100644
--- a/camel/providers/groupwise/camel-groupwise-journal.c
+++ b/camel/providers/groupwise/camel-groupwise-journal.c
@@ -158,7 +158,7 @@ groupwise_entry_load (CamelOfflineJournal *journal, FILE *in)
 	return NULL;
 }
 
-static int
+static gint
 groupwise_entry_write (CamelOfflineJournal *journal, CamelDListNode *entry, FILE *out)
 {
 	CamelGroupwiseJournalEntry *groupwise_entry = (CamelGroupwiseJournalEntry *) entry;
@@ -197,7 +197,7 @@ gw_message_info_dup_to (CamelMessageInfoBase *dest, CamelMessageInfoBase *src)
 	dest->size = src->size;
 }
 
-static int
+static gint
 groupwise_entry_play_append (CamelOfflineJournal *journal, CamelGroupwiseJournalEntry *entry, CamelException *ex)
 {
 	CamelGroupwiseFolder *gw_folder = (CamelGroupwiseFolder *) journal->folder;
@@ -243,7 +243,7 @@ groupwise_entry_play_append (CamelOfflineJournal *journal, CamelGroupwiseJournal
 	return 0;
 }
 
-static int
+static gint
 groupwise_entry_play_transfer (CamelOfflineJournal *journal, CamelGroupwiseJournalEntry *entry, CamelException *ex)
 {
 	CamelGroupwiseFolder *gw_folder = (CamelGroupwiseFolder *) journal->folder;
@@ -301,7 +301,7 @@ groupwise_entry_play_transfer (CamelOfflineJournal *journal, CamelGroupwiseJourn
 	return -1;
 }
 
-static int
+static gint
 groupwise_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, CamelException *ex)
 {
 	CamelGroupwiseJournalEntry *groupwise_entry = (CamelGroupwiseJournalEntry *) entry;
@@ -417,7 +417,7 @@ camel_groupwise_journal_transfer (CamelGroupwiseJournal *groupwise_journal, Came
 				  CamelException *ex)
 {
 	CamelOfflineJournal *journal = (CamelOfflineJournal *) groupwise_journal;
-	CamelGroupwiseStore *gw_store= CAMEL_GROUPWISE_STORE(journal->folder->parent_store) ;
+	CamelGroupwiseStore *gw_store= CAMEL_GROUPWISE_STORE(journal->folder->parent_store);
 	CamelGroupwiseJournalEntry *entry;
 	gchar *uid;
 
diff --git a/camel/providers/groupwise/camel-groupwise-provider.c b/camel/providers/groupwise/camel-groupwise-provider.c
index a3ce5b7..91f64d3 100644
--- a/camel/providers/groupwise/camel-groupwise-provider.c
+++ b/camel/providers/groupwise/camel-groupwise-provider.c
@@ -112,7 +112,7 @@ CamelServiceAuthType camel_groupwise_password_authtype = {
 	TRUE
 };
 
-static int
+static gint
 groupwise_auto_detect_cb (CamelURL *url, GHashTable **auto_detected,
 			 CamelException *ex)
 {
diff --git a/camel/providers/groupwise/camel-groupwise-store-summary.c b/camel/providers/groupwise/camel-groupwise-store-summary.c
index 985d5fe..0a8104c 100644
--- a/camel/providers/groupwise/camel-groupwise-store-summary.c
+++ b/camel/providers/groupwise/camel-groupwise-store-summary.c
@@ -47,13 +47,13 @@ static void namespace_clear(CamelStoreSummary *s);
 static gint summary_header_load(CamelStoreSummary *, FILE *);
 static gint summary_header_save(CamelStoreSummary *, FILE *);
 
-static CamelStoreInfo *store_info_load(CamelStoreSummary *s, FILE *in) ;
-static gint store_info_save(CamelStoreSummary *s, FILE *out, CamelStoreInfo *mi) ;
-static void store_info_free(CamelStoreSummary *s, CamelStoreInfo *mi) ;
-static void store_info_set_string(CamelStoreSummary *s, CamelStoreInfo *mi, gint type, const gchar *str) ;
+static CamelStoreInfo *store_info_load(CamelStoreSummary *s, FILE *in);
+static gint store_info_save(CamelStoreSummary *s, FILE *out, CamelStoreInfo *mi);
+static void store_info_free(CamelStoreSummary *s, CamelStoreInfo *mi);
+static void store_info_set_string(CamelStoreSummary *s, CamelStoreInfo *mi, gint type, const gchar *str);
 
-static const gchar *store_info_string(CamelStoreSummary *s, const CamelStoreInfo *mi, gint type) ;
-CamelGroupwiseStoreNamespace *camel_groupwise_store_summary_namespace_find_full(CamelGroupwiseStoreSummary *s, const gchar *full) ;
+static const gchar *store_info_string(CamelStoreSummary *s, const CamelStoreInfo *mi, gint type);
+CamelGroupwiseStoreNamespace *camel_groupwise_store_summary_namespace_find_full(CamelGroupwiseStoreSummary *s, const gchar *full);
 
 static void camel_groupwise_store_summary_class_init (CamelGroupwiseStoreSummaryClass *klass);
 static void camel_groupwise_store_summary_init       (CamelGroupwiseStoreSummary *obj);
@@ -177,7 +177,7 @@ static guint32 hexnib(guint32 c)
 		return 0;
 }
 
-static int
+static gint
 namespace_save(CamelStoreSummary *s, FILE *in, CamelGroupwiseStoreNamespace *ns)
 {
 	if (camel_file_util_encode_string(in, ns->path) == -1
@@ -228,7 +228,7 @@ namespace_load(CamelStoreSummary *s, FILE *in)
 gchar *
 camel_groupwise_store_summary_path_to_full(CamelGroupwiseStoreSummary *s, const gchar *path, gchar dir_sep)
 {
-	guchar *full, *f;
+	gchar *full, *f;
 	guint32 c, v = 0;
 	const gchar *p;
 	gint state=0;
@@ -273,7 +273,7 @@ camel_groupwise_store_summary_path_to_full(CamelGroupwiseStoreSummary *s, const
 				else {
 					if (c == '/')
 						c = dir_sep;
-					camel_utf8_putc(&f, c);
+					camel_utf8_putc((guchar **) &f, c);
 				}
 				break;
 			case 1:
@@ -283,11 +283,11 @@ camel_groupwise_store_summary_path_to_full(CamelGroupwiseStoreSummary *s, const
 			case 2:
 				state = 0;
 				v |= hexnib(c);
-				camel_utf8_putc(&f, v);
+				camel_utf8_putc((guchar **) &f, v);
 				break;
 		}
 	}
-	camel_utf8_putc(&f, c);
+	camel_utf8_putc((guchar **) &f, c);
 
 	/* merge old path part if required */
 	f = g_strdup (full);
@@ -301,7 +301,7 @@ camel_groupwise_store_summary_path_to_full(CamelGroupwiseStoreSummary *s, const
 		g_free(f);
 		f = full;
 	}
-	return f ;
+	return f;
 }
 
 CamelGroupwiseStoreNamespace *
@@ -378,8 +378,9 @@ camel_groupwise_store_summary_add_from_full(CamelGroupwiseStoreSummary *s, const
 	if (info) {
 		d(printf("  '%s' -> '%s'\n", pathu8, full_name));
 		camel_store_info_set_string((CamelStoreSummary *)s, (CamelStoreInfo *)info, CAMEL_STORE_INFO_LAST, full_name);
-	} else
+	} else {
 		d(printf("  failed\n"));
+	}
 
 	return info;
 }
@@ -458,41 +459,41 @@ camel_groupwise_store_summary_namespace_find_path(CamelGroupwiseStoreSummary *s,
 
 
 
-static int
+static gint
 summary_header_load(CamelStoreSummary *s, FILE *in)
 {
-	CamelGroupwiseStoreSummary *summary = (CamelGroupwiseStoreSummary *)s ;
-	 gint32 version, capabilities, count ;
+	CamelGroupwiseStoreSummary *summary = (CamelGroupwiseStoreSummary *)s;
+	 gint32 version, capabilities, count;
 
-	namespace_clear (s) ;
+	namespace_clear (s);
 
 	if (camel_groupwise_store_summary_parent->summary_header_load ((CamelStoreSummary *)s, in) == -1
 			|| camel_file_util_decode_fixed_int32(in, &version) == -1)
-		return -1 ;
+		return -1;
 
-	summary->version = version ;
+	summary->version = version;
 
 	if (camel_file_util_decode_fixed_int32(in, &capabilities) == -1
 			|| camel_file_util_decode_fixed_int32(in, &count) == -1
 			|| count > 1)
 		return -1;
 
-	summary->capabilities = capabilities ;
+	summary->capabilities = capabilities;
 	if (count == 1) {
 		if ((summary->namespace = namespace_load (s, in)) == NULL)
-			return -1 ;
+			return -1;
 	}
-	return 0 ;
+	return 0;
 }
 
 
-static int
+static gint
 summary_header_save(CamelStoreSummary *s, FILE *out)
 {
-	CamelGroupwiseStoreSummary *summary = (CamelGroupwiseStoreSummary *) s ;
-	guint32 count ;
+	CamelGroupwiseStoreSummary *summary = (CamelGroupwiseStoreSummary *) s;
+	guint32 count;
 
-	count = summary->namespace?1:0 ;
+	count = summary->namespace?1:0;
 	if (camel_groupwise_store_summary_parent->summary_header_save((CamelStoreSummary *)s, out) == -1
 			|| camel_file_util_encode_fixed_int32(out, 0) == -1
 			|| camel_file_util_encode_fixed_int32(out, summary->capabilities) == -1
@@ -503,7 +504,7 @@ summary_header_save(CamelStoreSummary *s, FILE *out)
 		return -1;
 
 
-	return 0 ;
+	return 0;
 }
 
 static CamelStoreInfo *
@@ -522,7 +523,7 @@ store_info_load(CamelStoreSummary *s, FILE *in)
 	return (CamelStoreInfo *)si;
 }
 
-static int
+static gint
 store_info_save(CamelStoreSummary *s, FILE *out, CamelStoreInfo *mi)
 {
 	CamelGroupwiseStoreInfo *summary = (CamelGroupwiseStoreInfo *)mi;
diff --git a/camel/providers/groupwise/camel-groupwise-store-summary.h b/camel/providers/groupwise/camel-groupwise-store-summary.h
index 4d6bd0a..97b9c8e 100644
--- a/camel/providers/groupwise/camel-groupwise-store-summary.h
+++ b/camel/providers/groupwise/camel-groupwise-store-summary.h
@@ -72,16 +72,16 @@ struct _CamelGroupwiseStoreSummaryClass {
 
 CamelType                        camel_groupwise_store_summary_get_type      (void);
 CamelGroupwiseStoreSummary      *camel_groupwise_store_summary_new        (void);
-CamelGroupwiseStoreInfo *camel_groupwise_store_summary_full_name(CamelGroupwiseStoreSummary *s, const gchar *full_name) ;
-CamelGroupwiseStoreInfo *camel_groupwise_store_summary_add_from_full(CamelGroupwiseStoreSummary *s, const gchar *full, gchar dir_sep) ;
+CamelGroupwiseStoreInfo *camel_groupwise_store_summary_full_name(CamelGroupwiseStoreSummary *s, const gchar *full_name);
+CamelGroupwiseStoreInfo *camel_groupwise_store_summary_add_from_full(CamelGroupwiseStoreSummary *s, const gchar *full, gchar dir_sep);
 
-gchar *camel_groupwise_store_summary_full_to_path(CamelGroupwiseStoreSummary *s, const gchar *full_name, gchar dir_sep) ;
-gchar *camel_groupwise_store_summary_path_to_full(CamelGroupwiseStoreSummary *s, const gchar *path, gchar dir_sep) ;
-gchar *camel_groupwise_store_summary_full_from_path(CamelGroupwiseStoreSummary *s, const gchar *path) ;
+gchar *camel_groupwise_store_summary_full_to_path(CamelGroupwiseStoreSummary *s, const gchar *full_name, gchar dir_sep);
+gchar *camel_groupwise_store_summary_path_to_full(CamelGroupwiseStoreSummary *s, const gchar *path, gchar dir_sep);
+gchar *camel_groupwise_store_summary_full_from_path(CamelGroupwiseStoreSummary *s, const gchar *path);
 
-CamelGroupwiseStoreNamespace *camel_groupwise_store_summary_namespace_new(CamelGroupwiseStoreSummary *s, const gchar *full_name, gchar dir_sep) ;
-CamelGroupwiseStoreNamespace *camel_groupwise_store_summary_namespace_find_path(CamelGroupwiseStoreSummary *s, const gchar *path) ;
-void camel_groupwise_store_summary_namespace_set(CamelGroupwiseStoreSummary *s, CamelGroupwiseStoreNamespace *ns) ;
+CamelGroupwiseStoreNamespace *camel_groupwise_store_summary_namespace_new(CamelGroupwiseStoreSummary *s, const gchar *full_name, gchar dir_sep);
+CamelGroupwiseStoreNamespace *camel_groupwise_store_summary_namespace_find_path(CamelGroupwiseStoreSummary *s, const gchar *path);
+void camel_groupwise_store_summary_namespace_set(CamelGroupwiseStoreSummary *s, CamelGroupwiseStoreNamespace *ns);
 
 #define camel_groupwise_store_info_full_name(s, i) (camel_store_info_string((CamelStoreSummary *)s, (const CamelStoreInfo *)i, CAMEL_STORE_INFO_LAST))
 
diff --git a/camel/providers/groupwise/camel-groupwise-store.c b/camel/providers/groupwise/camel-groupwise-store.c
index da4ba98..d3e1001 100644
--- a/camel/providers/groupwise/camel-groupwise-store.c
+++ b/camel/providers/groupwise/camel-groupwise-store.c
@@ -979,7 +979,7 @@ groupwise_folders_sync (CamelGroupwiseStore *store, CamelException *ex)
 	}
 
 	/*populate the hash table for finding the mapping from container id <-> folder name*/
-	for (;temp_list != NULL ; temp_list = g_list_next (temp_list) ) {
+	for (;temp_list != NULL; temp_list = g_list_next (temp_list) ) {
 		const gchar *name, *id, *parent;
 		name = e_gw_container_get_name (E_GW_CONTAINER (temp_list->data));
 		id = e_gw_container_get_id(E_GW_CONTAINER(temp_list->data));
@@ -1225,7 +1225,7 @@ create_junk_folder (CamelStore *store)
 	CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
 	CamelGroupwiseStorePrivate  *priv = groupwise_store->priv;
 	CamelFolderInfo *root = NULL;
-	gchar *parent_name, *folder_name, *child_container_id, *parent_id;
+	const gchar *parent_name, *folder_name, *child_container_id, *parent_id;
 	gint status;
 
 	parent_name = "";
@@ -1264,7 +1264,8 @@ groupwise_create_folder(CamelStore *store,
 	CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
 	CamelGroupwiseStorePrivate  *priv = groupwise_store->priv;
 	CamelFolderInfo *root = NULL;
-	gchar *parent_id , *child_container_id;
+	const gchar *parent_id;
+	gchar *child_container_id;
 	gint status;
 
 	if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
@@ -1499,7 +1500,7 @@ camel_groupwise_store_connected (CamelGroupwiseStore *store, CamelException *ex)
 	return FALSE;
 }
 
-static int
+static gint
 match_path(const gchar *path, const gchar *name)
 {
 	gchar p, n;
diff --git a/camel/providers/groupwise/camel-groupwise-summary.c b/camel/providers/groupwise/camel-groupwise-summary.c
index 3b605b1..8697af0 100644
--- a/camel/providers/groupwise/camel-groupwise-summary.c
+++ b/camel/providers/groupwise/camel-groupwise-summary.c
@@ -53,11 +53,11 @@
 static gint gw_summary_header_load (CamelFolderSummary *, FILE *);
 static gint gw_summary_header_save (CamelFolderSummary *, FILE *);
 
-static CamelMessageInfo *gw_message_info_load (CamelFolderSummary *s, FILE *in) ;
+static CamelMessageInfo *gw_message_info_load (CamelFolderSummary *s, FILE *in);
 
-static gint gw_message_info_save (CamelFolderSummary *s, FILE *out, CamelMessageInfo *info) ;
-static CamelMessageContentInfo * gw_content_info_load (CamelFolderSummary *s, FILE *in) ;
-static gint gw_content_info_save (CamelFolderSummary *s, FILE *out, CamelMessageContentInfo *info) ;
+static gint gw_message_info_save (CamelFolderSummary *s, FILE *out, CamelMessageInfo *info);
+static CamelMessageContentInfo * gw_content_info_load (CamelFolderSummary *s, FILE *in);
+static gint gw_content_info_save (CamelFolderSummary *s, FILE *out, CamelMessageContentInfo *info);
 static gboolean gw_info_set_flags(CamelMessageInfo *info, guint32 flags, guint32 set);
 
 static gint summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
@@ -74,7 +74,7 @@ static void camel_groupwise_summary_init       (CamelGroupwiseSummary *obj);
 /*End of Prototypes*/
 
 
-static CamelFolderSummaryClass *camel_groupwise_summary_parent ;
+static CamelFolderSummaryClass *camel_groupwise_summary_parent;
 
 
 CamelType
@@ -118,7 +118,7 @@ camel_groupwise_summary_class_init (CamelGroupwiseSummaryClass *klass)
 
 	camel_groupwise_summary_parent = CAMEL_FOLDER_SUMMARY_CLASS (camel_type_get_global_classfuncs (camel_folder_summary_get_type()));
 
-	cfs_class->message_info_clone = gw_message_info_clone ;
+	cfs_class->message_info_clone = gw_message_info_clone;
 	cfs_class->summary_header_load = gw_summary_header_load;
 	cfs_class->summary_header_save = gw_summary_header_save;
 	cfs_class->message_info_load = gw_message_info_load;
@@ -167,7 +167,7 @@ camel_groupwise_summary_new (struct _CamelFolder *folder, const gchar *filename)
 	CamelFolderSummary *summary = CAMEL_FOLDER_SUMMARY (
 			camel_object_new (camel_groupwise_summary_get_type ()));
 
-	summary->folder = folder ;
+	summary->folder = folder;
 	camel_folder_summary_set_build_content (summary, TRUE);
 	camel_folder_summary_set_filename (summary, filename);
 
@@ -179,14 +179,14 @@ camel_groupwise_summary_new (struct _CamelFolder *folder, const gchar *filename)
 	return summary;
 }
 
-static int
+static gint
 summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
 {
 	CamelGroupwiseSummary *gms = CAMEL_GROUPWISE_SUMMARY (s);
 	gchar *part;
 
 	if (camel_groupwise_summary_parent->summary_header_from_db (s, mir) == -1)
-		return -1 ;
+		return -1;
 
 	part = mir->bdata;
 
@@ -203,13 +203,13 @@ summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
 	return 0;
 }
 
-static int
+static gint
 gw_summary_header_load (CamelFolderSummary *s, FILE *in)
 {
 	CamelGroupwiseSummary *gms = CAMEL_GROUPWISE_SUMMARY (s);
 
 	if (camel_groupwise_summary_parent->summary_header_load (s, in) == -1)
-		return -1 ;
+		return -1;
 
 	if (camel_file_util_decode_fixed_int32(in, &gms->version) == -1
 			|| camel_file_util_decode_fixed_int32(in, &gms->validity) == -1)
@@ -217,7 +217,7 @@ gw_summary_header_load (CamelFolderSummary *s, FILE *in)
 
 	if (camel_file_util_decode_string (in, &gms->time_string) == -1)
 		return -1;
-	return 0 ;
+	return 0;
 }
 
 
@@ -240,7 +240,7 @@ summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
 
 }
 
-static int
+static gint
 gw_summary_header_save (CamelFolderSummary *s, FILE *out)
 {
 	CamelGroupwiseSummary *gms = CAMEL_GROUPWISE_SUMMARY(s);
@@ -271,21 +271,21 @@ message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
 static CamelMessageInfo *
 gw_message_info_load (CamelFolderSummary *s, FILE *in)
 {
-	CamelMessageInfo *info ;
-	CamelGroupwiseMessageInfo *gw_info ;
+	CamelMessageInfo *info;
+	CamelGroupwiseMessageInfo *gw_info;
 
 
-	info = camel_groupwise_summary_parent->message_info_load(s,in) ;
+	info = camel_groupwise_summary_parent->message_info_load(s,in);
 	if (info) {
-		gw_info = (CamelGroupwiseMessageInfo*) info ;
+		gw_info = (CamelGroupwiseMessageInfo*) info;
 		if (camel_file_util_decode_uint32 (in, &gw_info->server_flags) == -1)
-			goto error ;
+			goto error;
 	}
 
-	return info ;
+	return info;
 error:
-	camel_message_info_free (info) ;
-	return NULL ;
+	camel_message_info_free (info);
+	return NULL;
 }
 
 static CamelMIRecord *
@@ -301,7 +301,7 @@ message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
 	return mir;
 }
 
-static int
+static gint
 gw_message_info_save (CamelFolderSummary *s, FILE *out, CamelMessageInfo *info)
 {
 	CamelGroupwiseMessageInfo *gw_info = (CamelGroupwiseMessageInfo *)info;
@@ -342,7 +342,7 @@ gw_content_info_load (CamelFolderSummary *s, FILE *in)
 		return camel_folder_summary_content_info_new (s);
 }
 
-static int
+static gint
 content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir)
 {
 
@@ -355,7 +355,7 @@ content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelM
 	}
 }
 
-static int
+static gint
 gw_content_info_save (CamelFolderSummary *s, FILE *out,
 		CamelMessageContentInfo *info)
 {
@@ -435,17 +435,17 @@ gw_info_set_flags (CamelMessageInfo *info, guint32 flags, guint32 set)
 void
 camel_gw_summary_add_offline (CamelFolderSummary *summary, const gchar *uid, CamelMimeMessage *message, const CamelMessageInfo *info)
 {
-	CamelGroupwiseMessageInfo *mi ;
-	const CamelFlag *flag ;
-	const CamelTag *tag ;
+	CamelGroupwiseMessageInfo *mi;
+	const CamelFlag *flag;
+	const CamelTag *tag;
 
 	/* Create summary entry */
-	mi = (CamelGroupwiseMessageInfo *)camel_folder_summary_info_new_from_message (summary, message) ;
+	mi = (CamelGroupwiseMessageInfo *)camel_folder_summary_info_new_from_message (summary, message);
 
 	/* Copy flags 'n' tags */
-	mi->info.flags = camel_message_info_flags(info) ;
+	mi->info.flags = camel_message_info_flags(info);
 
-	flag = camel_message_info_user_flags(info) ;
+	flag = camel_message_info_user_flags(info);
 	while (flag) {
 		camel_message_info_set_user_flag((CamelMessageInfo *)mi, flag->name, TRUE);
 		flag = flag->next;
diff --git a/camel/providers/groupwise/camel-groupwise-summary.h b/camel/providers/groupwise/camel-groupwise-summary.h
index 2edddd0..155cbed 100644
--- a/camel/providers/groupwise/camel-groupwise-summary.h
+++ b/camel/providers/groupwise/camel-groupwise-summary.h
@@ -32,10 +32,10 @@
 
 G_BEGIN_DECLS
 
-typedef struct _CamelGroupwiseSummary CamelGroupwiseSummary ;
-typedef struct _CamelGroupwiseSummaryClass CamelGroupwiseSummaryClass ;
-typedef struct _CamelGroupwiseMessageInfo CamelGroupwiseMessageInfo ;
-typedef struct _CamelGroupwiseMessageContentInfo CamelGroupwiseMessageContentInfo ;
+typedef struct _CamelGroupwiseSummary CamelGroupwiseSummary;
+typedef struct _CamelGroupwiseSummaryClass CamelGroupwiseSummaryClass;
+typedef struct _CamelGroupwiseMessageInfo CamelGroupwiseMessageInfo;
+typedef struct _CamelGroupwiseMessageContentInfo CamelGroupwiseMessageContentInfo;
 
 /* extra summary flags*/
 enum {
@@ -51,7 +51,7 @@ struct _CamelGroupwiseMessageInfo {
 
 
 struct _CamelGroupwiseMessageContentInfo {
-	CamelMessageContentInfo info ;
+	CamelMessageContentInfo info;
 } ;
 
 
@@ -65,17 +65,17 @@ struct _CamelGroupwiseSummary {
 
 
 struct _CamelGroupwiseSummaryClass {
-	CamelFolderSummaryClass parent_class ;
+	CamelFolderSummaryClass parent_class;
 } ;
 
 
-CamelType camel_groupwise_summary_get_type (void) ;
+CamelType camel_groupwise_summary_get_type (void);
 
-CamelFolderSummary *camel_groupwise_summary_new (struct _CamelFolder *folder, const gchar *filename) ;
+CamelFolderSummary *camel_groupwise_summary_new (struct _CamelFolder *folder, const gchar *filename);
 
-void camel_gw_summary_add_offline (CamelFolderSummary *summary, const gchar *uid, CamelMimeMessage *messgae, const CamelMessageInfo *info) ;
+void camel_gw_summary_add_offline (CamelFolderSummary *summary, const gchar *uid, CamelMimeMessage *messgae, const CamelMessageInfo *info);
 
-void camel_gw_summary_add_offline_uncached (CamelFolderSummary *summary, const gchar *uid, const CamelMessageInfo *info) ;
+void camel_gw_summary_add_offline_uncached (CamelFolderSummary *summary, const gchar *uid, const CamelMessageInfo *info);
 void groupwise_summary_clear (CamelFolderSummary *summary, gboolean uncache);
 
 G_END_DECLS
diff --git a/camel/providers/groupwise/camel-groupwise-transport.h b/camel/providers/groupwise/camel-groupwise-transport.h
index 34cd0bd..63bc450 100644
--- a/camel/providers/groupwise/camel-groupwise-transport.h
+++ b/camel/providers/groupwise/camel-groupwise-transport.h
@@ -36,7 +36,7 @@ G_BEGIN_DECLS
 
 typedef struct {
 	CamelTransport parent_object;
-	gboolean connected ;
+	gboolean connected;
 
 } CamelGroupwiseTransport;
 
diff --git a/camel/providers/groupwise/camel-groupwise-utils.c b/camel/providers/groupwise/camel-groupwise-utils.c
index 494b159..8ff1de9 100644
--- a/camel/providers/groupwise/camel-groupwise-utils.c
+++ b/camel/providers/groupwise/camel-groupwise-utils.c
@@ -270,7 +270,7 @@ add_recipients(GSList *recipient_list, CamelAddress *recipients, gint recipient_
 	EGwItemRecipient *recipient;
 
 	total_add = camel_address_length (recipients);
-	for (i=0 ; i<total_add ; i++) {
+	for (i=0; i<total_add; i++) {
 		const gchar *name = NULL, *addr = NULL;
 		if(camel_internet_address_get ((CamelInternetAddress *)recipients, i , &name, &addr )) {
 
@@ -579,7 +579,7 @@ do_flags_diff (flags_diff_t *diff, guint32 old, guint32 _new)
 gchar *
 gw_concat ( const gchar *prefix, const gchar *suffix)
 {
-	size_t len;
+	gsize len;
 
 	len = strlen (prefix);
 	if (len == 0 || prefix[len - 1] == '/')
@@ -610,7 +610,7 @@ do_multipart (EGwConnection *cnc, EGwItem *item, CamelMultipart *mp, GSList **at
 	gint i;
 
 	part_count = camel_multipart_get_number (mp);
-	for ( i=0 ; i<part_count ; i++) {
+	for ( i=0; i<part_count; i++) {
 		CamelContentType *type;
 		CamelMimePart *part;
 		CamelStreamMem *content = (CamelStreamMem *)camel_stream_mem_new ();
diff --git a/camel/providers/hula/camel-hula-provider.c b/camel/providers/hula/camel-hula-provider.c
index 7da65d5..5f6a533 100644
--- a/camel/providers/hula/camel-hula-provider.c
+++ b/camel/providers/hula/camel-hula-provider.c
@@ -101,7 +101,7 @@ static CamelServiceAuthType camel_hula_password_authtype = {
 	TRUE
 };
 
-static int
+static gint
 hula_auto_detect_cb (CamelURL *url, GHashTable **auto_detected,
 			 CamelException *ex)
 {
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index c4ec30a..30c13cb 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -47,8 +47,6 @@
 #include "camel-imap-store.h"
 #include "camel-imap-utils.h"
 
-extern gint camel_verbose_debug;
-
 static gboolean imap_command_start (CamelImapStore *store, CamelFolder *folder,
 				    const gchar *cmd, CamelException *ex);
 static CamelImapResponse *imap_read_response (CamelImapStore *store,
@@ -177,7 +175,7 @@ static gboolean
 imap_command_start (CamelImapStore *store, CamelFolder *folder,
 		    const gchar *cmd, CamelException *ex)
 {
-	ssize_t nwritten;
+	gssize nwritten;
 
 	if (!store->ostream) {
 		camel_exception_set (ex, CAMEL_EXCEPTION_STORE_INVALID, _("No output stream"));
@@ -258,7 +256,7 @@ imap_command_start (CamelImapStore *store, CamelFolder *folder,
  **/
 CamelImapResponse *
 camel_imap_command_continuation (CamelImapStore *store, const gchar *cmd,
-				 size_t cmdlen, CamelException *ex)
+				 gsize cmdlen, CamelException *ex)
 {
 	if (!camel_imap_store_connected (store, ex))
 		return NULL;
@@ -620,7 +618,7 @@ camel_imap_response_free (CamelImapStore *store, CamelImapResponse *response)
 				/* XGWMOVE response is the same as an EXPUNGE response */
 				if (!expunged) {
 					expunged = g_array_new (FALSE, FALSE,
-								sizeof (int));
+								sizeof (gint));
 				}
 				g_array_append_val (expunged, number);
 			}
@@ -775,7 +773,7 @@ imap_command_strdup_vprintf (CamelImapStore *store, const gchar *fmt,
 
 		switch (*++p) {
 		case 'd':
-			num = va_arg (ap, int);
+			num = va_arg (ap, gint);
 			g_ptr_array_add (args, GINT_TO_POINTER (num));
 			start = p + 1;
 			len += 10;
diff --git a/camel/providers/imap/camel-imap-command.h b/camel/providers/imap/camel-imap-command.h
index d6b8195..2d119fa 100644
--- a/camel/providers/imap/camel-imap-command.h
+++ b/camel/providers/imap/camel-imap-command.h
@@ -51,7 +51,7 @@ CamelImapResponse *camel_imap_command              (CamelImapStore *store,
 						    const gchar *fmt, ...);
 CamelImapResponse *camel_imap_command_continuation (CamelImapStore *store,
 						    const gchar *cmd,
-						    size_t cmdlen,
+						    gsize cmdlen,
 						    CamelException *ex);
 
 void  camel_imap_response_free                     (CamelImapStore *store,
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index cc4945e..b2395d2 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -82,6 +82,7 @@
  * octets) */
 #define UID_SET_LIMIT  (768)
 
+extern gint camel_application_is_exiting;
 
 #define CF_CLASS(o) (CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(o)))
 static CamelOfflineFolderClass *offline_folder_class = NULL;
@@ -311,7 +312,7 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
 {
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
 	CamelImapSummary *imap_summary = CAMEL_IMAP_SUMMARY (folder->summary);
-	unsigned long exists = 0, validity = 0, val, uid;
+	gulong exists = 0, validity = 0, val, uid;
 	guint32 perm_flags = 0;
 	GData *fetch_data;
 	gint i, count;
@@ -320,7 +321,7 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
 	count = camel_folder_summary_count (folder->summary);
 
 	for (i = 0; i < response->untagged->len; i++) {
-		resp = response->untagged->pdata[i] + 2;
+		resp = (gchar *) response->untagged->pdata[i] + 2;
 
 		if (!g_ascii_strncasecmp (resp, "FLAGS ", 6) && !perm_flags) {
 			resp += 6;
@@ -336,8 +337,8 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
 				folder->permanent_flags = perm_flags;
 		} else if (!g_ascii_strncasecmp (resp, "OK [UIDVALIDITY ", 16)) {
 			validity = strtoul (resp + 16, NULL, 10);
-		} else if (isdigit ((unsigned char)*resp)) {
-			unsigned long num = strtoul (resp, &resp, 10);
+		} else if (isdigit ((guchar)*resp)) {
+			gulong num = strtoul (resp, &resp, 10);
 
 			if (!g_ascii_strncasecmp (resp, " EXISTS", 7)) {
 				exists = num;
@@ -472,7 +473,7 @@ imap_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
 	return camel_imap_message_cache_get_filename (imap_folder->cache, uid, "", ex);
 }
 
-static int
+static gint
 imap_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	CamelFolder *folder = (CamelFolder *)object;
@@ -526,7 +527,7 @@ imap_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 	return 0;
 }
 
-static int
+static gint
 imap_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
 {
 	gint save = 0;
@@ -686,7 +687,6 @@ imap_refresh_info (CamelFolder *folder, CamelException *ex)
 	CamelImapResponse *response;
 	CamelStoreInfo *si;
 	gint check_rescan = -1;
-	extern gint camel_application_is_exiting;
 
 	if (CAMEL_OFFLINE_STORE (imap_store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
 		return;
@@ -861,7 +861,6 @@ imap_rescan (CamelFolder *folder, gint exists, CamelException *ex)
 {
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
 	CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
-	extern gint camel_application_is_exiting;
 	struct {
 		gchar *uid;
 		guint32 flags;
@@ -965,7 +964,7 @@ imap_rescan (CamelFolder *folder, gint exists, CamelException *ex)
 	 * to sync up with the server. So either way, we remove it
 	 * from the summary.
 	 */
-	removed = g_array_new (FALSE, FALSE, sizeof (int));
+	removed = g_array_new (FALSE, FALSE, sizeof (gint));
 
 	if (summary_len - camel_folder_summary_cache_size (folder->summary) > 50)
 		camel_folder_summary_reload_from_db (folder->summary, ex);
@@ -1505,11 +1504,11 @@ imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
 	CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
 
-static int
+static gint
 uid_compar (gconstpointer va, gconstpointer vb)
 {
 	const gchar **sa = (const gchar **)va, **sb = (const gchar **)vb;
-	unsigned long a, b;
+	gulong a, b;
 
 	a = strtoul (*sa, NULL, 10);
 	b = strtoul (*sb, NULL, 10);
@@ -1696,7 +1695,7 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio
 
 	if (result[8] == ' ') {
 		gchar *uid, *lasts = NULL;
-		unsigned long euid, kuid;
+		gulong euid, kuid;
 		gint ei, ki;
 
 		keep_uids = g_ptr_array_new ();
@@ -1828,7 +1827,7 @@ get_temp_uid (void)
 
 	G_LOCK (lock);
 	res = g_strdup_printf ("tempuid-%lx-%d",
-			       (unsigned long) time (NULL),
+			       (gulong) time (NULL),
 			       counter++);
 	G_UNLOCK (lock);
 
@@ -2411,7 +2410,7 @@ imap_transfer_resyncing (CamelFolder *source, GPtrArray *uids,
 		for (first = i; i < uids->len; i++) {
 			uid = uids->pdata[i];
 
-			if (!isdigit ((unsigned char)*uid)) {
+			if (!isdigit ((guchar)*uid)) {
 				uid = camel_imap_journal_uidmap_lookup ((CamelIMAPJournal *) CAMEL_IMAP_FOLDER (source)->journal, uid);
 				if (!uid)
 					break;
@@ -2548,7 +2547,7 @@ part_spec_push (struct _part_spec_stack **stack, gint part)
 	*stack = node;
 }
 
-static int
+static gint
 part_spec_pop (struct _part_spec_stack **stack)
 {
 	struct _part_spec_stack *node;
@@ -2571,7 +2570,7 @@ content_info_get_part_spec (CamelMessageContentInfo *ci)
 	struct _part_spec_stack *stack = NULL;
 	CamelMessageContentInfo *node;
 	gchar *part_spec, *buf;
-	size_t len = 1;
+	gsize len = 1;
 	gint part;
 
 	node = ci;
@@ -3102,7 +3101,7 @@ imap_cache_message (CamelDiscoFolder *disco_folder, const gchar *uid,
 #define IMAP_PRETEND_SIZEOF_SIZE	  20
 #define IMAP_PRETEND_SIZEOF_HEADERS	2000
 
-static gchar *tm_months[] = {
+static const gchar *tm_months[] = {
 	"Jan", "Feb", "Mar", "Apr", "May", "Jun",
 	"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
 };
@@ -3116,7 +3115,7 @@ decode_time (const guchar **in, gint *hour, gint *min, gint *sec)
 	*hour = *min = *sec = 0;
 
 	val = hour;
-	for (inptr = *in; *inptr && !isspace ((int) *inptr); inptr++) {
+	for (inptr = *in; *inptr && !isspace ((gint) *inptr); inptr++) {
 		if (*inptr == ':') {
 			colons++;
 			switch (colons) {
@@ -3129,7 +3128,7 @@ decode_time (const guchar **in, gint *hour, gint *min, gint *sec)
 			default:
 				return FALSE;
 			}
-		} else if (!isdigit ((int) *inptr))
+		} else if (!isdigit ((gint) *inptr))
 			return FALSE;
 		else
 			*val = (*val * 10) + (*inptr - '0');
@@ -3333,7 +3332,6 @@ imap_update_summary (CamelFolder *folder, gint exists,
 	CamelStream *stream;
 	gchar *uid, *resp, *tempuid;
 	GData *data;
-	extern gint camel_application_is_exiting;
 	gint k = 0, ct;
 
 	if (store->server_level >= IMAP_LEVEL_IMAP4REV1) {
@@ -3672,7 +3670,6 @@ camel_imap_folder_changed (CamelFolder *folder, gint exists,
 			   GArray *expunged, CamelException *ex)
 {
 	CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
-	extern gint camel_application_is_exiting;
 	CamelFolderChangeInfo *changes;
 	gint len;
 	gchar *uid;
@@ -3827,10 +3824,10 @@ parse_fetch_response (CamelImapFolder *imap_folder, gchar *response)
 	GData *data = NULL;
 	gchar *start, *part_spec = NULL, *body = NULL, *uid = NULL, *idate = NULL;
 	gboolean cache_header = TRUE, header = FALSE;
-	size_t body_len = 0;
+	gsize body_len = 0;
 
 	if (*response != '(') {
-		long seq;
+		glong seq;
 
 		if (*response != '*' || *(response + 1) != ' ')
 			return NULL;
@@ -3861,7 +3858,7 @@ parse_fetch_response (CamelImapFolder *imap_folder, gchar *response)
 					g_datalist_set_data_full (&data, "CUSTOM.FLAGS", custom_flags, g_free);
 			}
 		} else if (!g_ascii_strncasecmp (response, "RFC822.SIZE ", 12)) {
-			unsigned long size;
+			gulong size;
 
 			response += 12;
 			size = strtoul (response, &response, 10);
@@ -4000,7 +3997,7 @@ imap_get_quota_info (CamelFolder *folder)
 
 				if (resp && g_str_has_prefix (resp, "* QUOTA ")) {
 					gboolean skipped = TRUE;
-					size_t sz;
+					gsize sz;
 					gchar *astr;
 
 					resp = resp + 8;
@@ -4031,7 +4028,7 @@ imap_get_quota_info (CamelFolder *folder)
 							u = strtoull (used, NULL, 10);
 							t = strtoull (total, NULL, 10);
 
-							if (u >= 0 && t > 0) {
+							if (t > 0) {
 								CamelFolderQuotaInfo *info = camel_folder_quota_info_new (name, u, t);
 
 								if (last)
diff --git a/camel/providers/imap/camel-imap-journal.c b/camel/providers/imap/camel-imap-journal.c
index 36bcce2..d82c07f 100644
--- a/camel/providers/imap/camel-imap-journal.c
+++ b/camel/providers/imap/camel-imap-journal.c
@@ -228,7 +228,7 @@ imap_entry_load (CamelOfflineJournal *journal, FILE *in)
 		entry->uids = decode_uids (in);
 		if (!entry->uids)
 			goto exception;
-		if (camel_file_util_decode_uint32 (in, &entry->move) == -1)
+		if (camel_file_util_decode_uint32 (in, (guint32 *) &entry->move) == -1)
 			goto exception;
 		break;
 	default:
@@ -251,7 +251,7 @@ imap_entry_load (CamelOfflineJournal *journal, FILE *in)
 	return NULL;
 }
 
-static int
+static gint
 encode_uids (FILE *file, GPtrArray *uids)
 {
 	gint i, status;
@@ -262,7 +262,7 @@ encode_uids (FILE *file, GPtrArray *uids)
 	return status;
 }
 
-static int
+static gint
 imap_entry_write (CamelOfflineJournal *journal, CamelDListNode *entry, FILE *out)
 {
 	CamelIMAPJournalEntry *imap_entry = (CamelIMAPJournalEntry *) entry;
diff --git a/camel/providers/imap/camel-imap-provider.c b/camel/providers/imap/camel-imap-provider.c
index 7771257..6413717 100644
--- a/camel/providers/imap/camel-imap-provider.c
+++ b/camel/providers/imap/camel-imap-provider.c
@@ -139,7 +139,7 @@ imap_url_hash (gconstpointer key)
 	return hash;
 }
 
-static int
+static gint
 check_equal (gchar *s1, gchar *s2)
 {
 	if (s1 == NULL) {
@@ -155,7 +155,7 @@ check_equal (gchar *s1, gchar *s2)
 	return strcmp (s1, s2) == 0;
 }
 
-static int
+static gint
 imap_url_equal (gconstpointer a, gconstpointer b)
 {
 	const CamelURL *u1 = a, *u2 = b;
diff --git a/camel/providers/imap/camel-imap-search.c b/camel/providers/imap/camel-imap-search.c
index 5afd569..5b169ea 100644
--- a/camel/providers/imap/camel-imap-search.c
+++ b/camel/providers/imap/camel-imap-search.c
@@ -208,7 +208,7 @@ hash_match(gchar hash[17], gint argc, struct _ESExpResult **argv)
 	hash[16] = 0;
 }
 
-static int
+static gint
 save_match(CamelImapSearch *is, struct _match_record *mr)
 {
 	guint32 mark = MATCH_MARK;
@@ -315,7 +315,7 @@ load_match(CamelImapSearch *is, gchar hash[17], gint argc, struct _ESExpResult *
 	return mr;
 }
 
-static int
+static gint
 sync_match(CamelImapSearch *is, struct _match_record *mr)
 {
 	gchar *p, *result, *lasts = NULL;
diff --git a/camel/providers/imap/camel-imap-store-summary.c b/camel/providers/imap/camel-imap-store-summary.c
index a7dd04a..f8618f1 100644
--- a/camel/providers/imap/camel-imap-store-summary.c
+++ b/camel/providers/imap/camel-imap-store-summary.c
@@ -52,10 +52,10 @@ static gint summary_header_save(CamelStoreSummary *, FILE *);
 
 /*static CamelStoreInfo * store_info_new(CamelStoreSummary *, const gchar *);*/
 static CamelStoreInfo * store_info_load(CamelStoreSummary *, FILE *);
-static int		 store_info_save(CamelStoreSummary *, FILE *, CamelStoreInfo *);
+static gint		 store_info_save(CamelStoreSummary *, FILE *, CamelStoreInfo *);
 static void		 store_info_free(CamelStoreSummary *, CamelStoreInfo *);
 
-static const gchar *store_info_string(CamelStoreSummary *, const CamelStoreInfo *, int);
+static const gchar *store_info_string(CamelStoreSummary *, const CamelStoreInfo *, gint);
 static void store_info_set_string(CamelStoreSummary *, CamelStoreInfo *, int, const gchar *);
 
 static void camel_imap_store_summary_class_init (CamelImapStoreSummaryClass *klass);
@@ -339,8 +339,9 @@ camel_imap_store_summary_add_from_full(CamelImapStoreSummary *s, const gchar *fu
 
 		if (!g_ascii_strcasecmp(full_name, "inbox"))
 			info->info.flags |= CAMEL_FOLDER_SYSTEM|CAMEL_FOLDER_TYPE_INBOX;
-	} else
+	} else {
 		d(printf("  failed\n"));
+	}
 
 	return info;
 }
@@ -477,7 +478,7 @@ namespace_load(CamelStoreSummary *s, FILE *in)
 	return ns;
 }
 
-static int
+static gint
 namespace_save(CamelStoreSummary *s, FILE *in, CamelImapStoreNamespace *ns)
 {
 	if (camel_file_util_encode_string(in, ns->path) == -1
@@ -488,7 +489,7 @@ namespace_save(CamelStoreSummary *s, FILE *in, CamelImapStoreNamespace *ns)
 	return 0;
 }
 
-static int
+static gint
 summary_header_load(CamelStoreSummary *s, FILE *in)
 {
 	CamelImapStoreSummary *is = (CamelImapStoreSummary *)s;
@@ -522,7 +523,7 @@ summary_header_load(CamelStoreSummary *s, FILE *in)
 	return 0;
 }
 
-static int
+static gint
 summary_header_save(CamelStoreSummary *s, FILE *out)
 {
 	CamelImapStoreSummary *is = (CamelImapStoreSummary *)s;
@@ -563,7 +564,7 @@ store_info_load(CamelStoreSummary *s, FILE *in)
 	return (CamelStoreInfo *)mi;
 }
 
-static int
+static gint
 store_info_save(CamelStoreSummary *s, FILE *out, CamelStoreInfo *mi)
 {
 	CamelImapStoreInfo *isi = (CamelImapStoreInfo *)mi;
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 98684fc..d89a4a8 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -310,7 +310,7 @@ construct (CamelService *service, CamelSession *session,
 	}
 }
 
-static int
+static gint
 imap_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
 {
 	CamelImapStore *store = (CamelImapStore *) object;
@@ -384,7 +384,7 @@ imap_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
 	return CAMEL_OBJECT_CLASS (parent_class)->setv (object, ex, args);
 }
 
-static int
+static gint
 imap_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	CamelImapStore *store = (CamelImapStore *) object;
@@ -955,17 +955,17 @@ connect_to_server_wrapper (CamelService *service, CamelException *ex)
 			if (!strcmp (ssl_options[i].value, ssl_mode))
 				break;
 		mode = ssl_options[i].mode;
-		serv = ssl_options[i].serv;
+		serv = (gchar *) ssl_options[i].serv;
 		port = ssl_options[i].port;
 	} else {
 		mode = MODE_CLEAR;
-		serv = "imap";
+		serv = (gchar *) "imap";
 		port = IMAP_PORT;
 	}
 
 	if (service->url->port) {
 		serv = g_alloca (16);
-		sprintf ((char *)serv, "%d", service->url->port);
+		sprintf ((gchar *)serv, "%d", service->url->port);
 		port = NULL;
 	}
 
@@ -1401,7 +1401,7 @@ imap_connect (CamelService *service, CamelException *ex)
 	CamelImapResponse *response;
 	/*struct _namespaces *namespaces;*/
 	gchar *result, *name;
-	size_t len;
+	gsize len;
 	CamelImapStoreNamespace *ns;
 
 	if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
@@ -1873,7 +1873,8 @@ get_folder (CamelStore *store, const gchar *folder_name, guint32 flags, CamelExc
 		if (parent_real != NULL) {
 			gboolean need_convert = FALSE;
 			gchar *resp, *thisone;
-			gint i, flags;
+			gint flags;
+			gint i;
 
 			if (!(response = camel_imap_command (imap_store, NULL, ex, "LIST \"\" %G", parent_real))) {
 				CAMEL_SERVICE_REC_UNLOCK (imap_store, connect_lock);
@@ -2530,7 +2531,7 @@ get_folders_sync(CamelImapStore *imap_store, const gchar *pattern, CamelExceptio
 	count = camel_store_summary_count((CamelStoreSummary *)imap_store->summary);
 
 	for (i=0;i<count;i++) {
-		const char *full_name;
+		const gchar *full_name;
 
 		si = camel_store_summary_index((CamelStoreSummary *)imap_store->summary, i);
 		if (si == NULL)
@@ -2541,7 +2542,7 @@ get_folders_sync(CamelImapStore *imap_store, const gchar *pattern, CamelExceptio
 			camel_store_summary_info_free ((CamelStoreSummary *)imap_store->summary, si);
 			continue;
 		}
-		
+
 		if (imap_match_pattern (imap_store->dir_sep, pattern, full_name)) {
 			if ((fi = g_hash_table_lookup(present, camel_store_info_path(imap_store->summary, si))) != NULL) {
 				if (((fi->flags ^ si->flags) & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED)) {
@@ -2827,7 +2828,7 @@ get_folder_info_offline (CamelStore *store, const gchar *top,
 
 	for (i=0;i<camel_store_summary_count((CamelStoreSummary *)imap_store->summary);i++) {
 		CamelStoreInfo *si = camel_store_summary_index((CamelStoreSummary *)imap_store->summary, i);
-		const char *full_name;
+		const gchar *full_name;
 
 		if (si == NULL)
 			continue;
@@ -3016,13 +3017,13 @@ camel_imap_store_connected (CamelImapStore *store, CamelException *ex)
 }
 
 
-ssize_t
+gssize
 camel_imap_store_readline (CamelImapStore *store, gchar **dest, CamelException *ex)
 {
 	CamelStreamBuffer *stream;
 	gchar linebuf[1024] = {0};
 	GByteArray *ba;
-	ssize_t nread;
+	gssize nread;
 
 	g_return_val_if_fail (CAMEL_IS_IMAP_STORE (store), -1);
 	g_return_val_if_fail (dest, -1);
@@ -3073,7 +3074,7 @@ camel_imap_store_readline (CamelImapStore *store, gchar **dest, CamelException *
 		nread--;
 	}
 
-	*dest = (gchar *)ba->data;
+	*dest = (gchar *) ba->data;
 	g_byte_array_free (ba, FALSE);
 
 	return nread;
diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h
index 27bd056..f34f9f8 100644
--- a/camel/providers/imap/camel-imap-store.h
+++ b/camel/providers/imap/camel-imap-store.h
@@ -45,7 +45,7 @@ struct _CamelImapMsg {
 
 CamelImapMsg *camel_imap_msg_new(void (*receive)(CamelImapStore *store, struct _CamelImapMsg *m),
 				 void (*free)(CamelImapStore *store, struct _CamelImapMsg *m),
-				 size_t size);
+				 gsize size);
 void camel_imap_msg_queue(CamelImapStore *store, CamelImapMsg *msg);
 
 G_END_DECLS
@@ -161,7 +161,7 @@ CamelType camel_imap_store_get_type (void);
 
 gboolean camel_imap_store_connected (CamelImapStore *store, CamelException *ex);
 
-ssize_t camel_imap_store_readline (CamelImapStore *store, gchar **dest, CamelException *ex);
+gssize camel_imap_store_readline (CamelImapStore *store, gchar **dest, CamelException *ex);
 
 G_END_DECLS
 
diff --git a/camel/providers/imap/camel-imap-summary.c b/camel/providers/imap/camel-imap-summary.c
index f1dbd65..f95e2ff 100644
--- a/camel/providers/imap/camel-imap-summary.c
+++ b/camel/providers/imap/camel-imap-summary.c
@@ -139,7 +139,7 @@ camel_imap_summary_init (CamelImapSummary *obj)
 	s->content_info_size = sizeof(CamelImapMessageContentInfo);
 }
 
-static int
+static gint
 sort_uid_cmp (gpointer enc, gint len1, gpointer  data1, gint len2, gpointer data2)
 {
 	static gchar *sa1=NULL, *sa2=NULL;
@@ -163,11 +163,11 @@ sort_uid_cmp (gpointer enc, gint len1, gpointer  data1, gint len2, gpointer data
 	return (a1 < a1) ? -1 : (a1 > a2) ? 1 : 0;
 }
 
-static int
+static gint
 uid_compare (gconstpointer va, gconstpointer vb)
 {
 	const gchar **sa = (const gchar **)va, **sb = (const gchar **)vb;
-	unsigned long a, b;
+	gulong a, b;
 
 	a = strtoul (*sa, NULL, 10);
 	b = strtoul (*sb, NULL, 10);
@@ -221,7 +221,7 @@ camel_imap_summary_new (struct _CamelFolder *folder, const gchar *filename)
 	return summary;
 }
 
-static int
+static gint
 summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
 {
 	CamelImapSummary *ims = CAMEL_IMAP_SUMMARY (s);
@@ -249,7 +249,7 @@ summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
 	return 0;
 }
 
-static int
+static gint
 summary_header_load (CamelFolderSummary *s, FILE *in)
 {
 	CamelImapSummary *ims = CAMEL_IMAP_SUMMARY (s);
@@ -262,7 +262,7 @@ summary_header_load (CamelFolderSummary *s, FILE *in)
 		return camel_file_util_decode_uint32(in, &ims->validity);
 
 	/* Version 1 */
-	if (camel_file_util_decode_fixed_int32(in, &ims->version) == -1)
+	if (camel_file_util_decode_fixed_int32(in, (gint32 *) &ims->version) == -1)
 		return -1;
 
 	if (ims->version == 2) {
@@ -273,7 +273,7 @@ summary_header_load (CamelFolderSummary *s, FILE *in)
 			return -1;
 	}
 
-	if (camel_file_util_decode_fixed_int32(in, &ims->validity) == -1)
+	if (camel_file_util_decode_fixed_int32(in, (gint32 *) &ims->validity) == -1)
 		return -1;
 
 	if (ims->version > CAMEL_IMAP_SUMMARY_VERSION) {
@@ -299,7 +299,7 @@ summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
 	return fir;
 }
 
-static int
+static gint
 summary_header_save (CamelFolderSummary *s, FILE *out)
 {
 	CamelImapSummary *ims = CAMEL_IMAP_SUMMARY(s);
@@ -363,7 +363,7 @@ message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
 	return mir;
 }
 
-static int
+static gint
 message_info_save (CamelFolderSummary *s, FILE *out, CamelMessageInfo *info)
 {
 	CamelImapMessageInfo *iinfo = (CamelImapMessageInfo *)info;
@@ -417,7 +417,7 @@ content_info_load (CamelFolderSummary *s, FILE *in)
 		return camel_folder_summary_content_info_new (s);
 }
 
-static int
+static gint
 content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir)
 {
 	gchar *oldr;
@@ -434,7 +434,7 @@ content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelM
 	}
 }
 
-static int
+static gint
 content_info_save (CamelFolderSummary *s, FILE *out,
 		   CamelMessageContentInfo *info)
 {
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index 9eb6dca..fa30839 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -99,7 +99,7 @@ imap_namespace_decode (const gchar **in, struct _namespace **namespace)
 	struct _namespace *list, *tail, *node;
 	const gchar *inptr;
 	gchar *astring;
-	size_t len;
+	gsize len;
 
 	inptr = *in;
 
@@ -313,7 +313,7 @@ imap_parse_list_response (CamelImapStore *store, const gchar *buf, gint *flags,
 {
 	gboolean is_lsub = FALSE;
 	const gchar *word;
-	size_t len;
+	gsize len;
 
 	if (*buf != '*')
 		return FALSE;
@@ -683,7 +683,7 @@ imap_is_atom(const gchar *in)
 	register guchar c;
 	register const gchar *p = in;
 
-	while ((c = (unsigned char)*p)) {
+	while ((c = (guchar)*p)) {
 		if (!imap_is_atom_char(c))
 			return FALSE;
 		p++;
@@ -696,7 +696,7 @@ imap_is_atom(const gchar *in)
 /**
  * imap_parse_string_generic:
  * @str_p: a pointer to a string
- * @len: a pointer to a size_t to return the length in
+ * @len: a pointer to a gsize to return the length in
  * @type: type of string (#IMAP_STRING, #IMAP_ASTRING, or #IMAP_NSTRING)
  * to parse.
  *
@@ -715,7 +715,7 @@ imap_is_atom(const gchar *in)
  * latter, it will point to the character after the NIL.)
  **/
 gchar *
-imap_parse_string_generic (const gchar **str_p, size_t *len, gint type)
+imap_parse_string_generic (const gchar **str_p, gsize *len, gint type)
 {
 	const gchar *str = *str_p;
 	gchar *out;
@@ -724,7 +724,7 @@ imap_parse_string_generic (const gchar **str_p, size_t *len, gint type)
 		return NULL;
 	else if (*str == '"') {
 		gchar *p;
-		size_t size;
+		gsize size;
 
 		str++;
 		size = strcspn (str, "\"") + 1;
@@ -764,8 +764,8 @@ imap_parse_string_generic (const gchar **str_p, size_t *len, gint type)
 		*str_p += 3;
 		*len = 0;
 		return NULL;
-	} else if (type == IMAP_ASTRING && imap_is_atom_char ((unsigned char)*str)) {
-		while (imap_is_atom_char ((unsigned char) *str))
+	} else if (type == IMAP_ASTRING && imap_is_atom_char ((guchar)*str)) {
+		while (imap_is_atom_char ((guchar) *str))
 			str++;
 
 		*len = str - *str_p;
@@ -808,7 +808,7 @@ skip_asn (const gchar **str_p)
 		else
 			*str_p = NULL;
 	} else if (*str == '{') {
-		unsigned long len;
+		gulong len;
 
 		len = strtoul (str + 1, (gchar **) &str, 10);
 		if (*str != '}' || *(str + 1) != '\n' ||
@@ -842,12 +842,12 @@ imap_skip_list (const gchar **str_p)
 	skip_char (str_p, ')');
 }
 
-static int
+static gint
 parse_params (const gchar **parms_p, CamelContentType *type)
 {
 	const gchar *parms = *parms_p;
 	gchar *name, *value;
-	size_t len;
+	gsize len;
 
 	if (!g_ascii_strncasecmp (parms, "nil", 3)) {
 		*parms_p += 3;
@@ -889,8 +889,8 @@ imap_body_decode (const gchar **in, CamelMessageContentInfo *ci, CamelFolder *fo
 	CamelContentType *ctype = NULL;
 	gchar *description = NULL;
 	gchar *encoding = NULL;
-	size_t len;
-	size_t size;
+	gsize len;
+	gsize size;
 	gchar *p;
 
 	if (*inptr++ != '(')
@@ -1029,7 +1029,7 @@ imap_body_decode (const gchar **in, CamelMessageContentInfo *ci, CamelFolder *fo
 		if (size == 0)
 			goto exception;
 
-		inptr = (const guchar *) p;
+		inptr = (const gchar *) p;
 
 		if (camel_content_type_is (ctype, "message", "rfc822")) {
 			/* body_type_msg */
@@ -1052,14 +1052,14 @@ imap_body_decode (const gchar **in, CamelMessageContentInfo *ci, CamelFolder *fo
 
 			/* lines */
 			strtoul ((const gchar *) inptr, &p, 10);
-			inptr = (const guchar *) p;
+			inptr = (const gchar *) p;
 		} else if (camel_content_type_is (ctype, "text", "*")) {
 			if (!inptr || *inptr++ != ' ')
 				goto exception;
 
 			/* lines */
 			strtoul ((const gchar *) inptr, &p, 10);
-			inptr = (const guchar *) p;
+			inptr = (const gchar *) p;
 		} else {
 			/* body_type_basic */
 		}
@@ -1174,10 +1174,10 @@ imap_quote_string (const gchar *str)
 }
 
 
-static inline unsigned long
+static inline gulong
 get_summary_uid_numeric (CamelFolderSummary *summary, gint index)
 {
-	unsigned long uid;
+	gulong uid;
 	gchar *suid;
 
 	suid = camel_folder_summary_uid_from_index (summary, index);
@@ -1211,9 +1211,9 @@ get_summary_uid_numeric (CamelFolderSummary *summary, gint index)
  * Return value: the set, which the caller must free with g_free()
  **/
 gchar *
-imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids, gint uid, ssize_t maxlen, gint *lastuid)
+imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids, gint uid, gssize maxlen, gint *lastuid)
 {
-	unsigned long last_uid, next_summary_uid, this_uid;
+	gulong last_uid, next_summary_uid, this_uid;
 	gboolean range = FALSE;
 	gint si, scount;
 	GString *gset;
@@ -1230,10 +1230,10 @@ imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids, gint uid, s
 		/* Find the next UID in the summary after the one we
 		 * just wrote out.
 		 */
-		for ( ; last_uid >= next_summary_uid && si < scount; si++)
+		for (; last_uid >= next_summary_uid && si < scount; si++)
 			next_summary_uid = get_summary_uid_numeric (summary, si);
 		if (last_uid >= next_summary_uid)
-			next_summary_uid = (unsigned long) -1;
+			next_summary_uid = (gulong) -1;
 
 		/* Now get the next UID from @uids */
 		this_uid = strtoul (uids->pdata[uid], NULL, 10);
@@ -1282,7 +1282,7 @@ imap_uid_set_to_array (CamelFolderSummary *summary, const gchar *uids)
 {
 	GPtrArray *arr;
 	gchar *p, *q;
-	unsigned long uid, suid;
+	gulong uid, suid;
 	gint si, scount;
 
 	arr = g_ptr_array_new ();
@@ -1353,7 +1353,7 @@ imap_uid_array_free (GPtrArray *arr)
 gchar *
 imap_concat (CamelImapStore *imap_store, const gchar *prefix, const gchar *suffix)
 {
-	size_t len;
+	gsize len;
 
 	len = strlen (prefix);
 	if (len == 0 || prefix[len - 1] == imap_store->dir_sep)
@@ -1363,7 +1363,7 @@ imap_concat (CamelImapStore *imap_store, const gchar *prefix, const gchar *suffi
 }
 
 gchar *
-imap_mailbox_encode (const guchar *in, size_t inlen)
+imap_mailbox_encode (const guchar *in, gsize inlen)
 {
 	gchar *buf;
 
@@ -1375,7 +1375,7 @@ imap_mailbox_encode (const guchar *in, size_t inlen)
 }
 
 gchar *
-imap_mailbox_decode (const guchar *in, size_t inlen)
+imap_mailbox_decode (const guchar *in, gsize inlen)
 {
 	gchar *buf;
 
diff --git a/camel/providers/imap/camel-imap-utils.h b/camel/providers/imap/camel-imap-utils.h
index 8d7f150..70c8ca8 100644
--- a/camel/providers/imap/camel-imap-utils.h
+++ b/camel/providers/imap/camel-imap-utils.h
@@ -57,7 +57,7 @@ gboolean imap_parse_flag_list      (gchar **flag_list_p, guint32 *flags_out, gch
 
 enum { IMAP_STRING, IMAP_NSTRING, IMAP_ASTRING };
 
-gchar    *imap_parse_string_generic (const gchar **str_p, size_t *len, gint type);
+gchar    *imap_parse_string_generic (const gchar **str_p, gsize *len, gint type);
 
 #define imap_parse_string(str_p, len_p) \
 	imap_parse_string_generic (str_p, len_p, IMAP_STRING)
@@ -74,15 +74,15 @@ gchar    *imap_quote_string         (const gchar *str);
 
 void     imap_skip_list            (const gchar **str_p);
 
-gchar    *imap_uid_array_to_set     (CamelFolderSummary *summary, GPtrArray *uids, gint uid, ssize_t maxlen, gint *lastuid);
+gchar    *imap_uid_array_to_set     (CamelFolderSummary *summary, GPtrArray *uids, gint uid, gssize maxlen, gint *lastuid);
 GPtrArray *imap_uid_set_to_array   (CamelFolderSummary *summary, const gchar *uids);
 void     imap_uid_array_free       (GPtrArray *arr);
 
 gchar *imap_concat (CamelImapStore *imap_store, const gchar *prefix, const gchar *suffix);
 gchar *imap_namespace_concat (CamelImapStore *store, const gchar *name);
 
-gchar *imap_mailbox_encode (const guchar *in, size_t inlen);
-gchar *imap_mailbox_decode (const guchar *in, size_t inlen);
+gchar *imap_mailbox_encode (const guchar *in, gsize inlen);
+gchar *imap_mailbox_decode (const guchar *in, gsize inlen);
 
 typedef gboolean (*IMAPPathFindFoldersCallback) (const gchar *physical_path, const gchar *path, gpointer user_data);
 
diff --git a/camel/providers/imap/camel-imap-wrapper.c b/camel/providers/imap/camel-imap-wrapper.c
index 40f8cc5..0a41f7a 100644
--- a/camel/providers/imap/camel-imap-wrapper.c
+++ b/camel/providers/imap/camel-imap-wrapper.c
@@ -51,7 +51,7 @@ static CamelDataWrapperClass *parent_class = NULL;
 /* Returns the class for a CamelDataWrapper */
 #define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
 
-static ssize_t write_to_stream (CamelDataWrapper *imap_wrapper, CamelStream *stream);
+static gssize write_to_stream (CamelDataWrapper *imap_wrapper, CamelStream *stream);
 
 static void
 camel_imap_wrapper_class_init (CamelImapWrapperClass *camel_imap_wrapper_class)
@@ -130,7 +130,7 @@ imap_wrapper_hydrate (CamelImapWrapper *imap_wrapper, CamelStream *stream)
 }
 
 
-static ssize_t
+static gssize
 write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
 {
 	CamelImapWrapper *imap_wrapper = CAMEL_IMAP_WRAPPER (data_wrapper);
diff --git a/camel/providers/imap4/Makefile.am b/camel/providers/imap4/Makefile.am
index 9bfdd14..21abe7b 100644
--- a/camel/providers/imap4/Makefile.am
+++ b/camel/providers/imap4/Makefile.am
@@ -6,8 +6,6 @@ camel_provider_DATA = libcamelimap4.urls
 INCLUDES = 					\
 	-I$(top_srcdir)				\
 	-I$(top_srcdir)/camel			\
-	-I$(top_srcdir)/intl			\
-	-I$(top_srcdir)/e-util			\
 	-I$(top_srcdir)				\
 	$(CAMEL_CFLAGS)				\
 	$(GNOME_INCLUDEDIR)			\
diff --git a/camel/providers/imap4/camel-imap4-command.c b/camel/providers/imap4/camel-imap4-command.c
index f957b40..2e37efe 100644
--- a/camel/providers/imap4/camel-imap4-command.c
+++ b/camel/providers/imap4/camel-imap4-command.c
@@ -50,7 +50,7 @@ enum {
 	IMAP4_STRING_LITERAL,
 };
 
-static int
+static gint
 imap4_string_get_type (const gchar *str)
 {
 	gint type = 0;
@@ -88,12 +88,12 @@ imap4_string_is_quote_safe (const gchar *str)
 }
 #endif
 
-static size_t
+static gsize
 camel_imap4_literal_length (CamelIMAP4Literal *literal)
 {
 	CamelStream *stream, *null;
 	CamelMimeFilter *crlf;
-	size_t len;
+	gsize len;
 
 	if (literal->type == CAMEL_IMAP4_LITERAL_STRING)
 		return strlen (literal->literal.string);
@@ -222,7 +222,7 @@ camel_imap4_command_newv (CamelIMAP4Engine *engine, CamelIMAP4Folder *imap4_fold
 			gchar *function, **strv;
 			guint u;
 			gchar *string;
-			size_t len;
+			gsize len;
 			gpointer obj;
 			gint c, d;
 
@@ -235,17 +235,17 @@ camel_imap4_command_newv (CamelIMAP4Engine *engine, CamelIMAP4Folder *imap4_fold
 				break;
 			case 'c':
 				/* character */
-				c = va_arg (args, int);
+				c = va_arg (args, gint);
 				g_string_append_c (str, c);
 				break;
 			case 'd':
 				/* integer */
-				d = va_arg (args, int);
+				d = va_arg (args, gint);
 				g_string_append_printf (str, "%d", d);
 				break;
 			case 'u':
 				/* unsigned integer */
-				u = va_arg (args, unsigned int);
+				u = va_arg (args, guint);
 				g_string_append_printf (str, "%u", u);
 				break;
 			case 'F':
@@ -445,7 +445,7 @@ camel_imap4_command_unref (CamelIMAP4Command *ic)
 }
 
 
-static int
+static gint
 imap4_literal_write_to_stream (CamelIMAP4Literal *literal, CamelStream *stream)
 {
 	CamelStream *istream, *ostream = NULL;
@@ -521,7 +521,7 @@ unexpected_token (camel_imap4_token_t *token)
 		fprintf (stderr, "{%u}", token->v.literal);
 		break;
 	default:
-		fprintf (stderr, "%c", (unsigned char) (token->token & 0xff));
+		fprintf (stderr, "%c", (guchar) (token->token & 0xff));
 		break;
 	}
 }
@@ -534,7 +534,7 @@ camel_imap4_command_step (CamelIMAP4Command *ic)
 	CamelIMAP4Literal *literal;
 	camel_imap4_token_t token;
 	guchar *linebuf;
-	size_t len;
+	gsize len;
 
 	g_assert (ic->part != NULL);
 
diff --git a/camel/providers/imap4/camel-imap4-command.h b/camel/providers/imap4/camel-imap4-command.h
index 733a6e9..81b1b08 100644
--- a/camel/providers/imap4/camel-imap4-command.h
+++ b/camel/providers/imap4/camel-imap4-command.h
@@ -44,7 +44,7 @@ typedef struct _CamelIMAP4Literal CamelIMAP4Literal;
 typedef gint (* CamelIMAP4PlusCallback) (struct _CamelIMAP4Engine *engine,
 					CamelIMAP4Command *ic,
 					const guchar *linebuf,
-					size_t linelen, CamelException *ex);
+					gsize linelen, CamelException *ex);
 
 typedef gint (* CamelIMAP4UntaggedCallback) (struct _CamelIMAP4Engine *engine,
 					    CamelIMAP4Command *ic,
@@ -72,7 +72,7 @@ struct _CamelIMAP4Literal {
 typedef struct _CamelIMAP4CommandPart {
 	struct _CamelIMAP4CommandPart *next;
 	guchar *buffer;
-	size_t buflen;
+	gsize buflen;
 
 	CamelIMAP4Literal *literal;
 } CamelIMAP4CommandPart;
diff --git a/camel/providers/imap4/camel-imap4-engine.c b/camel/providers/imap4/camel-imap4-engine.c
index 39c43c1..486a8c8 100644
--- a/camel/providers/imap4/camel-imap4-engine.c
+++ b/camel/providers/imap4/camel-imap4-engine.c
@@ -497,7 +497,7 @@ static struct {
 	{ NULL,            0                                    }
 };
 
-static int
+static gint
 parse_xgwextensions (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, guint32 index, camel_imap4_token_t *token, CamelException *ex)
 {
 	gint i;
@@ -536,7 +536,7 @@ auth_free (gpointer key, gpointer value, gpointer user_data)
 	return TRUE;
 }
 
-static int
+static gint
 engine_parse_capability (CamelIMAP4Engine *engine, gint sentinel, CamelException *ex)
 {
 	camel_imap4_token_t token;
@@ -589,7 +589,7 @@ engine_parse_capability (CamelIMAP4Engine *engine, gint sentinel, CamelException
 	return 0;
 }
 
-static int
+static gint
 engine_parse_flags_list (CamelIMAP4Engine *engine, CamelIMAP4RespCode *resp, gint perm, CamelException *ex)
 {
 	guint32 flags = 0;
@@ -619,7 +619,7 @@ engine_parse_flags_list (CamelIMAP4Engine *engine, CamelIMAP4RespCode *resp, gin
 	return 0;
 }
 
-static int
+static gint
 engine_parse_flags (CamelIMAP4Engine *engine, CamelException *ex)
 {
 	camel_imap4_token_t token;
@@ -639,7 +639,7 @@ engine_parse_flags (CamelIMAP4Engine *engine, CamelException *ex)
 	return 0;
 }
 
-static int
+static gint
 engine_parse_namespace (CamelIMAP4Engine *engine, CamelException *ex)
 {
 	CamelIMAP4Namespace *namespaces[3], *node, *tail;
@@ -826,7 +826,7 @@ camel_imap4_engine_parse_resp_code (CamelIMAP4Engine *engine, CamelException *ex
 	camel_imap4_resp_code_t code;
 	camel_imap4_token_t token;
 	guchar *linebuf;
-	size_t len;
+	gsize len;
 
 	if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
 		return -1;
@@ -1215,7 +1215,7 @@ camel_imap4_engine_handle_untagged_1 (CamelIMAP4Engine *engine, camel_imap4_toke
 		if (!strcmp ("EXISTS", token->v.atom)) {
 			camel_imap4_summary_set_exists (folder->summary, v);
 		} else if (!strcmp ("EXPUNGE", token->v.atom) || !strcmp ("XGWMOVE", token->v.atom)) {
-			camel_imap4_summary_expunge (folder->summary, (int) v);
+			camel_imap4_summary_expunge (folder->summary, (gint) v);
 		} else if (!strcmp ("RECENT", token->v.atom)) {
 			camel_imap4_summary_set_recent (folder->summary, v);
 		} else if (ic && (untagged = g_hash_table_lookup (ic->untagged, token->v.atom))) {
@@ -1274,7 +1274,7 @@ camel_imap4_engine_handle_untagged (CamelIMAP4Engine *engine, CamelException *ex
 }
 
 
-static int
+static gint
 imap4_process_command (CamelIMAP4Engine *engine, CamelIMAP4Command *ic)
 {
 	gint retval;
@@ -1314,7 +1314,7 @@ engine_prequeue_folder_select (CamelIMAP4Engine *engine)
 }
 
 
-static int
+static gint
 engine_state_change (CamelIMAP4Engine *engine, CamelIMAP4Command *ic)
 {
 	const gchar *cmd;
@@ -1593,7 +1593,7 @@ camel_imap4_engine_eat_line (CamelIMAP4Engine *engine, CamelException *ex)
 	camel_imap4_token_t token;
 	guchar *literal;
 	gint retval;
-	size_t n;
+	gsize n;
 
 	do {
 		if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
@@ -1633,11 +1633,11 @@ camel_imap4_engine_eat_line (CamelIMAP4Engine *engine, CamelException *ex)
  * Returns: 0 on success or -1 on fail
  **/
 gint
-camel_imap4_engine_line (CamelIMAP4Engine *engine, guchar **line, size_t *len, CamelException *ex)
+camel_imap4_engine_line (CamelIMAP4Engine *engine, guchar **line, gsize *len, CamelException *ex)
 {
 	GByteArray *linebuf = NULL;
 	guchar *buf;
-	size_t buflen;
+	gsize buflen;
 	gint retval;
 
 	if (line != NULL)
@@ -1689,11 +1689,11 @@ camel_imap4_engine_line (CamelIMAP4Engine *engine, guchar **line, size_t *len, C
  * Returns: 0 on success or -1 on fail.
  **/
 gint
-camel_imap4_engine_literal (CamelIMAP4Engine *engine, guchar **literal, size_t *len, CamelException *ex)
+camel_imap4_engine_literal (CamelIMAP4Engine *engine, guchar **literal, gsize *len, CamelException *ex)
 {
 	GByteArray *literalbuf = NULL;
 	guchar *buf;
-	size_t buflen;
+	gsize buflen;
 	gint retval;
 
 	if (literal != NULL)
@@ -1746,7 +1746,7 @@ gint
 camel_imap4_engine_nstring (CamelIMAP4Engine *engine, guchar **nstring, CamelException *ex)
 {
 	camel_imap4_token_t token;
-	size_t n;
+	gsize n;
 
 	if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
 		return -1;
diff --git a/camel/providers/imap4/camel-imap4-engine.h b/camel/providers/imap4/camel-imap4-engine.h
index e62dcd1..25faae9 100644
--- a/camel/providers/imap4/camel-imap4-engine.h
+++ b/camel/providers/imap4/camel-imap4-engine.h
@@ -222,8 +222,8 @@ void camel_imap4_engine_handle_untagged (CamelIMAP4Engine *engine, CamelExceptio
 
 /* stream wrapper utility functions */
 gint camel_imap4_engine_next_token (CamelIMAP4Engine *engine, struct _camel_imap4_token_t *token, CamelException *ex);
-gint camel_imap4_engine_line (CamelIMAP4Engine *engine, guchar **line, size_t *len, CamelException *ex);
-gint camel_imap4_engine_literal (CamelIMAP4Engine *engine, guchar **literal, size_t *len, CamelException *ex);
+gint camel_imap4_engine_line (CamelIMAP4Engine *engine, guchar **line, gsize *len, CamelException *ex);
+gint camel_imap4_engine_literal (CamelIMAP4Engine *engine, guchar **literal, gsize *len, CamelException *ex);
 gint camel_imap4_engine_nstring (CamelIMAP4Engine *engine, guchar **nstring, CamelException *ex);
 gint camel_imap4_engine_eat_line (CamelIMAP4Engine *engine, CamelException *ex);
 
diff --git a/camel/providers/imap4/camel-imap4-folder.c b/camel/providers/imap4/camel-imap4-folder.c
index b98fc83..cf41c9e 100644
--- a/camel/providers/imap4/camel-imap4-folder.c
+++ b/camel/providers/imap4/camel-imap4-folder.c
@@ -179,7 +179,7 @@ imap4_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex)
 	return camel_data_cache_get_filename (imap4_folder->cache, "cache", uid, ex);
 }
 
-static int
+static gint
 imap4_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	CamelIMAP4Folder *folder = (CamelIMAP4Folder *) object;
@@ -223,7 +223,7 @@ imap4_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
 	return 0;
 }
 
-static int
+static gint
 imap4_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
 {
 	CamelIMAP4Folder *folder = (CamelIMAP4Folder *) object;
@@ -460,7 +460,7 @@ static struct {
 };
 
 
-static int
+static gint
 imap4_sync_flag (CamelFolder *folder, GPtrArray *infos, gchar onoff, const gchar *flag, CamelException *ex)
 {
 	CamelIMAP4Engine *engine = ((CamelIMAP4Store *) folder->parent_store)->engine;
@@ -509,7 +509,7 @@ imap4_sync_flag (CamelFolder *folder, GPtrArray *infos, gchar onoff, const gchar
 	return 0;
 }
 
-static int
+static gint
 imap4_sync_changes (CamelFolder *folder, GPtrArray *sync, CamelException *ex)
 {
 	CamelIMAP4MessageInfo *iinfo;
@@ -702,7 +702,7 @@ imap4_refresh_info (CamelFolder *folder, CamelException *ex)
 	CAMEL_SERVICE_REC_UNLOCK (folder->parent_store, connect_lock);
 }
 
-static int
+static gint
 untagged_fetch (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, guint32 index, camel_imap4_token_t *token, CamelException *ex)
 {
 	CamelFolderSummary *summary = ((CamelFolder *) engine->folder)->summary;
@@ -1081,7 +1081,7 @@ imap4_append_message (CamelFolder *folder, CamelMimeMessage *message,
 }
 
 
-static int
+static gint
 info_uid_sort (const CamelMessageInfo **info0, const CamelMessageInfo **info1)
 {
 	guint32 uid0, uid1;
diff --git a/camel/providers/imap4/camel-imap4-journal.c b/camel/providers/imap4/camel-imap4-journal.c
index 6d6c94a..9dfd7a4 100644
--- a/camel/providers/imap4/camel-imap4-journal.c
+++ b/camel/providers/imap4/camel-imap4-journal.c
@@ -156,7 +156,7 @@ imap4_entry_load (CamelOfflineJournal *journal, FILE *in)
 	return NULL;
 }
 
-static int
+static gint
 imap4_entry_write (CamelOfflineJournal *journal, CamelDListNode *entry, FILE *out)
 {
 	CamelIMAP4JournalEntry *imap4_entry = (CamelIMAP4JournalEntry *) entry;
@@ -188,7 +188,7 @@ imap4_message_info_dup_to (CamelMessageInfoBase *dest, CamelMessageInfoBase *src
 	dest->size = src->size;
 }
 
-static int
+static gint
 imap4_entry_play_append (CamelOfflineJournal *journal, CamelIMAP4JournalEntry *entry, CamelException *ex)
 {
 	CamelIMAP4Folder *imap4_folder = (CamelIMAP4Folder *) journal->folder;
@@ -258,7 +258,7 @@ imap4_entry_play_append (CamelOfflineJournal *journal, CamelIMAP4JournalEntry *e
 	return 0;
 }
 
-static int
+static gint
 imap4_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, CamelException *ex)
 {
 	CamelIMAP4JournalEntry *imap4_entry = (CamelIMAP4JournalEntry *) entry;
diff --git a/camel/providers/imap4/camel-imap4-provider.c b/camel/providers/imap4/camel-imap4-provider.c
index 70686e6..0fbe322 100644
--- a/camel/providers/imap4/camel-imap4-provider.c
+++ b/camel/providers/imap4/camel-imap4-provider.c
@@ -111,7 +111,7 @@ imap4_url_hash (gconstpointer key)
 	return hash;
 }
 
-static int
+static gint
 check_equal (gchar *s1, gchar *s2)
 {
 	if (s1 == NULL) {
@@ -127,7 +127,7 @@ check_equal (gchar *s1, gchar *s2)
 	return strcmp (s1, s2) == 0;
 }
 
-static int
+static gint
 imap4_url_equal (gconstpointer a, gconstpointer b)
 {
 	const CamelURL *u1 = a, *u2 = b;
diff --git a/camel/providers/imap4/camel-imap4-search.c b/camel/providers/imap4/camel-imap4-search.c
index 6567e72..47e424f 100644
--- a/camel/providers/imap4/camel-imap4-search.c
+++ b/camel/providers/imap4/camel-imap4-search.c
@@ -101,7 +101,7 @@ camel_imap4_search_new (CamelIMAP4Engine *engine, const gchar *cachedir)
 }
 
 
-static int
+static gint
 untagged_search (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, guint32 index, camel_imap4_token_t *token, CamelException *ex)
 {
 	CamelFolderSummary *summary = ((CamelFolder *) engine->folder)->summary;
@@ -149,7 +149,7 @@ imap4_body_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv, Ca
 	const gchar *expr;
 	ESExpResult *r;
 	gint id, i, n;
-	size_t used;
+	gsize used;
 	gchar *set;
 
 	if (((CamelOfflineStore *) engine->service)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
@@ -195,7 +195,7 @@ imap4_body_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv, Ca
 			if (!utf8_search) {
 				inptr = (guchar *) argv[i]->value.string;
 				while (*inptr != '\0') {
-					if (!isascii ((int) *inptr)) {
+					if (!isascii ((gint) *inptr)) {
 						utf8_search = TRUE;
 						break;
 					}
diff --git a/camel/providers/imap4/camel-imap4-specials.h b/camel/providers/imap4/camel-imap4-specials.h
index b045674..679001b 100644
--- a/camel/providers/imap4/camel-imap4-specials.h
+++ b/camel/providers/imap4/camel-imap4-specials.h
@@ -38,12 +38,12 @@ enum {
 
 extern guchar camel_imap4_specials[256];
 
-#define is_atom(x) ((camel_imap4_specials[(unsigned char)(x)] & (IS_ASPECIAL|IS_SPACE|IS_CTRL|IS_WILDCARD|IS_QSPECIAL)) == 0)
-#define is_ctrl(x) ((camel_imap4_specials[(unsigned char)(x)] & IS_CTRL) != 0)
-#define is_lwsp(x) ((camel_imap4_specials[(unsigned char)(x)] & IS_LWSP) != 0)
-#define is_type(x, t) ((camel_imap4_specials[(unsigned char)(x)] & (t)) != 0)
-#define is_qsafe(x) ((camel_imap4_specials[(unsigned char)(x)] & (IS_QSPECIAL|IS_CTRL)) == 0)
-#define is_wild(x)  ((camel_imap4_specials[(unsigned char)(x)] & IS_WILDCARD) != 0)
+#define is_atom(x) ((camel_imap4_specials[(guchar)(x)] & (IS_ASPECIAL|IS_SPACE|IS_CTRL|IS_WILDCARD|IS_QSPECIAL)) == 0)
+#define is_ctrl(x) ((camel_imap4_specials[(guchar)(x)] & IS_CTRL) != 0)
+#define is_lwsp(x) ((camel_imap4_specials[(guchar)(x)] & IS_LWSP) != 0)
+#define is_type(x, t) ((camel_imap4_specials[(guchar)(x)] & (t)) != 0)
+#define is_qsafe(x) ((camel_imap4_specials[(guchar)(x)] & (IS_QSPECIAL|IS_CTRL)) == 0)
+#define is_wild(x)  ((camel_imap4_specials[(guchar)(x)] & IS_WILDCARD) != 0)
 
 void camel_imap4_specials_init (void);
 
diff --git a/camel/providers/imap4/camel-imap4-store-summary.c b/camel/providers/imap4/camel-imap4-store-summary.c
index da852d8..6d4eb8f 100644
--- a/camel/providers/imap4/camel-imap4-store-summary.c
+++ b/camel/providers/imap4/camel-imap4-store-summary.c
@@ -167,7 +167,7 @@ load_namespaces (FILE *in)
 	return NULL;
 }
 
-static int
+static gint
 summary_header_load (CamelStoreSummary *s, FILE *in)
 {
 	CamelIMAP4StoreSummary *is = (CamelIMAP4StoreSummary *) s;
@@ -197,7 +197,7 @@ summary_header_load (CamelStoreSummary *s, FILE *in)
 	return 0;
 }
 
-static int
+static gint
 save_namespaces (FILE *out, CamelIMAP4NamespaceList *nsl)
 {
 	CamelIMAP4Namespace *ns, *cur = NULL;
@@ -237,7 +237,7 @@ save_namespaces (FILE *out, CamelIMAP4NamespaceList *nsl)
 	return 0;
 }
 
-static int
+static gint
 summary_header_save (CamelStoreSummary *s, FILE *out)
 {
 	CamelIMAP4StoreSummary *is = (CamelIMAP4StoreSummary *) s;
@@ -263,7 +263,7 @@ store_info_load (CamelStoreSummary *s, FILE *in)
 	return parent_class->store_info_load (s, in);
 }
 
-static int
+static gint
 store_info_save (CamelStoreSummary *s, FILE *out, CamelStoreInfo *info)
 {
 	return parent_class->store_info_save (s, out, info);
@@ -381,7 +381,7 @@ camel_imap4_store_summary_get_folder_info (CamelIMAP4StoreSummary *s, const gcha
 	CamelFolderInfo *fi;
 	GPtrArray *folders;
 	CamelStoreInfo *si;
-	size_t toplen, len;
+	gsize toplen, len;
 	gint i;
 
 	toplen = strlen (top);
diff --git a/camel/providers/imap4/camel-imap4-store.c b/camel/providers/imap4/camel-imap4-store.c
index 9caaefd..31e5d13 100644
--- a/camel/providers/imap4/camel-imap4-store.c
+++ b/camel/providers/imap4/camel-imap4-store.c
@@ -110,7 +110,7 @@ imap4_hash_folder_name (gconstpointer key)
 		return g_str_hash (key);
 }
 
-static int
+static gint
 imap4_compare_folder_name (gconstpointer a, gconstpointer b)
 {
 	gconstpointer aname = a, bname = b;
@@ -403,8 +403,8 @@ connect_to_server_wrapper (CamelIMAP4Engine *engine, CamelException *ex)
 	return ret;
 }
 
-static int
-sasl_auth (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, const guchar *linebuf, size_t linelen, CamelException *ex)
+static gint
+sasl_auth (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, const guchar *linebuf, gsize linelen, CamelException *ex)
 {
 	/* Perform a single challenge iteration */
 	CamelSasl *sasl = ic->user_data;
@@ -441,7 +441,7 @@ sasl_auth (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, const guchar *linebu
 	return 0;
 }
 
-static int
+static gint
 imap4_try_authenticate (CamelIMAP4Engine *engine, gboolean reprompt, const gchar *errmsg, CamelException *ex)
 {
 	CamelService *service = engine->service;
@@ -1154,7 +1154,7 @@ imap4_rename_folder (CamelStore *store, const gchar *old_name, const gchar *new_
 	CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 }
 
-static int
+static gint
 list_sort (const camel_imap4_list_t **list0, const camel_imap4_list_t **list1)
 {
 	return strcmp ((*list0)->name, (*list1)->name);
@@ -1513,7 +1513,7 @@ imap4_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, Camel
 	}
 
 	if (*top != '\0') {
-		size_t len;
+		gsize len;
 		gchar sep;
 
 		len = strlen (pattern);
diff --git a/camel/providers/imap4/camel-imap4-stream.c b/camel/providers/imap4/camel-imap4-stream.c
index 7e51906..ec6de21 100644
--- a/camel/providers/imap4/camel-imap4-stream.c
+++ b/camel/providers/imap4/camel-imap4-stream.c
@@ -43,8 +43,8 @@ static void camel_imap4_stream_class_init (CamelIMAP4StreamClass *klass);
 static void camel_imap4_stream_init (CamelIMAP4Stream *stream, CamelIMAP4StreamClass *klass);
 static void camel_imap4_stream_finalize (CamelObject *object);
 
-static ssize_t stream_read (CamelStream *stream, gchar *buffer, size_t n);
-static ssize_t stream_write (CamelStream *stream, const gchar *buffer, size_t n);
+static gssize stream_read (CamelStream *stream, gchar *buffer, gsize n);
+static gssize stream_write (CamelStream *stream, const gchar *buffer, gsize n);
 static gint stream_flush  (CamelStream *stream);
 static gint stream_close  (CamelStream *stream);
 static gboolean stream_eos (CamelStream *stream);
@@ -120,12 +120,12 @@ camel_imap4_stream_finalize (CamelObject *object)
 }
 
 
-static ssize_t
+static gssize
 imap4_fill (CamelIMAP4Stream *imap4)
 {
 	guchar *inbuf, *inptr, *inend;
-	ssize_t nread;
-	size_t inlen;
+	gssize nread;
+	gsize inlen;
 
 	if (imap4->disconnected) {
 		errno = EINVAL;
@@ -146,7 +146,7 @@ imap4_fill (CamelIMAP4Stream *imap4)
 		inptr = inbuf;
 		inbuf += inlen;
 	} else if (inptr > imap4->realbuf) {
-		size_t shift;
+		gsize shift;
 
 		shift = MIN (inptr - imap4->realbuf, inend - inbuf);
 		memmove (inptr - shift, inptr, inlen);
@@ -171,11 +171,11 @@ imap4_fill (CamelIMAP4Stream *imap4)
 	return imap4->inend - imap4->inptr;
 }
 
-static ssize_t
-stream_read (CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelIMAP4Stream *imap4 = (CamelIMAP4Stream *) stream;
-	ssize_t len, nread = 0;
+	gssize len, nread = 0;
 
 	if (imap4->mode == CAMEL_IMAP4_STREAM_MODE_LITERAL) {
 		/* don't let our caller read past the end of the literal */
@@ -210,11 +210,11 @@ stream_read (CamelStream *stream, gchar *buffer, size_t n)
 	return nread;
 }
 
-static ssize_t
-stream_write (CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelIMAP4Stream *imap4 = (CamelIMAP4Stream *) stream;
-	ssize_t nwritten;
+	gssize nwritten;
 
 	if (imap4->disconnected) {
 		errno = EINVAL;
@@ -227,7 +227,7 @@ stream_write (CamelStream *stream, const gchar *buffer, size_t n)
 	return nwritten;
 }
 
-static int
+static gint
 stream_flush (CamelStream *stream)
 {
 	CamelIMAP4Stream *imap4 = (CamelIMAP4Stream *) stream;
@@ -235,7 +235,7 @@ stream_flush (CamelStream *stream)
 	return camel_stream_flush (imap4->stream);
 }
 
-static int
+static gint
 stream_close (CamelStream *stream)
 {
 	CamelIMAP4Stream *imap4 = (CamelIMAP4Stream *) stream;
@@ -333,7 +333,7 @@ camel_imap4_stream_next_token (CamelIMAP4Stream *stream, camel_imap4_token_t *to
 	register guchar *inptr;
 	guchar *inend, *start, *p;
 	gboolean escaped = FALSE;
-	size_t literal = 0;
+	gsize literal = 0;
 	guint32 nz_number;
 	gint ret;
 
@@ -434,11 +434,11 @@ camel_imap4_stream_next_token (CamelIMAP4Stream *stream, camel_imap4_token_t *to
 				if ((p = strchr (inptr, '}')) && strchr (p, '\n')) {
 					inptr++;
 
-					while (isdigit ((int) *inptr) && literal < UINT_MAX / 10)
+					while (isdigit ((gint) *inptr) && literal < UINT_MAX / 10)
 						literal = (literal * 10) + (*inptr++ - '0');
 
 					if (*inptr != '}') {
-						if (isdigit ((int) *inptr))
+						if (isdigit ((gint) *inptr))
 							g_warning ("illegal literal identifier: literal too large");
 						else if (*inptr != '+')
 							g_warning ("illegal literal identifier: garbage following size");
@@ -629,7 +629,7 @@ camel_imap4_stream_unget_token (CamelIMAP4Stream *stream, camel_imap4_token_t *t
  * read is incomplete.
  **/
 gint
-camel_imap4_stream_line (CamelIMAP4Stream *stream, guchar **line, size_t *len)
+camel_imap4_stream_line (CamelIMAP4Stream *stream, guchar **line, gsize *len)
 {
 	register guchar *inptr;
 	guchar *inend;
@@ -691,10 +691,10 @@ camel_imap4_stream_line (CamelIMAP4Stream *stream, guchar **line, size_t *len)
  * has been reached or -1 on fail.
  **/
 gint
-camel_imap4_stream_literal (CamelIMAP4Stream *stream, guchar **literal, size_t *len)
+camel_imap4_stream_literal (CamelIMAP4Stream *stream, guchar **literal, gsize *len)
 {
 	guchar *inptr, *inend;
-	size_t nread;
+	gsize nread;
 
 	g_return_val_if_fail (CAMEL_IS_IMAP4_STREAM (stream), -1);
 	g_return_val_if_fail (stream->mode == CAMEL_IMAP4_STREAM_MODE_LITERAL, -1);
diff --git a/camel/providers/imap4/camel-imap4-stream.h b/camel/providers/imap4/camel-imap4-stream.h
index 18a9479..55393bd 100644
--- a/camel/providers/imap4/camel-imap4-stream.h
+++ b/camel/providers/imap4/camel-imap4-stream.h
@@ -63,7 +63,7 @@ typedef struct _camel_imap4_token_t {
 		gchar *atom;
 		gchar *flag;
 		gchar *qstring;
-		size_t literal;
+		gsize literal;
 		guint32 number;
 	} v;
 } camel_imap4_token_t;
@@ -83,7 +83,7 @@ struct _CamelIMAP4Stream {
 	guint mode:1;          /* TOKEN vs LITERAL */
 	guint eol:1;           /* end-of-literal */
 
-	size_t literal;
+	gsize literal;
 
 	/* i/o buffers */
 	guchar realbuf[IMAP4_READ_PRELEN + IMAP4_READ_BUFLEN + 1];
@@ -114,8 +114,8 @@ CamelStream *camel_imap4_stream_new (CamelStream *stream);
 gint camel_imap4_stream_next_token (CamelIMAP4Stream *stream, camel_imap4_token_t *token);
 gint camel_imap4_stream_unget_token (CamelIMAP4Stream *stream, camel_imap4_token_t *token);
 
-gint camel_imap4_stream_line (CamelIMAP4Stream *stream, guchar **line, size_t *len);
-gint camel_imap4_stream_literal (CamelIMAP4Stream *stream, guchar **literal, size_t *len);
+gint camel_imap4_stream_line (CamelIMAP4Stream *stream, guchar **line, gsize *len);
+gint camel_imap4_stream_literal (CamelIMAP4Stream *stream, guchar **literal, gsize *len);
 
 G_END_DECLS
 
diff --git a/camel/providers/imap4/camel-imap4-summary.c b/camel/providers/imap4/camel-imap4-summary.c
index 64804a6..45fd732 100644
--- a/camel/providers/imap4/camel-imap4-summary.c
+++ b/camel/providers/imap4/camel-imap4-summary.c
@@ -144,7 +144,7 @@ camel_imap4_summary_new (CamelFolder *folder)
 	return summary;
 }
 
-static int
+static gint
 imap4_header_load (CamelFolderSummary *summary, FILE *fin)
 {
 	CamelIMAP4Summary *imap4_summary = (CamelIMAP4Summary *) summary;
@@ -180,7 +180,7 @@ imap4_header_load (CamelFolderSummary *summary, FILE *fin)
 	return 0;
 }
 
-static int
+static gint
 imap4_header_save (CamelFolderSummary *summary, FILE *fout)
 {
 	CamelIMAP4Summary *imap4_summary = (CamelIMAP4Summary *) summary;
@@ -197,7 +197,7 @@ imap4_header_save (CamelFolderSummary *summary, FILE *fout)
 	return 0;
 }
 
-static int
+static gint
 envelope_decode_address (CamelIMAP4Engine *engine, GString *addrs, CamelException *ex)
 {
 	gchar *addr, *name = NULL, *user = NULL;
@@ -206,7 +206,7 @@ envelope_decode_address (CamelIMAP4Engine *engine, GString *addrs, CamelExceptio
 	camel_imap4_token_t token;
 	const gchar *domain = NULL;
 	gint part = 0;
-	size_t n;
+	gsize n;
 
 	if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
 		return -1;
@@ -300,7 +300,7 @@ envelope_decode_address (CamelIMAP4Engine *engine, GString *addrs, CamelExceptio
 	return -1;
 }
 
-static int
+static gint
 envelope_decode_addresses (CamelIMAP4Engine *engine, gchar **addrlist, CamelException *ex)
 {
 	camel_imap4_token_t token;
@@ -346,13 +346,13 @@ envelope_decode_addresses (CamelIMAP4Engine *engine, gchar **addrlist, CamelExce
 	return 0;
 }
 
-static int
+static gint
 envelope_decode_date (CamelIMAP4Engine *engine, time_t *date, CamelException *ex)
 {
 	guchar *literal = NULL;
 	camel_imap4_token_t token;
 	const gchar *nstring;
-	size_t n;
+	gsize n;
 
 	if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
 		return -1;
@@ -385,12 +385,12 @@ envelope_decode_date (CamelIMAP4Engine *engine, time_t *date, CamelException *ex
 	return 0;
 }
 
-static int
+static gint
 envelope_decode_nstring (CamelIMAP4Engine *engine, gchar **nstring, gboolean rfc2047, CamelException *ex)
 {
 	camel_imap4_token_t token;
 	guchar *literal;
-	size_t n;
+	gsize n;
 
 	if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
 		return -1;
@@ -477,7 +477,7 @@ decode_references (const gchar *refstr, const gchar *irtstr)
 	return references;
 }
 
-static int
+static gint
 decode_envelope (CamelIMAP4Engine *engine, CamelMessageInfo *info, camel_imap4_token_t *token, CamelException *ex)
 {
 	CamelIMAP4MessageInfo *iinfo = (CamelIMAP4MessageInfo *) info;
@@ -598,7 +598,7 @@ decode_time (const gchar **in, gint *hour, gint *min, gint *sec)
 	*hour = *min = *sec = 0;
 
 	val = hour;
-	for ( ; *inptr && !isspace ((int) *inptr); inptr++) {
+	for (; *inptr && !isspace ((gint) *inptr); inptr++) {
 		if (*inptr == ':') {
 			colons++;
 			switch (colons) {
@@ -611,7 +611,7 @@ decode_time (const gchar **in, gint *hour, gint *min, gint *sec)
 			default:
 				return FALSE;
 			}
-		} else if (!isdigit ((int) *inptr))
+		} else if (!isdigit ((gint) *inptr))
 			return FALSE;
 		else
 			*val = (*val * 10) + (*inptr - '0');
@@ -901,7 +901,7 @@ imap4_fetch_all_update (struct imap4_fetch_all_t *fetch)
 	g_free (fetch);
 }
 
-static int
+static gint
 untagged_fetch_all (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, guint32 index, camel_imap4_token_t *token, CamelException *ex)
 {
 	struct imap4_fetch_all_t *fetch = ic->user_data;
@@ -920,8 +920,8 @@ untagged_fetch_all (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, guint32 ind
 		 * client expunged messages in the range
 		 * before fetch->first in the period between
 		 * our previous attempt and now. */
-		size_t movelen = added->len * sizeof (gpointer);
-		size_t extra = index - fetch->first;
+		gsize movelen = added->len * sizeof (gpointer);
+		gsize extra = index - fetch->first;
 		gpointer dest;
 
 		g_assert (fetch->all);
@@ -932,7 +932,7 @@ untagged_fetch_all (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, guint32 ind
 		fetch->total += extra;
 		fetch->first = index;
 	} else if (index > (added->len + (fetch->first - 1))) {
-		size_t extra = index - (added->len + (fetch->first - 1));
+		gsize extra = index - (added->len + (fetch->first - 1));
 		g_ptr_array_set_size (added, added->len + extra);
 		fetch->total += extra;
 	}
@@ -1054,7 +1054,7 @@ untagged_fetch_all (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, guint32 ind
 			guchar *literal;
 			const gchar *refs, *str;
 			gchar *mlist;
-			size_t n;
+			gsize n;
 
 			/* '(' */
 			if (camel_imap4_engine_next_token (engine, token, ex) == -1)
@@ -1374,7 +1374,7 @@ imap4_message_info_load (CamelFolderSummary *summary, FILE *fin)
 	return NULL;
 }
 
-static int
+static gint
 imap4_message_info_save (CamelFolderSummary *summary, FILE *fout, CamelMessageInfo *info)
 {
 	CamelIMAP4MessageInfo *minfo = (CamelIMAP4MessageInfo *) info;
@@ -1412,7 +1412,7 @@ imap4_content_info_load (CamelFolderSummary *summary, FILE *in)
 		return camel_folder_summary_content_info_new (summary);
 }
 
-static int
+static gint
 imap4_content_info_save (CamelFolderSummary *summary, FILE *out, CamelMessageContentInfo *info)
 {
 	if (info->type) {
@@ -1535,7 +1535,7 @@ camel_imap4_summary_expunge (CamelFolderSummary *summary, gint seqid)
 }
 
 #if 0
-static int
+static gint
 info_uid_sort (const CamelMessageInfo **info0, const CamelMessageInfo **info1)
 {
 	guint32 uid0, uid1;
diff --git a/camel/providers/imap4/camel-imap4-utils.c b/camel/providers/imap4/camel-imap4-utils.c
index 90b9e1d..5ccf05d 100644
--- a/camel/providers/imap4/camel-imap4-utils.c
+++ b/camel/providers/imap4/camel-imap4-utils.c
@@ -49,7 +49,7 @@ camel_imap4_build_folder_info_tree (GPtrArray *array, const gchar *top)
 {
 	CamelFolderInfo *cur, *fi, *root = NULL;
 	const gchar *p;
-	size_t n = 0;
+	gsize n = 0;
 	gchar *pname;
 	gint i;
 
@@ -207,12 +207,12 @@ camel_imap4_namespace_list_free (CamelIMAP4NamespaceList *nsl)
 }
 
 
-char
+gchar
 camel_imap4_get_path_delim (CamelIMAP4StoreSummary *s, const gchar *full_name)
 {
 	CamelIMAP4Namespace *namespace;
 	const gchar *slash;
-	size_t len;
+	gsize len;
 	gchar *top;
 
 	g_return_val_if_fail (s->namespaces != NULL, '/');
@@ -272,7 +272,7 @@ struct _uidset {
 	CamelFolderSummary *summary;
 	struct _uidset_range *ranges;
 	struct _uidset_range *tail;
-	size_t maxlen, setlen;
+	gsize maxlen, setlen;
 };
 
 static void
@@ -288,7 +288,7 @@ uidset_range_free (struct _uidset_range *range)
 }
 
 static void
-uidset_init (struct _uidset *uidset, CamelFolderSummary *summary, size_t maxlen)
+uidset_init (struct _uidset *uidset, CamelFolderSummary *summary, gsize maxlen)
 {
 	uidset->ranges = g_new (struct _uidset_range, 1);
 	uidset->ranges->first = (guint32) -1;
@@ -303,13 +303,13 @@ uidset_init (struct _uidset *uidset, CamelFolderSummary *summary, size_t maxlen)
 }
 
 /* returns: -1 on full-and-not-added, 0 on added-and-not-full or 1 on added-and-full */
-static int
+static gint
 uidset_add (struct _uidset *uidset, CamelMessageInfo *info)
 {
 	GPtrArray *messages = uidset->summary->messages;
 	struct _uidset_range *node, *tail = uidset->tail;
 	const gchar *iuid = camel_message_info_uid (info);
-	size_t uidlen, len;
+	gsize uidlen, len;
 	const gchar *colon;
 	guint32 index;
 
@@ -397,10 +397,10 @@ uidset_to_string (struct _uidset *uidset)
 }
 
 gint
-camel_imap4_get_uid_set (CamelIMAP4Engine *engine, CamelFolderSummary *summary, GPtrArray *infos, gint cur, size_t linelen, gchar **set)
+camel_imap4_get_uid_set (CamelIMAP4Engine *engine, CamelFolderSummary *summary, GPtrArray *infos, gint cur, gsize linelen, gchar **set)
 {
 	struct _uidset uidset;
-	size_t maxlen;
+	gsize maxlen;
 	gint rv = 0;
 	gint i;
 
@@ -460,7 +460,7 @@ camel_imap4_utils_set_unexpected_token_error (CamelException *ex, CamelIMAP4Engi
 		g_string_append (errmsg, _("No data"));
 		break;
 	default:
-		g_string_append_c (errmsg, (unsigned char) (token->token & 0xff));
+		g_string_append_c (errmsg, (guchar) (token->token & 0xff));
 		break;
 	}
 
@@ -555,7 +555,7 @@ camel_imap4_untagged_list (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, guin
 	guint32 flags = 0;
 	GString *literal;
 	gchar delim;
-	size_t n;
+	gsize n;
 	gint i;
 
 	if (camel_imap4_engine_next_token (engine, token, ex) == -1)
@@ -684,7 +684,7 @@ camel_imap4_untagged_status (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, gu
 	camel_imap4_status_t *status;
 	guchar *literal;
 	gchar *mailbox;
-	size_t len;
+	gsize len;
 	gint type;
 	gint i;
 
@@ -707,7 +707,7 @@ camel_imap4_untagged_status (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, gu
 	default:
 		fprintf (stderr, "Unexpected token in IMAP4 untagged STATUS response: %s%c\n",
 			 token->token == CAMEL_IMAP4_TOKEN_NIL ? "NIL" : "",
-			 (unsigned char) (token->token & 0xff));
+			 (guchar) (token->token & 0xff));
 		camel_imap4_utils_set_unexpected_token_error (ex, engine, token);
 		return -1;
 	}
diff --git a/camel/providers/imap4/camel-imap4-utils.h b/camel/providers/imap4/camel-imap4-utils.h
index c08411e..a0f6536 100644
--- a/camel/providers/imap4/camel-imap4-utils.h
+++ b/camel/providers/imap4/camel-imap4-utils.h
@@ -57,7 +57,7 @@ void camel_imap4_namespace_list_free (struct _CamelIMAP4NamespaceList *nsl);
 
 gchar camel_imap4_get_path_delim (struct _CamelIMAP4StoreSummary *s, const gchar *full_name);
 
-gint camel_imap4_get_uid_set (struct _CamelIMAP4Engine *engine, struct _CamelFolderSummary *summary, GPtrArray *infos, gint cur, size_t linelen, gchar **set);
+gint camel_imap4_get_uid_set (struct _CamelIMAP4Engine *engine, struct _CamelFolderSummary *summary, GPtrArray *infos, gint cur, gsize linelen, gchar **set);
 
 void camel_imap4_utils_set_unexpected_token_error (CamelException *ex, struct _CamelIMAP4Engine *engine, struct _camel_imap4_token_t *token);
 
diff --git a/camel/providers/imapp/Makefile.am b/camel/providers/imapp/Makefile.am
index 8260c58..c2b475c 100644
--- a/camel/providers/imapp/Makefile.am
+++ b/camel/providers/imapp/Makefile.am
@@ -6,8 +6,6 @@ camel_provider_DATA = libcamelimapp.urls
 INCLUDES = -I.. \
 	-I$(srcdir)/..				\
 	-I$(top_srcdir)/camel			\
-	-I$(top_srcdir)/intl			\
-	-I$(top_srcdir)/e-util			\
 	-I$(top_srcdir)				\
 	$(CAMEL_CFLAGS)				\
 	$(GNOME_INCLUDEDIR)			\
diff --git a/camel/providers/imapp/camel-imapp-driver.c b/camel/providers/imapp/camel-imapp-driver.c
index 198b2a9..1a5f39e 100644
--- a/camel/providers/imapp/camel-imapp-driver.c
+++ b/camel/providers/imapp/camel-imapp-driver.c
@@ -552,7 +552,7 @@ camel_imapp_driver_list(CamelIMAPPDriver *id, const gchar *name, guint32 flags)
 	return res;
 }
 
-static int
+static gint
 driver_resp_list(CamelIMAPPEngine *ie, guint32 idx, CamelIMAPPDriver *id)
 {
 	struct _list_info *linfo;
@@ -634,7 +634,7 @@ driver_status(CamelIMAPPEngine *ie, struct _status_info *sinfo, CamelIMAPPDriver
 	}
 }
 
-static int
+static gint
 driver_resp_exists(CamelIMAPPEngine *ie, guint32 id, CamelIMAPPDriver *sdata)
 {
 	/* should this be an event instead? */
@@ -644,7 +644,7 @@ driver_resp_exists(CamelIMAPPEngine *ie, guint32 id, CamelIMAPPDriver *sdata)
 	return camel_imapp_engine_skip(ie);
 }
 
-static int
+static gint
 driver_resp_expunge(CamelIMAPPEngine *ie, guint32 id, CamelIMAPPDriver *sdata)
 {
 	printf("got expunge response %u\n", id);
@@ -666,7 +666,7 @@ driver_resp_expunge(CamelIMAPPEngine *ie, guint32 id, CamelIMAPPDriver *sdata)
 	return camel_imapp_engine_skip(ie);
 }
 
-static int
+static gint
 driver_resp_fetch(CamelIMAPPEngine *ie, guint32 id, CamelIMAPPDriver *sdata)
 {
 	struct _fetch_info *finfo = NULL;
diff --git a/camel/providers/imapp/camel-imapp-engine.c b/camel/providers/imapp/camel-imapp-engine.c
index e9157df..f27fb75 100644
--- a/camel/providers/imapp/camel-imapp-engine.c
+++ b/camel/providers/imapp/camel-imapp-engine.c
@@ -131,7 +131,7 @@ static gint resp_capability(CamelIMAPPEngine *ie, guint32 id, gpointer data)
 				*p++ = toupper(c);
 		case IMAP_TOK_INT:
 			printf(" cap: '%s'\n", token);
-			for (i=0;i<(int)(sizeof(capa_table)/sizeof(capa_table[0]));i++)
+			for (i=0;i<(gint)(sizeof(capa_table)/sizeof(capa_table[0]));i++)
 				if (strcmp(token, capa_table[i].name))
 					ie->capa |= capa_table[i].flag;
 			break;
@@ -329,7 +329,7 @@ camel_imapp_engine_skip(CamelIMAPPEngine *imap)
 		if (tok == IMAP_TOK_LITERAL) {
 			camel_imapp_stream_set_literal(imap->stream, len);
 			while ((tok = camel_imapp_stream_getl(imap->stream, &token, &len)) > 0) {
-				printf("Skip literal data '%.*s'\n", (int)len, token);
+				printf("Skip literal data '%.*s'\n", (gint)len, token);
 			}
 		}
 	} while (tok != '\n' && tok >= 0);
@@ -341,7 +341,7 @@ camel_imapp_engine_skip(CamelIMAPPEngine *imap)
 }
 
 /* handle any untagged responses */
-static int
+static gint
 iterate_untagged(CamelIMAPPEngine *imap)
 {
 	guint id, len;
@@ -439,7 +439,7 @@ iterate_untagged(CamelIMAPPEngine *imap)
 
 /* handle any continuation requests
    either data continuations, or auth continuation */
-static int
+static gint
 iterate_continuation(CamelIMAPPEngine *imap)
 {
 	CamelIMAPPCommand *ic;
@@ -521,7 +521,7 @@ iterate_continuation(CamelIMAPPEngine *imap)
 }
 
 /* handle a completion line */
-static int
+static gint
 iterate_completion(CamelIMAPPEngine *imap, guchar *token)
 {
 	CamelIMAPPCommand *ic;
@@ -847,7 +847,7 @@ static gint len(CamelDList *list)
 static void
 imap_engine_command_complete(CamelIMAPPEngine *imap, CamelIMAPPCommand *ic)
 {
-	c(printf("completing command buffer is [%d] '%.*s'\n", ic->mem->buffer->len, (int)ic->mem->buffer->len, ic->mem->buffer->data));
+	c(printf("completing command buffer is [%d] '%.*s'\n", ic->mem->buffer->len, (gint)ic->mem->buffer->len, ic->mem->buffer->data));
 	c(printf("command has %d parts\n", len(&ic->parts)));
 	if (ic->mem->buffer->len > 0)
 		imap_engine_command_add_part(imap, ic, CAMEL_IMAPP_COMMAND_SIMPLE, NULL);
@@ -871,7 +871,7 @@ imap_engine_command_addv(CamelIMAPPEngine *imap, CamelIMAPPCommand *ic, const gc
 	gint zero;
 	gchar *s;
 	gint d;
-	long gint l;
+	glong gint l;
 	guint32 f;
 	CamelStream *S;
 	CamelDataWrapper *D;
@@ -957,20 +957,20 @@ imap_engine_command_addv(CamelIMAPPEngine *imap, CamelIMAPPCommand *ic, const gc
 					imap_write_flags((CamelStream *)ic->mem, f);
 					break;
 				case 'c':
-					d = va_arg(ap, int);
+					d = va_arg(ap, gint);
 					ch = d;
 					camel_stream_write((CamelStream *)ic->mem, &ch, 1);
 					break;
 				case 'd': /* int/unsigned */
 				case 'u':
 					if (llong) {
-						l = va_arg(ap, long int);
-						c(printf("got long gint '%d'\n", (int)l));
+						l = va_arg(ap, glong gint);
+						c(printf("got glong gint '%d'\n", (gint)l));
 						memcpy(buffer, start, p-start);
 						buffer[p-start] = 0;
 						camel_stream_printf((CamelStream *)ic->mem, buffer, l);
 					} else {
-						d = va_arg(ap, int);
+						d = va_arg(ap, gint);
 						c(printf("got gint '%d'\n", d));
 						memcpy(buffer, start, p-start);
 						buffer[p-start] = 0;
diff --git a/camel/providers/imapp/camel-imapp-engine.h b/camel/providers/imapp/camel-imapp-engine.h
index 37f2a40..9f7e931 100644
--- a/camel/providers/imapp/camel-imapp-engine.h
+++ b/camel/providers/imapp/camel-imapp-engine.h
@@ -140,9 +140,9 @@ CamelType       camel_imapp_engine_get_type (void);
 CamelIMAPPEngine  *camel_imapp_engine_new(CamelIMAPPStream *stream);
 
 void		camel_imapp_engine_add_handler(CamelIMAPPEngine *imap, const gchar *response, CamelIMAPPEngineFunc func, gpointer data);
-int		camel_imapp_engine_iterate(CamelIMAPPEngine *imap, CamelIMAPPCommand *wait); /* throws PARSE,IO exception */
-int		camel_imapp_engine_skip(CamelIMAPPEngine *imap);
-int		camel_imapp_engine_capabilities(CamelIMAPPEngine *imap);
+gint		camel_imapp_engine_iterate(CamelIMAPPEngine *imap, CamelIMAPPCommand *wait); /* throws PARSE,IO exception */
+gint		camel_imapp_engine_skip(CamelIMAPPEngine *imap);
+gint		camel_imapp_engine_capabilities(CamelIMAPPEngine *imap);
 
 CamelIMAPPCommand *camel_imapp_engine_command_new  (CamelIMAPPEngine *imap, const gchar *name, const gchar *select, const gchar *fmt, ...);
 void		camel_imapp_engine_command_complete(CamelIMAPPEngine *imap, struct _CamelIMAPPCommand *, CamelIMAPPCommandFunc func, gpointer data);
diff --git a/camel/providers/imapp/camel-imapp-fetch-stream.c b/camel/providers/imapp/camel-imapp-fetch-stream.c
index 7d6e01a..b5f4345 100644
--- a/camel/providers/imapp/camel-imapp-fetch-stream.c
+++ b/camel/providers/imapp/camel-imapp-fetch-stream.c
@@ -44,11 +44,11 @@ static CamelObjectClass *parent_class = NULL;
 /* Returns the class for a CamelStream */
 #define CS_CLASS(so) CAMEL_IMAPP_FETCH_STREAM_CLASS(CAMEL_OBJECT_GET_CLASS(so))
 
-static ssize_t
-stream_read(CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read(CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelIMAPPFetchStream *is = (CamelIMAPPFetchStream *)stream;
-	ssize_t max;
+	gssize max;
 
 	/* make sure we have all the data read in */
 	while (camel_imapp_engine_iterate(is->engine, is->command)>0)
@@ -75,22 +75,22 @@ stream_read(CamelStream *stream, gchar *buffer, size_t n)
 	return max;
 }
 
-static ssize_t
-stream_write(CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write(CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelIMAPPFetchStream *is = (CamelIMAPPFetchStream *)stream;
 
 	return camel_stream_write(is->source, buffer, n);
 }
 
-static int
+static gint
 stream_close(CamelStream *stream)
 {
 	/* nop? */
 	return 0;
 }
 
-static int
+static gint
 stream_flush(CamelStream *stream)
 {
 	/* nop? */
@@ -105,7 +105,7 @@ stream_eos(CamelStream *stream)
 	return is->literal == 0;
 }
 
-static int
+static gint
 stream_reset(CamelStream *stream)
 {
 	/* nop?  reset literal mode? */
diff --git a/camel/providers/imapp/camel-imapp-store-summary.c b/camel/providers/imapp/camel-imapp-store-summary.c
index 57317ff..6deab29 100644
--- a/camel/providers/imapp/camel-imapp-store-summary.c
+++ b/camel/providers/imapp/camel-imapp-store-summary.c
@@ -49,10 +49,10 @@ static gint summary_header_save(CamelStoreSummary *, FILE *);
 
 /*static CamelStoreInfo * store_info_new(CamelStoreSummary *, const gchar *);*/
 static CamelStoreInfo * store_info_load(CamelStoreSummary *, FILE *);
-static int		 store_info_save(CamelStoreSummary *, FILE *, CamelStoreInfo *);
+static gint		 store_info_save(CamelStoreSummary *, FILE *, CamelStoreInfo *);
 static void		 store_info_free(CamelStoreSummary *, CamelStoreInfo *);
 
-static const gchar *store_info_string(CamelStoreSummary *, const CamelStoreInfo *, int);
+static const gchar *store_info_string(CamelStoreSummary *, const CamelStoreInfo *, gint);
 static void store_info_set_string(CamelStoreSummary *, CamelStoreInfo *, int, const gchar *);
 
 static void camel_imapp_store_summary_class_init (CamelIMAPPStoreSummaryClass *klass);
@@ -470,7 +470,7 @@ namespace_load(CamelStoreSummary *s, FILE *in)
 	return ns;
 }
 
-static int
+static gint
 namespace_save(CamelStoreSummary *s, FILE *in, CamelIMAPPStoreNamespace *ns)
 {
 	if (camel_file_util_encode_string(in, ns->path) == -1
@@ -481,7 +481,7 @@ namespace_save(CamelStoreSummary *s, FILE *in, CamelIMAPPStoreNamespace *ns)
 	return 0;
 }
 
-static int
+static gint
 summary_header_load(CamelStoreSummary *s, FILE *in)
 {
 	CamelIMAPPStoreSummary *is = (CamelIMAPPStoreSummary *)s;
@@ -515,7 +515,7 @@ summary_header_load(CamelStoreSummary *s, FILE *in)
 	return 0;
 }
 
-static int
+static gint
 summary_header_save(CamelStoreSummary *s, FILE *out)
 {
 	CamelIMAPPStoreSummary *is = (CamelIMAPPStoreSummary *)s;
@@ -552,7 +552,7 @@ store_info_load(CamelStoreSummary *s, FILE *in)
 	return (CamelStoreInfo *)mi;
 }
 
-static int
+static gint
 store_info_save(CamelStoreSummary *s, FILE *out, CamelStoreInfo *mi)
 {
 	CamelIMAPPStoreInfo *isi = (CamelIMAPPStoreInfo *)mi;
diff --git a/camel/providers/imapp/camel-imapp-store.c b/camel/providers/imapp/camel-imapp-store.c
index 1cf195f..36cf13b 100644
--- a/camel/providers/imapp/camel-imapp-store.c
+++ b/camel/providers/imapp/camel-imapp-store.c
@@ -608,7 +608,7 @@ folders_build_rec(CamelURL *base, GPtrArray *folders, gint *ip, CamelFolderInfo
 	if (pfi)
 		plen = strlen(pname);
 
-	for(;(*ip)<(int)folders->len;) {
+	for(;(*ip)<(gint)folders->len;) {
 		CamelFolderInfo *fi;
 		struct _list_info *li;
 
@@ -770,7 +770,7 @@ imap_get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelEx
 	camel_imapp_engine_command_free(istore->driver->engine, ic);
 
 	printf("got folder list:\n");
-	for (i=0;i<(int)istore->pending_list->len;i++) {
+	for (i=0;i<(gint)istore->pending_list->len;i++) {
 		struct _list_info *linfo = istore->pending_list->pdata[i];
 
 		printf("%s (%c)\n", linfo->name, linfo->separator);
diff --git a/camel/providers/imapp/camel-imapp-stream.c b/camel/providers/imapp/camel-imapp-stream.c
index 2ba1db0..00b778e 100644
--- a/camel/providers/imapp/camel-imapp-stream.c
+++ b/camel/providers/imapp/camel-imapp-stream.c
@@ -49,7 +49,7 @@ static CamelObjectClass *parent_class = NULL;
 #define CAMEL_IMAPP_STREAM_SIZE (4096)
 #define CAMEL_IMAPP_STREAM_TOKEN (4096) /* maximum token size */
 
-static int
+static gint
 stream_fill(CamelIMAPPStream *is)
 {
 	gint left = 0;
@@ -75,11 +75,11 @@ stream_fill(CamelIMAPPStream *is)
 	return -1;
 }
 
-static ssize_t
-stream_read(CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read(CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelIMAPPStream *is = (CamelIMAPPStream *)stream;
-	ssize_t max;
+	gssize max;
 
 	if (is->literal == 0 || n == 0)
 		return 0;
@@ -102,22 +102,22 @@ stream_read(CamelStream *stream, gchar *buffer, size_t n)
 	return max;
 }
 
-static ssize_t
-stream_write(CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write(CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelIMAPPStream *is = (CamelIMAPPStream *)stream;
 
 	return camel_stream_write(is->source, buffer, n);
 }
 
-static int
+static gint
 stream_close(CamelStream *stream)
 {
 	/* nop? */
 	return 0;
 }
 
-static int
+static gint
 stream_flush(CamelStream *stream)
 {
 	/* nop? */
@@ -132,7 +132,7 @@ stream_eos(CamelStream *stream)
 	return is->literal == 0;
 }
 
-static int
+static gint
 stream_reset(CamelStream *stream)
 {
 	/* nop?  reset literal mode? */
@@ -271,7 +271,7 @@ static void setup_table(void)
 	gint i;
 	guchar *p, c;
 
-	for (i=0;i<(int)(sizeof(is_masks)/sizeof(is_masks[0]));i++) {
+	for (i=0;i<(gint)(sizeof(is_masks)/sizeof(is_masks[0]));i++) {
 		p = is_masks[i].chars;
 		while ((c = *p++))
 			imap_specials[c] |= is_masks[i].mask;
@@ -280,7 +280,7 @@ static void setup_table(void)
 
 #if 0
 
-static int
+static gint
 skip_ws(CamelIMAPPStream *is, guchar *pp, guchar *pe)
 {
 	register guchar c, *p;
diff --git a/camel/providers/imapp/camel-imapp-stream.h b/camel/providers/imapp/camel-imapp-stream.h
index 44570bd..e2895e7 100644
--- a/camel/providers/imapp/camel-imapp-stream.h
+++ b/camel/providers/imapp/camel-imapp-stream.h
@@ -70,21 +70,21 @@ camel_imapp_token_t camel_imapp_stream_token	(CamelIMAPPStream *is, guchar **sta
 void		 camel_imapp_stream_ungettoken	(CamelIMAPPStream *is, camel_imapp_token_t tok, guchar *token, guint len);
 
 void		 camel_imapp_stream_set_literal	(CamelIMAPPStream *is, guint literal);
-int		 camel_imapp_stream_gets		(CamelIMAPPStream *is, guchar **start, guint *len);
-int		 camel_imapp_stream_getl		(CamelIMAPPStream *is, guchar **start, guint *len);
+gint		 camel_imapp_stream_gets		(CamelIMAPPStream *is, guchar **start, guint *len);
+gint		 camel_imapp_stream_getl		(CamelIMAPPStream *is, guchar **start, guint *len);
 
 /* all throw IO,PARSE exceptions */
 
 /* gets an atom, upper-cases */
-int		 camel_imapp_stream_atom		(CamelIMAPPStream *is, guchar **start, guint *len);
+gint		 camel_imapp_stream_atom		(CamelIMAPPStream *is, guchar **start, guint *len);
 /* gets an atom or string */
-int		 camel_imapp_stream_astring	(CamelIMAPPStream *is, guchar **start);
+gint		 camel_imapp_stream_astring	(CamelIMAPPStream *is, guchar **start);
 /* gets a NIL or a string, start==NULL if NIL */
-int		 camel_imapp_stream_nstring	(CamelIMAPPStream *is, guchar **start);
+gint		 camel_imapp_stream_nstring	(CamelIMAPPStream *is, guchar **start);
 /* gets a NIL or string into a stream, stream==NULL if NIL */
-int		 camel_imapp_stream_nstring_stream(CamelIMAPPStream *is, CamelStream **stream);
+gint		 camel_imapp_stream_nstring_stream(CamelIMAPPStream *is, CamelStream **stream);
 /* gets 'text' */
-int		 camel_imapp_stream_text		(CamelIMAPPStream *is, guchar **text);
+gint		 camel_imapp_stream_text		(CamelIMAPPStream *is, guchar **text);
 
 /* gets a 'number' */
 guint32		 camel_imapp_stream_number(CamelIMAPPStream *is);
diff --git a/camel/providers/imapp/camel-imapp-summary.c b/camel/providers/imapp/camel-imapp-summary.c
index ab84a2d..e719144 100644
--- a/camel/providers/imapp/camel-imapp-summary.c
+++ b/camel/providers/imapp/camel-imapp-summary.c
@@ -111,7 +111,7 @@ camel_imapp_summary_new(void)
 }
 
 
-static int
+static gint
 summary_header_load(CamelFolderSummary *s, FILE *in)
 {
 	CamelIMAPPSummary *ims = CAMEL_IMAPP_SUMMARY(s);
@@ -136,7 +136,7 @@ summary_header_load(CamelFolderSummary *s, FILE *in)
 	return 0;
 }
 
-static int
+static gint
 summary_header_save(CamelFolderSummary *s, FILE *out)
 {
 	CamelIMAPPSummary *ims = CAMEL_IMAPP_SUMMARY(s);
@@ -172,7 +172,7 @@ error:
 	return NULL;
 }
 
-static int
+static gint
 message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *info)
 {
 	CamelIMAPPMessageInfo *iinfo =(CamelIMAPPMessageInfo *)info;
diff --git a/camel/providers/imapp/camel-imapp-utils.c b/camel/providers/imapp/camel-imapp-utils.c
index 2260ad3..6112575 100644
--- a/camel/providers/imapp/camel-imapp-utils.c
+++ b/camel/providers/imapp/camel-imapp-utils.c
@@ -37,7 +37,7 @@ struct _imap_keyword { gchar *name; camel_imapp_id_t id; };
 #ifdef __GNUC__
 __inline
 #endif
-static unsigned int
+static guint
 imap_hash (register const gchar *str, register guint len)
 {
   static guchar asso_values[] =
@@ -69,7 +69,7 @@ imap_hash (register const gchar *str, register guint len)
       39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
       39, 39, 39, 39, 39, 39
     };
-  return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
+  return len + asso_values[(guchar)str[len - 1]] + asso_values[(guchar)str[0]];
 }
 
 #ifdef __GNUC__
@@ -163,7 +163,7 @@ imap_parse_flags(CamelIMAPPStream *stream, guint32 *flagsp)
 				p = token;
 				while ((c=*p))
 					*p++ = toupper(c);
-				for (i=0;i<(int)(sizeof(flag_table)/sizeof(flag_table[0]));i++)
+				for (i=0;i<(gint)(sizeof(flag_table)/sizeof(flag_table[0]));i++)
 					if (!strcmp(token, flag_table[i].name))
 						flags |= flag_table[i].flag;
 			} else if (tok != ')') {
@@ -187,7 +187,7 @@ imap_write_flags(CamelStream *stream, guint32 flags)
 	if (camel_stream_write(stream, "(", 1) == -1)
 		camel_exception_throw(1, "io error: %s", g_strerror(errno));
 
-	for (i=0;flags!=0 && i<(int)(sizeof(flag_table)/sizeof(flag_table[0]));i++) {
+	for (i=0;flags!=0 && i<(gint)(sizeof(flag_table)/sizeof(flag_table[0]));i++) {
 		if (flag_table[i].flag & flags) {
 			if (camel_stream_write(stream, flag_table[i].name, strlen(flag_table[i].name)) == -1)
 				camel_exception_throw(1, "io error: %s", g_strerror(errno));
@@ -441,7 +441,7 @@ imap_parse_ext_optional(CamelIMAPPStream *is)
 			/* we have a literal string */
 			camel_imapp_stream_set_literal(is, len);
 			while ((tok = camel_imapp_stream_getl(is, &token, &len)) > 0) {
-				d(printf("Skip literal data '%.*s'\n", (int)len, token));
+				d(printf("Skip literal data '%.*s'\n", (gint)len, token));
 			}
 			break;
 
@@ -958,11 +958,11 @@ imap_dump_fetch(struct _fetch_info *finfo)
 		camel_content_info_dump(finfo->cinfo, 0);
 	}
 	if (finfo->got & FETCH_SIZE)
-		camel_stream_printf(sout, "Size: %d\n", (int)finfo->size);
+		camel_stream_printf(sout, "Size: %d\n", (gint)finfo->size);
 	if (finfo->got & FETCH_BODY)
-		camel_stream_printf(sout, "Offset: %d\n", (int)finfo->offset);
+		camel_stream_printf(sout, "Offset: %d\n", (gint)finfo->offset);
 	if (finfo->got & FETCH_FLAGS)
-		camel_stream_printf(sout, "Flags: %08x\n", (int)finfo->flags);
+		camel_stream_printf(sout, "Flags: %08x\n", (gint)finfo->flags);
 	if (finfo->date)
 		camel_stream_printf(sout, "Date: '%s'\n", finfo->date);
 	if (finfo->section)
@@ -1210,7 +1210,7 @@ imap_parse_list(CamelIMAPPStream *is)
 				p = token;
 				while ((c=*p))
 					*p++ = toupper(c);
-				for (i=0;i<(int)(sizeof(list_flag_table)/sizeof(list_flag_table[0]));i++)
+				for (i=0;i<(gint)(sizeof(list_flag_table)/sizeof(list_flag_table[0]));i++)
 					if (!strcmp(token, list_flag_table[i].name))
 						linfo->flags |= list_flag_table[i].flag;
 			} else {
diff --git a/camel/providers/local/Makefile.am b/camel/providers/local/Makefile.am
index f52ce46..8d1c4a1 100644
--- a/camel/providers/local/Makefile.am
+++ b/camel/providers/local/Makefile.am
@@ -20,7 +20,6 @@ endif
 
 INCLUDES = \
 	-I$(top_srcdir)/camel			\
-	-I$(top_srcdir)/intl			\
 	-I$(top_srcdir)				\
 	$(CAMEL_CFLAGS)				\
 	-DG_LOG_DOMAIN=\"camel-local-provider\"
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
index 4fe9328..e05a4f7 100644
--- a/camel/providers/local/camel-local-folder.c
+++ b/camel/providers/local/camel-local-folder.c
@@ -364,7 +364,7 @@ gint camel_local_folder_unlock(CamelLocalFolder *lf)
 	return 0;
 }
 
-static int
+static gint
 local_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	CamelFolder *folder = (CamelFolder *)object;
@@ -379,7 +379,8 @@ local_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 		switch (tag & CAMEL_ARG_TAG) {
 		case CAMEL_OBJECT_ARG_DESCRIPTION:
 			if (folder->description == NULL) {
-				gchar *tmp, *path;
+				const gchar *tmp;
+				gchar *path;
 
 				/* check some common prefixes to shorten the name */
 				tmp = ((CamelService *)folder->parent_store)->url->path;
@@ -434,7 +435,7 @@ local_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 	return ((CamelObjectClass *)parent_class)->getv(object, ex, args);
 }
 
-static int
+static gint
 local_setv(CamelObject *object, CamelException *ex, CamelArgV *args)
 {
 	gint i;
@@ -465,7 +466,7 @@ local_setv(CamelObject *object, CamelException *ex, CamelArgV *args)
 	return ((CamelObjectClass *)parent_class)->setv(object, ex, args);
 }
 
-static int
+static gint
 local_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex)
 {
 	return 0;
diff --git a/camel/providers/local/camel-local-provider.c b/camel/providers/local/camel-local-provider.c
index 275cd0a..b5d85e1 100644
--- a/camel/providers/local/camel-local-provider.c
+++ b/camel/providers/local/camel-local-provider.c
@@ -183,7 +183,7 @@ local_url_hash (gconstpointer v)
 	return hash;
 }
 
-static int
+static gint
 check_equal (gchar *s1, gchar *s2)
 {
 	if (s1 == NULL || *s1 == 0) {
@@ -199,7 +199,7 @@ check_equal (gchar *s1, gchar *s2)
 	return strcmp (s1, s2) == 0;
 }
 
-static int
+static gint
 local_url_equal(gconstpointer v, gconstpointer v2)
 {
 	const CamelURL *u1 = v, *u2 = v2;
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
index b6d81a8..b46d28c 100644
--- a/camel/providers/local/camel-local-summary.c
+++ b/camel/providers/local/camel-local-summary.c
@@ -149,7 +149,7 @@ camel_local_summary_construct(CamelLocalSummary *new, const gchar *filename, con
 		camel_object_ref((CamelObject *)index);
 }
 
-static int
+static gint
 local_summary_load(CamelLocalSummary *cls, gint forceindex, CamelException *ex)
 {
 	d(g_print ("\nlocal_summary_load called \n"));
@@ -400,14 +400,14 @@ camel_local_summary_write_headers(gint fd, struct _camel_header_raw *header, con
 	return outlen;
 }
 
-static int
+static gint
 local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex)
 {
 	/* FIXME: sync index here ? */
 	return 0;
 }
 
-static int
+static gint
 local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
 {
 	gint ret = 0;
@@ -424,7 +424,7 @@ local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeIn
 	return ret;
 }
 
-static int
+static gint
 local_summary_need_index(void) {
 	return 1;
 }
@@ -574,7 +574,7 @@ local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelLocalMessage
 	return ret;
 }
 
-static int
+static gint
 local_summary_decode_x_evolution(CamelLocalSummary *cls, const gchar *xev, CamelLocalMessageInfo *mi)
 {
 	struct _camel_header_param *params, *scan;
@@ -638,7 +638,7 @@ local_summary_decode_x_evolution(CamelLocalSummary *cls, const gchar *xev, Camel
 }
 
 
-static int
+static gint
 summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *fir)
 {
 	CamelLocalSummary *cls = (CamelLocalSummary *)s;
@@ -663,7 +663,7 @@ summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *fir)
 }
 
 
-static int
+static gint
 summary_header_load(CamelFolderSummary *s, FILE *in)
 {
 	CamelLocalSummary *cls = (CamelLocalSummary *)s;
@@ -678,7 +678,7 @@ summary_header_load(CamelFolderSummary *s, FILE *in)
 		return 0;
 
 	/* otherwise load the version number */
-	return camel_file_util_decode_fixed_int32(in, &cls->version);
+	return camel_file_util_decode_fixed_int32(in, (gint32 *) &cls->version);
 }
 
 static struct _CamelFIRecord *
@@ -693,7 +693,7 @@ summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
 	return fir;
 }
 
-static int
+static gint
 summary_header_save(CamelFolderSummary *s, FILE *out)
 {
 	/*CamelLocalSummary *cls = (CamelLocalSummary *)s;*/
diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c
index d3c1e7f..efab037 100644
--- a/camel/providers/local/camel-maildir-folder.c
+++ b/camel/providers/local/camel-maildir-folder.c
@@ -62,7 +62,7 @@ static void maildir_sort_uids (CamelFolder *folder, GPtrArray *uids);
 
 static void maildir_finalize(CamelObject * object);
 
-static int
+static gint
 maildir_folder_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
 {
 	CamelFolder *folder = (CamelFolder *)object;
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index b6e2bca..4921794 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -400,7 +400,7 @@ static CamelFolderInfo *scan_fi(CamelStore *store, guint32 flags, CamelURL *url,
 	return fi;
 }
 
-static int
+static gint
 scan_dirs(CamelStore *store, guint32 flags, CamelFolderInfo *topfi, CamelURL *url, CamelException *ex)
 {
 	CamelDList queue = CAMEL_DLIST_INITIALISER(queue);
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
index dc8494b..36ac124 100644
--- a/camel/providers/local/camel-maildir-summary.c
+++ b/camel/providers/local/camel-maildir-summary.c
@@ -307,7 +307,7 @@ static CamelMessageInfo *message_info_new_from_header(CamelFolderSummary * s, st
 		if (mds->priv->current_file) {
 #if 0
 			gchar *p1, *p2, *p3;
-			unsigned long uid;
+			gulong uid;
 #endif
 			/* if setting from a file, grab the flags from it */
 			camel_maildir_info_set_filename(mi, g_strdup(mds->priv->current_file));
@@ -474,7 +474,7 @@ static gint maildir_summary_load(CamelLocalSummary *cls, gint forceindex, CamelE
 	return ret;
 }
 
-static int
+static gint
 camel_maildir_summary_add (CamelLocalSummary *cls, const gchar *name, gint forceindex)
 {
 	CamelMaildirSummary *maildirs = (CamelMaildirSummary *)cls;
@@ -525,7 +525,7 @@ remove_summary(gchar *key, CamelMessageInfo *info, struct _remove_data *rd)
 	camel_message_info_free(info);
 }
 
-static int
+static gint
 maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, CamelException *ex)
 {
 	DIR *dir;
@@ -726,7 +726,7 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca
 }
 
 /* sync the summary with the ondisk files. */
-static int
+static gint
 maildir_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changes, CamelException *ex)
 {
 	gint count, i;
diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c
index 15e95ae..f47886f 100644
--- a/camel/providers/local/camel-mbox-folder.c
+++ b/camel/providers/local/camel-mbox-folder.c
@@ -447,8 +447,8 @@ retry:
 	    || camel_mime_parser_tell_start_from(parser) != frompos) {
 
 		g_warning("Summary doesn't match the folder contents!  eek!\n"
-			  "  expecting offset %ld got %ld, state = %d", (long int)frompos,
-			  (long int)camel_mime_parser_tell_start_from(parser),
+			  "  expecting offset %ld got %ld, state = %d", (glong)frompos,
+			  (glong)camel_mime_parser_tell_start_from(parser),
 			  camel_mime_parser_state(parser));
 
 		camel_object_unref((CamelObject *)parser);
diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c
index ea219fc..43ca1c2 100644
--- a/camel/providers/local/camel-mbox-store.c
+++ b/camel/providers/local/camel-mbox-store.c
@@ -100,7 +100,7 @@ camel_mbox_store_get_type(void)
 	return camel_mbox_store_type;
 }
 
-static gchar *extensions[] = {
+static const gchar *extensions[] = {
 	".msf", ".ev-summary", ".ev-summary-meta", ".ibex.index", ".ibex.index.data", ".cmeta", ".lock", ".db", ".journal"
 };
 
@@ -412,7 +412,7 @@ create_folder(CamelStore *store, const gchar *parent_name, const gchar *folder_n
 	return info;
 }
 
-static int
+static gint
 xrename(CamelStore *store, const gchar *old_name, const gchar *new_name, const gchar *ext, gboolean missingok)
 {
 	CamelLocalStore *ls = (CamelLocalStore *)store;
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index f9ed01f..5203d44 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -68,8 +68,8 @@ static gint summary_header_save (CamelFolderSummary *, FILE *);
 static CamelMessageInfo * message_info_new_from_header(CamelFolderSummary *, struct _camel_header_raw *);
 static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
 static CamelMessageInfo * message_info_load (CamelFolderSummary *, FILE *);
-static int		  message_info_save (CamelFolderSummary *, FILE *, CamelMessageInfo *);
-static int		  meta_message_info_save(CamelFolderSummary *s, FILE *out_meta, FILE *out, CamelMessageInfo *mi);
+static gint		  message_info_save (CamelFolderSummary *, FILE *, CamelMessageInfo *);
+static gint		  meta_message_info_save(CamelFolderSummary *s, FILE *out_meta, FILE *out, CamelMessageInfo *mi);
 /*static void		  message_info_free (CamelFolderSummary *, CamelMessageInfo *);*/
 
 static gchar *mbox_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelLocalMessageInfo *mi);
@@ -262,7 +262,7 @@ mbox_summary_encode_x_evolution (CamelLocalSummary *cls, const CamelLocalMessage
 	}
 }
 
-static int
+static gint
 summary_header_from_db (CamelFolderSummary *s, struct _CamelFIRecord *fir)
 {
 	CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY(s);
@@ -280,7 +280,7 @@ summary_header_from_db (CamelFolderSummary *s, struct _CamelFIRecord *fir)
 }
 
 
-static int
+static gint
 summary_header_load(CamelFolderSummary *s, FILE *in)
 {
 	CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY(s);
@@ -293,8 +293,8 @@ summary_header_load(CamelFolderSummary *s, FILE *in)
 		return camel_file_util_decode_uint32(in, (guint32 *) &mbs->folder_size);
 
 	/* version 1 */
-	if (camel_file_util_decode_fixed_int32(in, &mbs->version) == -1
-	    || camel_file_util_decode_size_t(in, &mbs->folder_size) == -1)
+	if (camel_file_util_decode_fixed_int32(in, (gint32 *) &mbs->version) == -1
+	    || camel_file_util_decode_gsize(in, &mbs->folder_size) == -1)
 		return -1;
 
 	return 0;
@@ -310,14 +310,14 @@ summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
 	fir = ((CamelFolderSummaryClass *)camel_mbox_summary_parent)->summary_header_to_db (s, ex);
 	if (fir) {
 		tmp = fir->bdata;
-		fir->bdata = g_strdup_printf ("%s %d %d", tmp ? tmp : "", CAMEL_MBOX_SUMMARY_VERSION, (int) mbs->folder_size);
+		fir->bdata = g_strdup_printf ("%s %d %d", tmp ? tmp : "", CAMEL_MBOX_SUMMARY_VERSION, (gint) mbs->folder_size);
 		g_free (tmp);
 	}
 
 	return fir;
 }
 
-static int
+static gint
 summary_header_save(CamelFolderSummary *s, FILE *out)
 {
 	CamelMboxSummary *mbs = CAMEL_MBOX_SUMMARY(s);
@@ -327,7 +327,7 @@ summary_header_save(CamelFolderSummary *s, FILE *out)
 
 	camel_file_util_encode_fixed_int32(out, CAMEL_MBOX_SUMMARY_VERSION);
 
-	return camel_file_util_encode_size_t(out, mbs->folder_size);
+	return camel_file_util_encode_gsize(out, mbs->folder_size);
 }
 
 static CamelMessageInfo *
@@ -466,7 +466,7 @@ error:
 	return NULL;
 }
 
-static int
+static gint
 meta_message_info_save(CamelFolderSummary *s, FILE *out_meta, FILE *out, CamelMessageInfo *mi)
 {
 	CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
@@ -493,7 +493,7 @@ message_info_to_db(CamelFolderSummary *s, CamelMessageInfo *info)
 }
 
 
-static int
+static gint
 message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
 {
 	CamelMboxMessageInfo *mbi = (CamelMboxMessageInfo *)mi;
@@ -508,7 +508,7 @@ message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
 }
 
 /* like summary_rebuild, but also do changeinfo stuff (if supplied) */
-static int
+static gint
 summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *changeinfo, CamelException *ex)
 {
 	gint i, count;
@@ -522,7 +522,7 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
 	off_t size = 0;
 	GSList *del = NULL;
 
-	d(printf("Calling summary update, from pos %d\n", (int)offset));
+	d(printf("Calling summary update, from pos %d\n", (gint)offset));
 
 	cls->index_force = FALSE;
 
@@ -578,7 +578,7 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
 		CamelMessageInfo *info;
 		off_t pc = camel_mime_parser_tell_start_from (mp) + 1;
 
-		camel_operation_progress (NULL, (int) (((float) pc / size) * 100));
+		camel_operation_progress (NULL, (gint) (((gfloat) pc / size) * 100));
 
 		info = camel_folder_summary_add_from_parser(s, mp);
 		if (info == NULL) {
@@ -630,7 +630,7 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
 	return ok;
 }
 
-static int
+static gint
 mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, CamelException *ex)
 {
 	CamelMboxSummary *mbs = (CamelMboxSummary *)cls;
@@ -698,7 +698,7 @@ mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Camel
 }
 
 /* perform a full sync */
-static int
+static gint
 mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
 {
 	CamelLocalSummary *cls = (CamelLocalSummary *)mbs;
@@ -811,7 +811,7 @@ cms_sort_frompos (gpointer a, gpointer b, gpointer data)
 }
 
 /* perform a quick sync - only system flags have changed */
-static int
+static gint
 mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
 {
 	CamelLocalSummary *cls = (CamelLocalSummary *)mbs;
@@ -876,7 +876,7 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
 			continue;
 		}
 
-		d(printf("Updating message %s: %d\n", camel_message_info_uid(info), (int)info->frompos));
+		d(printf("Updating message %s: %d\n", camel_message_info_uid(info), (gint)info->frompos));
 
 		camel_mime_parser_seek(mp, info->frompos, SEEK_SET);
 
@@ -889,7 +889,7 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
 
 		if (camel_mime_parser_tell_start_from(mp) != info->frompos) {
 			g_warning("Didn't get the next message where I expected (%d) got %d instead",
-				  (int)info->frompos, (int)camel_mime_parser_tell_start_from(mp));
+				  (gint)info->frompos, (gint)camel_mime_parser_tell_start_from(mp));
 			camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
 					     _("Summary and folder mismatch, even after a sync"));
 			goto error;
@@ -970,7 +970,7 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
 	return -1;
 }
 
-static int
+static gint
 mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
 {
 	struct stat st;
@@ -1057,7 +1057,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 	gint i, count;
 	CamelMboxMessageInfo *info = NULL;
 	gchar *buffer, *xevnew = NULL;
-	size_t len;
+	gsize len;
 	const gchar *fromline;
 	gint lastdel = FALSE;
 	gboolean touched = FALSE;
@@ -1095,12 +1095,12 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 
 		d(printf("Looking at message %s\n", camel_message_info_uid(info)));
 
-		d(printf("seeking (%s) to %d\n", ((CamelMessageInfo *) info)->uid, (int)info->frompos));
+		d(printf("seeking (%s) to %d\n", ((CamelMessageInfo *) info)->uid, (gint)info->frompos));
 		if (lastdel)
 			camel_mime_parser_seek(mp, info->frompos, SEEK_SET);
 
 		if (camel_mime_parser_step(mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_FROM) {
-			g_warning("Expected a From line here, didn't get it %d", (int)camel_mime_parser_tell(mp));
+			g_warning("Expected a From line here, didn't get it %d", (gint)camel_mime_parser_tell(mp));
 			camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
 					     _("Summary and folder mismatch, even after a sync"));
 			goto error;
@@ -1108,7 +1108,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 
 		if (camel_mime_parser_tell_start_from(mp) != info->frompos) {
 			g_warning("Didn't get the next message where I expected (%d) got %d instead",
-				  (int)info->frompos, (int)camel_mime_parser_tell_start_from(mp));
+				  (gint)info->frompos, (gint)camel_mime_parser_tell_start_from(mp));
 			camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
 					     _("Summary and folder mismatch, even after a sync"));
 			goto error;
@@ -1190,7 +1190,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 
 		camel_mime_parser_drop_step(mp);
 		if (info) {
-			d(printf("looking for message content to copy across from %d\n", (int)camel_mime_parser_tell(mp)));
+			d(printf("looking for message content to copy across from %d\n", (gint)camel_mime_parser_tell(mp)));
 			while (camel_mime_parser_step(mp, &buffer, &len) == CAMEL_MIME_PARSER_STATE_PRE_FROM) {
 				/*d(printf("copying mbox contents to temporary: '%.*s'\n", len, buffer));*/
 				if (write(fdout, buffer, len) != len) {
@@ -1209,8 +1209,8 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
 				goto error;
 			}
 
-			d(printf("we are now at %d, from = %d\n", (int)camel_mime_parser_tell(mp),
-				 (int)camel_mime_parser_tell_start_from(mp)));
+			d(printf("we are now at %d, from = %d\n", (gint)camel_mime_parser_tell(mp),
+				 (gint)camel_mime_parser_tell_start_from(mp)));
 			camel_mime_parser_unstep(mp);
 			camel_message_info_free((CamelMessageInfo *)info);
 			info = NULL;
@@ -1291,7 +1291,7 @@ static struct {
 static void
 encode_status(guint32 flags, gchar status[8])
 {
-	size_t i;
+	gsize i;
 	gchar *p;
 
 	p = status;
@@ -1307,7 +1307,7 @@ decode_status(const gchar *status)
 {
 	const gchar *p;
 	guint32 flags = 0;
-	size_t i;
+	gsize i;
 	gchar c;
 
 	p = status;
diff --git a/camel/providers/local/camel-mbox-summary.h b/camel/providers/local/camel-mbox-summary.h
index 1e5644f..2fca130 100644
--- a/camel/providers/local/camel-mbox-summary.h
+++ b/camel/providers/local/camel-mbox-summary.h
@@ -51,7 +51,7 @@ struct _CamelMboxSummary {
 	CamelFolderChangeInfo *changes;	/* used to build change sets */
 
 	guint32 version;
-	size_t folder_size;	/* size of the mbox file, last sync */
+	gsize folder_size;	/* size of the mbox file, last sync */
 
 	guint xstatus:1;	/* do we store/honour xstatus/status headers */
 };
diff --git a/camel/providers/local/camel-mh-summary.c b/camel/providers/local/camel-mh-summary.c
index 55bed7e..1595e3e 100644
--- a/camel/providers/local/camel-mh-summary.c
+++ b/camel/providers/local/camel-mh-summary.c
@@ -217,7 +217,7 @@ remove_summary(gchar *key, CamelMessageInfo *info, CamelLocalSummary *cls)
 }
 
 
-static int
+static gint
 mh_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex)
 {
 	DIR *dir;
@@ -295,7 +295,7 @@ mh_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, Came
 }
 
 /* sync the summary file with the ondisk files */
-static int
+static gint
 mh_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changes, CamelException *ex)
 {
 	gint count, i;
diff --git a/camel/providers/local/camel-spool-folder.c b/camel/providers/local/camel-spool-folder.c
index 18b9867..0c28410 100644
--- a/camel/providers/local/camel-spool-folder.c
+++ b/camel/providers/local/camel-spool-folder.c
@@ -137,7 +137,7 @@ spool_create_summary(CamelLocalFolder *lf, const gchar *path, const gchar *folde
 	return (CamelLocalSummary *)camel_spool_summary_new((CamelFolder *)lf, folder);
 }
 
-static int
+static gint
 spool_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex)
 {
 	gint retry = 0;
diff --git a/camel/providers/local/camel-spool-store.c b/camel/providers/local/camel-spool-store.c
index 3d3cb05..e94be9a 100644
--- a/camel/providers/local/camel-spool-store.c
+++ b/camel/providers/local/camel-spool-store.c
@@ -64,7 +64,6 @@ static CamelFolderInfo *get_folder_info (CamelStore *store, const gchar *top, gu
 static void free_folder_info (CamelStore *store, CamelFolderInfo *fi);
 
 static void delete_folder(CamelStore *store, const gchar *folder_name, CamelException *ex);
-static void rename_folder(CamelStore *store, const gchar *old, const gchar *new, CamelException *ex);
 
 static gchar *spool_get_meta_path(CamelLocalStore *ls, const gchar *full_name, const gchar *ext);
 static gchar *spool_get_full_path(CamelLocalStore *ls, const gchar *full_name);
diff --git a/camel/providers/local/camel-spool-summary.c b/camel/providers/local/camel-spool-summary.c
index 7e41ca7..27fb89d 100644
--- a/camel/providers/local/camel-spool-summary.c
+++ b/camel/providers/local/camel-spool-summary.c
@@ -126,7 +126,7 @@ camel_spool_summary_new(struct _CamelFolder *folder, const gchar *mbox_name)
 	return new;
 }
 
-static int
+static gint
 spool_summary_load(CamelLocalSummary *cls, gint forceindex, CamelException *ex)
 {
 	g_warning("spool summary - not loading anything\n");
@@ -134,7 +134,7 @@ spool_summary_load(CamelLocalSummary *cls, gint forceindex, CamelException *ex)
 }
 
 /* perform a full sync */
-static int
+static gint
 spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex)
 {
 	gint fd = -1, fdout = -1;
@@ -305,7 +305,7 @@ spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChan
 	return -1;
 }
 
-static int
+static gint
 spool_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex)
 {
 	gint i, work, count;
@@ -345,7 +345,7 @@ spool_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, C
 	return 0;
 }
 
-static int
+static gint
 spool_summary_need_index(void) {
 	return 0;
 }
diff --git a/camel/providers/nntp/Makefile.am b/camel/providers/nntp/Makefile.am
index edabbdb..b09bb38 100644
--- a/camel/providers/nntp/Makefile.am
+++ b/camel/providers/nntp/Makefile.am
@@ -6,8 +6,6 @@ camel_provider_DATA = libcamelnntp.urls
 INCLUDES = -I../..				\
 	-I$(top_srcdir)				\
 	-I$(top_srcdir)/camel			\
-	-I$(top_srcdir)/intl			\
-	-I$(top_srcdir)/e-util			\
 	-I$(top_srcdir)				\
 	$(CAMEL_CFLAGS)				\
 	$(GNOME_INCLUDEDIR)			\
diff --git a/camel/providers/nntp/camel-nntp-grouplist.c b/camel/providers/nntp/camel-nntp-grouplist.c
index 7e4eccb..b4bf26e 100644
--- a/camel/providers/nntp/camel-nntp-grouplist.c
+++ b/camel/providers/nntp/camel-nntp-grouplist.c
@@ -93,7 +93,7 @@ camel_nntp_get_grouplist_from_file (CamelNNTPStore *store, CamelException *ex)
 	CamelNNTPGroupList *list;
 	FILE *fp;
 	gchar buf[300];
-	unsigned long time;
+	gulong time;
 
 	g_free (root_dir);
 	fp = g_fopen (grouplist_file, "r");
@@ -167,7 +167,7 @@ camel_nntp_grouplist_save (CamelNNTPGroupList *group_list, CamelException *ex)
 		return;
 	}
 
-	fprintf (fp, "%lu\n", (long)group_list->time);
+	fprintf (fp, "%lu\n", (glong)group_list->time);
 
 	g_list_foreach (group_list->group_list, (GFunc)save_entry, fp);
 
diff --git a/camel/providers/nntp/camel-nntp-newsrc.c b/camel/providers/nntp/camel-nntp-newsrc.c
index 52e7e5c..72d28a6 100644
--- a/camel/providers/nntp/camel-nntp-newsrc.c
+++ b/camel/providers/nntp/camel-nntp-newsrc.c
@@ -77,7 +77,7 @@ camel_nntp_newsrc_group_add (CamelNNTPNewsrc *newsrc, const gchar *group_name, g
 	return new_group;
 }
 
-static int
+static gint
 camel_nntp_newsrc_group_get_highest_article_read(CamelNNTPNewsrc *newsrc, NewsrcGroup *group)
 {
 	if (!group || group->ranges->len == 0)
@@ -86,7 +86,7 @@ camel_nntp_newsrc_group_get_highest_article_read(CamelNNTPNewsrc *newsrc, Newsrc
 	return g_array_index(group->ranges, ArticleRange, group->ranges->len - 1).high;
 }
 
-static int
+static gint
 camel_nntp_newsrc_group_get_num_articles_read(CamelNNTPNewsrc *newsrc, NewsrcGroup *group)
 {
 	gint i;
@@ -104,7 +104,7 @@ camel_nntp_newsrc_group_get_num_articles_read(CamelNNTPNewsrc *newsrc, NewsrcGro
 
 
 static void
-camel_nntp_newsrc_group_mark_range_read(CamelNNTPNewsrc *newsrc, NewsrcGroup *group, long low, long high)
+camel_nntp_newsrc_group_mark_range_read(CamelNNTPNewsrc *newsrc, NewsrcGroup *group, glong low, glong high)
 {
 	gint i;
 
@@ -235,13 +235,13 @@ camel_nntp_newsrc_mark_article_read (CamelNNTPNewsrc *newsrc, const gchar *group
 }
 
 void
-camel_nntp_newsrc_mark_range_read(CamelNNTPNewsrc *newsrc, const gchar *group_name, long low, long high)
+camel_nntp_newsrc_mark_range_read(CamelNNTPNewsrc *newsrc, const gchar *group_name, glong low, glong high)
 {
 	NewsrcGroup *group;
 
 	/* swap them if they're in the wrong order. */
 	if (low > high) {
-		long tmp;
+		glong tmp;
 
 		tmp = high;
 		high = low;
@@ -257,7 +257,7 @@ camel_nntp_newsrc_mark_range_read(CamelNNTPNewsrc *newsrc, const gchar *group_na
 }
 
 gboolean
-camel_nntp_newsrc_article_is_read (CamelNNTPNewsrc *newsrc, const gchar *group_name, long num)
+camel_nntp_newsrc_article_is_read (CamelNNTPNewsrc *newsrc, const gchar *group_name, glong num)
 {
 	gint i;
 	NewsrcGroup *group;
diff --git a/camel/providers/nntp/camel-nntp-newsrc.h b/camel/providers/nntp/camel-nntp-newsrc.h
index fd6507a..3160b7f 100644
--- a/camel/providers/nntp/camel-nntp-newsrc.h
+++ b/camel/providers/nntp/camel-nntp-newsrc.h
@@ -14,10 +14,10 @@ gint              camel_nntp_newsrc_get_num_articles_read      (CamelNNTPNewsrc
 void             camel_nntp_newsrc_mark_article_read          (CamelNNTPNewsrc *newsrc,
 							       const gchar *group_name, gint num);
 void             camel_nntp_newsrc_mark_range_read            (CamelNNTPNewsrc *newsrc,
-							       const gchar *group_name, long low, long high);
+							       const gchar *group_name, glong low, glong high);
 
 gboolean         camel_nntp_newsrc_article_is_read            (CamelNNTPNewsrc *newsrc,
-							       const gchar *group_name, long num);
+							       const gchar *group_name, glong num);
 
 gboolean         camel_nntp_newsrc_group_is_subscribed        (CamelNNTPNewsrc *newsrc, const gchar *group_name);
 void             camel_nntp_newsrc_subscribe_group            (CamelNNTPNewsrc *newsrc, const gchar *group_name);
diff --git a/camel/providers/nntp/camel-nntp-store-summary.c b/camel/providers/nntp/camel-nntp-store-summary.c
index d1df63d..dd72d28 100644
--- a/camel/providers/nntp/camel-nntp-store-summary.c
+++ b/camel/providers/nntp/camel-nntp-store-summary.c
@@ -50,10 +50,10 @@ static gint summary_header_save(CamelStoreSummary *, FILE *);
 
 /*static CamelStoreInfo * store_info_new(CamelStoreSummary *, const gchar *);*/
 static CamelStoreInfo * store_info_load(CamelStoreSummary *, FILE *);
-static int		 store_info_save(CamelStoreSummary *, FILE *, CamelStoreInfo *);
+static gint		 store_info_save(CamelStoreSummary *, FILE *, CamelStoreInfo *);
 static void		 store_info_free(CamelStoreSummary *, CamelStoreInfo *);
 
-static const gchar *store_info_string(CamelStoreSummary *, const CamelStoreInfo *, int);
+static const gchar *store_info_string(CamelStoreSummary *, const CamelStoreInfo *, gint);
 static void store_info_set_string(CamelStoreSummary *, CamelStoreInfo *, int, const gchar *);
 
 static void camel_nntp_store_summary_class_init (CamelNNTPStoreSummaryClass *klass);
@@ -302,13 +302,14 @@ camel_nntp_store_summary_add_from_full (CamelNNTPStoreSummary *s, const gchar *f
 	if (info) {
 		d(printf("  '%s' -> '%s'\n", pathu8, full_name));
 		camel_store_info_set_string((CamelStoreSummary *)s, (CamelStoreInfo *)info, CAMEL_NNTP_STORE_INFO_FULL_NAME, full_name);
-	} else
+	} else {
 		d(printf("  failed\n"));
+	}
 
 	return info;
 }
 
-static int
+static gint
 summary_header_load (CamelStoreSummary *s, FILE *in)
 {
 	CamelNNTPStoreSummary *is = (CamelNNTPStoreSummary *) s;
@@ -333,7 +334,7 @@ summary_header_load (CamelStoreSummary *s, FILE *in)
 	return 0;
 }
 
-static int
+static gint
 summary_header_save (CamelStoreSummary *s, FILE *out)
 {
 	CamelNNTPStoreSummary *is = (CamelNNTPStoreSummary *) s;
@@ -372,7 +373,7 @@ store_info_load (CamelStoreSummary *s, FILE *in)
 	return (CamelStoreInfo *) ni;
 }
 
-static int
+static gint
 store_info_save (CamelStoreSummary *s, FILE *out, CamelStoreInfo *mi)
 {
 	CamelNNTPStoreInfo *isi = (CamelNNTPStoreInfo *)mi;
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index 1ed56d8..505b426 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -95,7 +95,7 @@ static struct {
 	{ "bytes", 2 },
 };
 
-static int
+static gint
 xover_setup(CamelNNTPStore *store, CamelException *ex)
 {
 	gint ret, i;
@@ -266,9 +266,9 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 }
 
 static struct {
-	gchar *value;
-	gchar *serv;
-	gchar *port;
+	const gchar *value;
+	const gchar *serv;
+	const gchar *port;
 	gint mode;
 } ssl_options[] = {
 	{ "",              "nntps", NNTPS_PORT, MODE_SSL   },  /* really old (1.x) */
@@ -292,11 +292,11 @@ nntp_connect_online (CamelService *service, CamelException *ex)
 			if (!strcmp (ssl_options[i].value, ssl_mode))
 				break;
 		mode = ssl_options[i].mode;
-		serv = ssl_options[i].serv;
+		serv = (gchar *) ssl_options[i].serv;
 		port = ssl_options[i].port;
 	} else {
 		mode = MODE_CLEAR;
-		serv = "nntp";
+		serv = (gchar *) "nntp";
 		port = NNTP_PORT;
 	}
 
@@ -1112,8 +1112,7 @@ nntp_construct (CamelService *service, CamelSession *session,
 	g_free (tmp);
 
 	camel_url_free (summary_url);
-	if (camel_store_summary_load ((CamelStoreSummary *)nntp_store->summary) == 0)
-		;
+	camel_store_summary_load ((CamelStoreSummary *)nntp_store->summary);
 
 	/* get options */
 	if (camel_url_get_param (url, "show_short_notation"))
@@ -1169,7 +1168,7 @@ camel_nntp_store_get_type (void)
 	return camel_nntp_store_type;
 }
 
-static int
+static gint
 camel_nntp_try_authenticate (CamelNNTPStore *store, CamelException *ex)
 {
 	CamelService *service = (CamelService *) store;
@@ -1262,11 +1261,11 @@ camel_nntp_raw_commandv (CamelNNTPStore *store, CamelException *ex, gchar **line
 				camel_stream_write((CamelStream *)store->mem, s, strlen(s));
 				break;
 			case 'd':
-				d = va_arg(ap, int);
+				d = va_arg(ap, gint);
 				camel_stream_printf((CamelStream *)store->mem, "%d", d);
 				break;
 			case 'u':
-				u = va_arg(ap, unsigned int);
+				u = va_arg(ap, guint);
 				camel_stream_printf((CamelStream *)store->mem, "%u", u);
 				break;
 			case 'm':
@@ -1274,8 +1273,8 @@ camel_nntp_raw_commandv (CamelNNTPStore *store, CamelException *ex, gchar **line
 				camel_stream_printf((CamelStream *)store->mem, "<%s>", s);
 				break;
 			case 'r':
-				u = va_arg(ap, unsigned int);
-				u2 = va_arg(ap, unsigned int);
+				u = va_arg(ap, guint);
+				u2 = va_arg(ap, guint);
 				if (u == u2)
 					camel_stream_printf((CamelStream *)store->mem, "%u", u);
 				else
@@ -1289,7 +1288,7 @@ camel_nntp_raw_commandv (CamelNNTPStore *store, CamelException *ex, gchar **line
 	}
 
 	camel_stream_write ((CamelStream *) store->mem, (const gchar *) ps, p-ps-1);
-	dd(printf("NNTP_COMMAND: '%.*s'\n", (int)store->mem->buffer->len, store->mem->buffer->data));
+	dd(printf("NNTP_COMMAND: '%.*s'\n", (gint)store->mem->buffer->len, store->mem->buffer->data));
 	camel_stream_write ((CamelStream *) store->mem, "\r\n", 2);
 
 	if (camel_stream_write((CamelStream *) store->stream, (const gchar *) store->mem->buffer->data, store->mem->buffer->len) == -1)
diff --git a/camel/providers/nntp/camel-nntp-stream.c b/camel/providers/nntp/camel-nntp-stream.c
index 541d82a..f6d2d22 100644
--- a/camel/providers/nntp/camel-nntp-stream.c
+++ b/camel/providers/nntp/camel-nntp-stream.c
@@ -48,7 +48,7 @@ static CamelObjectClass *parent_class = NULL;
 #define CAMEL_NNTP_STREAM_SIZE (4096)
 #define CAMEL_NNTP_STREAM_LINE_SIZE (1024) /* maximum line size */
 
-static int
+static gint
 stream_fill(CamelNNTPStream *is)
 {
 	gint left = 0;
@@ -74,8 +74,8 @@ stream_fill(CamelNNTPStream *is)
 	return 0;
 }
 
-static ssize_t
-stream_read(CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read(CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelNNTPStream *is = (CamelNNTPStream *)stream;
 	gchar *o, *oe;
@@ -108,7 +108,7 @@ stream_read(CamelStream *stream, gchar *buffer, size_t n)
 				is->ptr = p+3;
 				is->mode = CAMEL_NNTP_STREAM_EOD;
 				is->state = 0;
-				dd(printf("NNTP_STREAM_READ(%d):\n%.*s\n", (int)(o-buffer), (int)(o-buffer), buffer));
+				dd(printf("NNTP_STREAM_READ(%d):\n%.*s\n", (gint)(o-buffer), (gint)(o-buffer), buffer));
 				return o-buffer;
 			}
 			p++;
@@ -141,27 +141,27 @@ stream_read(CamelStream *stream, gchar *buffer, size_t n)
 	is->ptr = p;
 	is->state = state;
 
-	dd(printf("NNTP_STREAM_READ(%d):\n%.*s\n", (int)(o-buffer), (int)(o-buffer), buffer));
+	dd(printf("NNTP_STREAM_READ(%d):\n%.*s\n", (gint)(o-buffer), (gint)(o-buffer), buffer));
 
 	return o-buffer;
 }
 
-static ssize_t
-stream_write(CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write(CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelNNTPStream *is = (CamelNNTPStream *)stream;
 
 	return camel_stream_write(is->source, buffer, n);
 }
 
-static int
+static gint
 stream_close(CamelStream *stream)
 {
 	/* nop? */
 	return 0;
 }
 
-static int
+static gint
 stream_flush(CamelStream *stream)
 {
 	/* nop? */
@@ -176,7 +176,7 @@ stream_eos(CamelStream *stream)
 	return is->mode != CAMEL_NNTP_STREAM_DATA;
 }
 
-static int
+static gint
 stream_reset(CamelStream *stream)
 {
 	/* nop?  reset literal mode? */
@@ -370,7 +370,7 @@ gint camel_nntp_stream_gets(CamelNNTPStream *is, guchar **start, guint *len)
 	*len = max;
 	is->ptr += max;
 
-	dd(printf("NNTP_STREAM_GETS(%s,%d): '%.*s'\n", end==NULL?"more":"last", *len, (int)*len, *start));
+	dd(printf("NNTP_STREAM_GETS(%s,%d): '%.*s'\n", end==NULL?"more":"last", *len, (gint)*len, *start));
 
 	return end == NULL?1:0;
 }
@@ -422,7 +422,7 @@ gint camel_nntp_stream_getd(CamelNNTPStream *is, guchar **start, guint *len)
 					is->mode = CAMEL_NNTP_STREAM_EOD;
 					is->state = 0;
 
-					dd(printf("NNTP_STREAM_GETD(%s,%d): '%.*s'\n", "last", *len, (int)*len, *start));
+					dd(printf("NNTP_STREAM_GETD(%s,%d): '%.*s'\n", "last", *len, (gint)*len, *start));
 
 					return 0;
 				}
@@ -437,7 +437,7 @@ gint camel_nntp_stream_getd(CamelNNTPStream *is, guchar **start, guint *len)
 					*start = s;
 					is->state = 1;
 
-					dd(printf("NNTP_STREAM_GETD(%s,%d): '%.*s'\n", "more", *len, (int)*len, *start));
+					dd(printf("NNTP_STREAM_GETD(%s,%d): '%.*s'\n", "more", *len, (gint)*len, *start));
 
 					return 1;
 				}
@@ -462,7 +462,7 @@ gint camel_nntp_stream_getd(CamelNNTPStream *is, guchar **start, guint *len)
 	*len = p-s;
 	*start = s;
 
-	dd(printf("NNTP_STREAM_GETD(%s,%d): '%.*s'\n", "more", *len, (int)*len, *start));
+	dd(printf("NNTP_STREAM_GETD(%s,%d): '%.*s'\n", "more", *len, (gint)*len, *start));
 	return 1;
 }
 
diff --git a/camel/providers/nntp/camel-nntp-stream.h b/camel/providers/nntp/camel-nntp-stream.h
index b024bfb..37a5a19 100644
--- a/camel/providers/nntp/camel-nntp-stream.h
+++ b/camel/providers/nntp/camel-nntp-stream.h
@@ -62,8 +62,8 @@ CamelStream     *camel_nntp_stream_new		(CamelStream *source);
 void		 camel_nntp_stream_set_mode     (CamelNNTPStream *is, camel_nntp_stream_mode_t mode);
 
 gint              camel_nntp_stream_line		(CamelNNTPStream *is, guchar **data, guint *len);
-int		 camel_nntp_stream_gets		(CamelNNTPStream *is, guchar **start, guint *len);
-int		 camel_nntp_stream_getd		(CamelNNTPStream *is, guchar **start, guint *len);
+gint		 camel_nntp_stream_gets		(CamelNNTPStream *is, guchar **start, guint *len);
+gint		 camel_nntp_stream_getd		(CamelNNTPStream *is, guchar **start, guint *len);
 
 G_END_DECLS
 
diff --git a/camel/providers/nntp/camel-nntp-summary.c b/camel/providers/nntp/camel-nntp-summary.c
index 7ee1ef3..71fc958 100644
--- a/camel/providers/nntp/camel-nntp-summary.c
+++ b/camel/providers/nntp/camel-nntp-summary.c
@@ -166,7 +166,7 @@ message_info_new_from_header(CamelFolderSummary *s, struct _camel_header_raw *h)
 	return (CamelMessageInfo *)mi;
 }
 
-static int
+static gint
 summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
 {
 	CamelNNTPSummary *cns = CAMEL_NNTP_SUMMARY(s);
@@ -193,7 +193,7 @@ summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
 	return 0;
 }
 
-static int
+static gint
 summary_header_load(CamelFolderSummary *s, FILE *in)
 {
 	CamelNNTPSummary *cns = CAMEL_NNTP_SUMMARY(s);
@@ -203,11 +203,11 @@ summary_header_load(CamelFolderSummary *s, FILE *in)
 
 	/* Legacy version */
 	if (s->version == 0x20c) {
-		camel_file_util_decode_fixed_int32(in, &cns->high);
-		return camel_file_util_decode_fixed_int32(in, &cns->low);
+		camel_file_util_decode_fixed_int32(in, (gint32 *) &cns->high);
+		return camel_file_util_decode_fixed_int32(in, (gint32 *) &cns->low);
 	}
 
-	if (camel_file_util_decode_fixed_int32(in, &cns->version) == -1)
+	if (camel_file_util_decode_fixed_int32(in, (gint32 *) &cns->version) == -1)
 		return -1;
 
 	if (cns->version > CAMEL_NNTP_SUMMARY_VERSION) {
@@ -216,8 +216,8 @@ summary_header_load(CamelFolderSummary *s, FILE *in)
 		return -1;
 	}
 
-	if (camel_file_util_decode_fixed_int32(in, &cns->high) == -1
-	    || camel_file_util_decode_fixed_int32(in, &cns->low) == -1)
+	if (camel_file_util_decode_fixed_int32(in, (gint32 *) &cns->high) == -1
+	    || camel_file_util_decode_fixed_int32(in, (gint32 *) &cns->low) == -1)
 		return -1;
 
 	return 0;
@@ -238,7 +238,7 @@ summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
 	return fir;
 }
 
-static int
+static gint
 summary_header_save(CamelFolderSummary *s, FILE *out)
 {
 	CamelNNTPSummary *cns = CAMEL_NNTP_SUMMARY(s);
@@ -255,14 +255,15 @@ summary_header_save(CamelFolderSummary *s, FILE *out)
 /* ********************************************************************** */
 
 /* Note: This will be called from camel_nntp_command, so only use camel_nntp_raw_command */
-static int
+static gint
 add_range_xover(CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint low, CamelFolderChangeInfo *changes, CamelException *ex)
 {
 	CamelFolderSummary *s;
 	CamelMessageInfoBase *mi;
 	struct _camel_header_raw *headers = NULL;
 	gchar *line, *tab;
-	gint len, ret;
+	guint len;
+	gint ret;
 	guint n, count, total, size;
 	struct _xover_header *xover;
 
@@ -347,7 +348,7 @@ add_range_xover(CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint
 }
 
 /* Note: This will be called from camel_nntp_command, so only use camel_nntp_raw_command */
-static int
+static gint
 add_range_head(CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint low, CamelFolderChangeInfo *changes, CamelException *ex)
 {
 	CamelFolderSummary *s;
diff --git a/camel/providers/nntp/camel-nntp-utils.c b/camel/providers/nntp/camel-nntp-utils.c
index 0e5623c..ef7e0ba 100644
--- a/camel/providers/nntp/camel-nntp-utils.c
+++ b/camel/providers/nntp/camel-nntp-utils.c
@@ -226,7 +226,7 @@ get_HEAD_headers(CamelNNTPStore *nntp_store, CamelFolder *folder,
 }
 #endif
 
-static inline int
+static inline gint
 uid_num (CamelFolderSummary *summary, gint index)
 {
 	gchar *tmp;
diff --git a/camel/providers/pop3/Makefile.am b/camel/providers/pop3/Makefile.am
index fe8bc33..bf56e2c 100644
--- a/camel/providers/pop3/Makefile.am
+++ b/camel/providers/pop3/Makefile.am
@@ -5,7 +5,6 @@ camel_provider_DATA = libcamelpop3.urls
 
 INCLUDES =					\
 	-I$(top_srcdir)				\
-	-I$(top_srcdir)/intl			\
 	-I$(top_srcdir)/camel			\
 	$(CAMEL_CFLAGS)				\
 	-DG_LOG_DOMAIN=\"camel-pop3-provider\"
diff --git a/camel/providers/pop3/camel-pop3-engine.c b/camel/providers/pop3/camel-pop3-engine.c
index 4885876..f47fdbc 100644
--- a/camel/providers/pop3/camel-pop3-engine.c
+++ b/camel/providers/pop3/camel-pop3-engine.c
@@ -40,6 +40,8 @@
    for the server to accept our data when pipelining */
 #define CAMEL_POP3_SEND_LIMIT (1024)
 
+extern CamelServiceAuthType camel_pop3_password_authtype;
+extern CamelServiceAuthType camel_pop3_apop_authtype;
 
 extern gint camel_verbose_debug;
 #define dd(x) (camel_verbose_debug?(x):0)
@@ -98,11 +100,9 @@ camel_pop3_engine_get_type (void)
 	return camel_pop3_engine_type;
 }
 
-static int
+static gint
 read_greeting (CamelPOP3Engine *pe)
 {
-	extern CamelServiceAuthType camel_pop3_password_authtype;
-	extern CamelServiceAuthType camel_pop3_apop_authtype;
 	guchar *line, *apop, *apopend;
 	guint len;
 
@@ -174,7 +174,7 @@ camel_pop3_engine_reget_capabilities (CamelPOP3Engine *engine)
 /* TODO: read implementation too?
    etc? */
 static struct {
-	gchar *cap;
+	const gchar *cap;
 	guint32 flag;
 } capa[] = {
 	{ "APOP" , CAMEL_POP3_CAP_APOP },
@@ -250,7 +250,7 @@ get_capabilities(CamelPOP3Engine *pe)
 }
 
 /* returns true if the command was sent, false if it was just queued */
-static int
+static gint
 engine_command_queue(CamelPOP3Engine *pe, CamelPOP3Command *pc)
 {
 	if (((pe->capa & CAMEL_POP3_CAP_PIPE) == 0 || (pe->sentlen + strlen(pc->data)) > CAMEL_POP3_SEND_LIMIT)
diff --git a/camel/providers/pop3/camel-pop3-engine.h b/camel/providers/pop3/camel-pop3-engine.h
index d7df9f4..6377b75 100644
--- a/camel/providers/pop3/camel-pop3-engine.h
+++ b/camel/providers/pop3/camel-pop3-engine.h
@@ -129,7 +129,7 @@ void              camel_pop3_engine_reget_capabilities (CamelPOP3Engine *engine)
 
 void              camel_pop3_engine_command_free(CamelPOP3Engine *pe, CamelPOP3Command *pc);
 
-int		  camel_pop3_engine_iterate	(CamelPOP3Engine *pe, CamelPOP3Command *pc);
+gint		  camel_pop3_engine_iterate	(CamelPOP3Engine *pe, CamelPOP3Command *pc);
 
 CamelPOP3Command *camel_pop3_engine_command_new	(CamelPOP3Engine *pe, guint32 flags, CamelPOP3CommandFunc func, gpointer data, const gchar *fmt, ...);
 
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index ded30b9..6b6b129 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -423,7 +423,7 @@ camel_pop3_delete_old(CamelFolder *folder, gint days_to_delete,	CamelException *
 
 		d(printf("%s(%d): fi->uid=[%s]\n", __FILE__, __LINE__, fi->uid));
 		if (pop3_get_message_time_from_cache (folder, fi->uid, &message_time)) {
-			double time_diff = difftime(temp,message_time);
+			gdouble time_diff = difftime(temp,message_time);
 			gint day_lag = time_diff/(60*60*24);
 
 			d(printf("%s(%d): message_time= [%ld]\n", __FILE__, __LINE__, message_time));
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index b4efac5..0b8bfb2 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -283,9 +283,9 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 }
 
 static struct {
-	gchar *value;
-	gchar *serv;
-	gchar *port;
+	const gchar *value;
+	const gchar *serv;
+	const gchar *port;
 	gint mode;
 } ssl_options[] = {
 	{ "",              "pop3s", POP3S_PORT, MODE_SSL   },  /* really old (1.x) */
@@ -309,11 +309,11 @@ connect_to_server_wrapper (CamelService *service, CamelException *ex)
 			if (!strcmp (ssl_options[i].value, ssl_mode))
 				break;
 		mode = ssl_options[i].mode;
-		serv = ssl_options[i].serv;
+		serv = (gchar *) ssl_options[i].serv;
 		port = ssl_options[i].port;
 	} else {
 		mode = MODE_CLEAR;
-		serv = "pop3";
+		serv = (gchar *) "pop3";
 		port = POP3S_PORT;
 	}
 
@@ -389,7 +389,7 @@ camel_pop3_store_expunge (CamelPOP3Store *store, CamelException *ex)
 	camel_service_disconnect (CAMEL_SERVICE (store), FALSE, ex);
 }
 
-static int
+static gint
 try_sasl(CamelPOP3Store *store, const gchar *mech, CamelException *ex)
 {
 	CamelPOP3Stream *stream = store->engine->stream;
@@ -456,7 +456,7 @@ try_sasl(CamelPOP3Store *store, const gchar *mech, CamelException *ex)
 	return -1;
 }
 
-static int
+static gint
 pop3_try_authenticate (CamelService *service, gboolean reprompt, const gchar *errmsg, CamelException *ex)
 {
 	CamelPOP3Store *store = (CamelPOP3Store *)service;
@@ -503,7 +503,7 @@ pop3_try_authenticate (CamelService *service, gboolean reprompt, const gchar *er
 		d = store->engine->apop;
 
 		while (*d != '\0') {
-			if (!isascii((int)*d)) {
+			if (!isascii((gint)*d)) {
 
 				/* README for Translators: The string APOP should not be translated */
 				camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID,
diff --git a/camel/providers/pop3/camel-pop3-stream.c b/camel/providers/pop3/camel-pop3-stream.c
index 6fcd530..5efe17f 100644
--- a/camel/providers/pop3/camel-pop3-stream.c
+++ b/camel/providers/pop3/camel-pop3-stream.c
@@ -47,7 +47,7 @@ static CamelObjectClass *parent_class = NULL;
 #define CAMEL_POP3_STREAM_SIZE (4096)
 #define CAMEL_POP3_STREAM_LINE (1024) /* maximum line size */
 
-static int
+static gint
 stream_fill(CamelPOP3Stream *is)
 {
 	gint left = 0;
@@ -71,8 +71,8 @@ stream_fill(CamelPOP3Stream *is)
 	return 0;
 }
 
-static ssize_t
-stream_read(CamelStream *stream, gchar *buffer, size_t n)
+static gssize
+stream_read(CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelPOP3Stream *is = (CamelPOP3Stream *)stream;
 	gchar *o, *oe;
@@ -105,7 +105,7 @@ stream_read(CamelStream *stream, gchar *buffer, size_t n)
 				is->ptr = p+3;
 				is->mode = CAMEL_POP3_STREAM_EOD;
 				is->state = 0;
-				dd(printf("POP3_STREAM_READ(%d):\n%.*s\n", (int)(o-buffer), (int)(o-buffer), buffer));
+				dd(printf("POP3_STREAM_READ(%d):\n%.*s\n", (gint)(o-buffer), (gint)(o-buffer), buffer));
 				return o-buffer;
 			}
 			p++;
@@ -138,32 +138,32 @@ stream_read(CamelStream *stream, gchar *buffer, size_t n)
 	is->ptr = p;
 	is->state = state;
 
-	dd(printf("POP3_STREAM_READ(%d):\n%.*s\n", (int)(o-buffer), (int)(o-buffer), buffer));
+	dd(printf("POP3_STREAM_READ(%d):\n%.*s\n", (gint)(o-buffer), (gint)(o-buffer), buffer));
 
 	return o-buffer;
 }
 
-static ssize_t
-stream_write(CamelStream *stream, const gchar *buffer, size_t n)
+static gssize
+stream_write(CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelPOP3Stream *is = (CamelPOP3Stream *)stream;
 
 	if (strncmp (buffer, "PASS ", 5) != 0)
-		dd(printf("POP3_STREAM_WRITE(%d):\n%.*s\n", (int)n, (int)n, buffer));
+		dd(printf("POP3_STREAM_WRITE(%d):\n%.*s\n", (gint)n, (gint)n, buffer));
 	else
-		dd(printf("POP3_STREAM_WRITE(%d):\nPASS xxxxxxxx\n", (int)n));
+		dd(printf("POP3_STREAM_WRITE(%d):\nPASS xxxxxxxx\n", (gint)n));
 
 	return camel_stream_write(is->source, buffer, n);
 }
 
-static int
+static gint
 stream_close(CamelStream *stream)
 {
 	/* nop? */
 	return 0;
 }
 
-static int
+static gint
 stream_flush(CamelStream *stream)
 {
 	/* nop? */
@@ -178,7 +178,7 @@ stream_eos(CamelStream *stream)
 	return is->mode != CAMEL_POP3_STREAM_DATA;
 }
 
-static int
+static gint
 stream_reset(CamelStream *stream)
 {
 	/* nop?  reset literal mode? */
@@ -372,7 +372,7 @@ gint camel_pop3_stream_gets(CamelPOP3Stream *is, guchar **start, guint *len)
 	*len = max;
 	is->ptr += max;
 
-	dd(printf("POP3_STREAM_GETS(%s,%d): '%.*s'\n", end==NULL?"more":"last", *len, (int)*len, *start));
+	dd(printf("POP3_STREAM_GETS(%s,%d): '%.*s'\n", end==NULL?"more":"last", *len, (gint)*len, *start));
 
 	return end == NULL?1:0;
 }
@@ -424,7 +424,7 @@ gint camel_pop3_stream_getd(CamelPOP3Stream *is, guchar **start, guint *len)
 					is->mode = CAMEL_POP3_STREAM_EOD;
 					is->state = 0;
 
-					dd(printf("POP3_STREAM_GETD(%s,%d): '%.*s'\n", "last", *len, (int)*len, *start));
+					dd(printf("POP3_STREAM_GETD(%s,%d): '%.*s'\n", "last", *len, (gint)*len, *start));
 
 					return 0;
 				}
@@ -439,7 +439,7 @@ gint camel_pop3_stream_getd(CamelPOP3Stream *is, guchar **start, guint *len)
 					*start = s;
 					is->state = 1;
 
-					dd(printf("POP3_STREAM_GETD(%s,%d): '%.*s'\n", "more", *len, (int)*len, *start));
+					dd(printf("POP3_STREAM_GETD(%s,%d): '%.*s'\n", "more", *len, (gint)*len, *start));
 
 					return 1;
 				}
@@ -464,7 +464,7 @@ gint camel_pop3_stream_getd(CamelPOP3Stream *is, guchar **start, guint *len)
 	*len = p-s;
 	*start = s;
 
-	dd(printf("POP3_STREAM_GETD(%s,%d): '%.*s'\n", "more", *len, (int)*len, *start));
+	dd(printf("POP3_STREAM_GETD(%s,%d): '%.*s'\n", "more", *len, (gint)*len, *start));
 
 	return 1;
 }
diff --git a/camel/providers/pop3/camel-pop3-stream.h b/camel/providers/pop3/camel-pop3-stream.h
index 104f643..87b1d1f 100644
--- a/camel/providers/pop3/camel-pop3-stream.h
+++ b/camel/providers/pop3/camel-pop3-stream.h
@@ -65,8 +65,8 @@ CamelStream     *camel_pop3_stream_new		(CamelStream *source);
 void		 camel_pop3_stream_set_mode     (CamelPOP3Stream *is, camel_pop3_stream_mode_t mode);
 
 gint              camel_pop3_stream_line		(CamelPOP3Stream *is, guchar **data, guint *len);
-int		 camel_pop3_stream_gets		(CamelPOP3Stream *is, guchar **start, guint *len);
-int		 camel_pop3_stream_getd		(CamelPOP3Stream *is, guchar **start, guint *len);
+gint		 camel_pop3_stream_gets		(CamelPOP3Stream *is, guchar **start, guint *len);
+gint		 camel_pop3_stream_getd		(CamelPOP3Stream *is, guchar **start, guint *len);
 
 G_END_DECLS
 
diff --git a/camel/providers/sendmail/Makefile.am b/camel/providers/sendmail/Makefile.am
index 685585f..00ca6d0 100644
--- a/camel/providers/sendmail/Makefile.am
+++ b/camel/providers/sendmail/Makefile.am
@@ -7,7 +7,6 @@ INCLUDES =						\
 	-I..						\
 	-I$(srcdir)/..					\
 	-I$(srcdir)/../../..				\
-	-I$(top_srcdir)/intl				\
 	-I$(top_srcdir)/camel                   	\
 	$(CAMEL_CFLAGS)					\
 	$(GNOME_INCLUDEDIR)				\
diff --git a/camel/providers/smtp/Makefile.am b/camel/providers/smtp/Makefile.am
index a89b967..0616eb2 100644
--- a/camel/providers/smtp/Makefile.am
+++ b/camel/providers/smtp/Makefile.am
@@ -5,7 +5,6 @@ camel_provider_DATA = libcamelsmtp.urls
 
 INCLUDES =					\
 	-I$(top_srcdir)				\
-	-I$(top_srcdir)/intl			\
 	-I$(top_srcdir)/camel			\
 	$(CAMEL_CFLAGS)				\
 	-DG_LOG_DOMAIN=\"camel-smtp-provider\"
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index e70f7ca..d3f35f0 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -396,9 +396,9 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 }
 
 static struct {
-	gchar *value;
-	gchar *serv;
-	gchar *port;
+	const gchar *value;
+	const gchar *serv;
+	const gchar *port;
 	gint mode;
 } ssl_options[] = {
 	{ "",              "smtps", SMTPS_PORT, MODE_SSL   },  /* really old (1.x) */
@@ -422,11 +422,11 @@ connect_to_server_wrapper (CamelService *service, CamelException *ex)
 			if (!strcmp (ssl_options[i].value, ssl_mode))
 				break;
 		mode = ssl_options[i].mode;
-		serv = ssl_options[i].serv;
+		serv = (gchar *) ssl_options[i].serv;
 		port = ssl_options[i].port;
 	} else {
 		mode = MODE_CLEAR;
-		serv = "smtp";
+		serv = (gchar *) "smtp";
 		port = SMTP_PORT;
 	}
 
@@ -640,7 +640,7 @@ esmtp_get_authtypes (const guchar *buffer)
 
 	/* advance to the first token */
 	start = buffer;
-	while (isspace ((int) *start) || *start == '=')
+	while (isspace ((gint) *start) || *start == '=')
 		start++;
 
 	if (!*start)
@@ -648,12 +648,12 @@ esmtp_get_authtypes (const guchar *buffer)
 
 	table = g_hash_table_new (g_str_hash, g_str_equal);
 
-	for ( ; *start; ) {
+	for (; *start; ) {
 		gchar *type;
 
 		/* advance to the end of the token */
 		end = start;
-		while (*end && !isspace ((int) *end))
+		while (*end && !isspace ((gint) *end))
 			end++;
 
 		type = g_strndup ((gchar *) start, end - start);
@@ -661,7 +661,7 @@ esmtp_get_authtypes (const guchar *buffer)
 
 		/* advance to the next token */
 		start = end;
-		while (isspace ((int) *start))
+		while (isspace ((gint) *start))
 			start++;
 	}
 
@@ -788,10 +788,10 @@ smtp_next_token (const gchar *buf)
 	const guchar *token;
 
 	token = (const guchar *) buf;
-	while (*token && !isspace ((int) *token))
+	while (*token && !isspace ((gint) *token))
 		token++;
 
-	while (*token && isspace ((int) *token))
+	while (*token && isspace ((gint) *token))
 		token++;
 
 	return (const gchar *) token;
@@ -822,7 +822,7 @@ smtp_next_token (const gchar *buf)
  *        hexadecimal digits
  */
 static gchar *
-smtp_decode_status_code (const gchar *in, size_t len)
+smtp_decode_status_code (const gchar *in, gsize len)
 {
 	guchar *inptr, *outptr;
 	const guchar *inend;
diff --git a/camel/tests/folder/Makefile.am b/camel/tests/folder/Makefile.am
index 477d47e..576705a 100644
--- a/camel/tests/folder/Makefile.am
+++ b/camel/tests/folder/Makefile.am
@@ -2,7 +2,6 @@
 INCLUDES =						\
 	-I$(includedir)					\
 	-I$(top_srcdir)					\
-	-I$(top_srcdir)/intl			 	\
 	-I$(top_srcdir)/camel				\
 	-I$(top_srcdir)/camel/tests/lib 		\
 	-DG_LOG_DOMAIN=\"evolution-tests\"		\
diff --git a/camel/tests/folder/test11.c b/camel/tests/folder/test11.c
index 39ba815..ee53b28 100644
--- a/camel/tests/folder/test11.c
+++ b/camel/tests/folder/test11.c
@@ -47,7 +47,7 @@ static CamelFolderInfo fi_list_3[] = {
 	{ NULL, NULL, NULL, "maildir:/tmp/camel-test/maildir#testbox/foo", "foo", "testbox/foo", CAMEL_FOLDER_NOCHILDREN, -1, -1 },
 };
 
-static int
+static gint
 cmp_fi(gconstpointer a, gconstpointer b)
 {
 	const CamelFolderInfo *fa = ((const CamelFolderInfo **)a)[0];
diff --git a/camel/tests/lib/Makefile.am b/camel/tests/lib/Makefile.am
index 1783afe..659264d 100644
--- a/camel/tests/lib/Makefile.am
+++ b/camel/tests/lib/Makefile.am
@@ -2,8 +2,6 @@
 INCLUDES =						\
 	-I$(includedir)					\
 	-I$(top_srcdir)					\
-	-I$(top_srcdir)/intl			 	\
-	-I$(top_srcdir)/e-util			 	\
 	-I$(top_srcdir)/camel				\
 	-DCAMEL_BUILD_DIR=\"$(top_builddir)/camel\"	\
 	$(CAMEL_CFLAGS)
diff --git a/camel/tests/lib/folders.c b/camel/tests/lib/folders.c
index 2c7a89c..0f619fb 100644
--- a/camel/tests/lib/folders.c
+++ b/camel/tests/lib/folders.c
@@ -52,7 +52,7 @@ test_folder_counts(CamelFolder *folder, gint total, gint unread)
 	pull();
 }
 
-static int
+static gint
 safe_strcmp(const gchar *a, const gchar *b)
 {
 	if (a == NULL && b == NULL)
diff --git a/camel/tests/lib/messages.c b/camel/tests/lib/messages.c
index 000ebdc..d4dc028 100644
--- a/camel/tests/lib/messages.c
+++ b/camel/tests/lib/messages.c
@@ -145,7 +145,7 @@ hexdump (const guchar *in, gint inlen)
 		printf ("       ");
 
 		while (start < inptr) {
-			fputc (isprint ((int) *start) ? *start : '.', stdout);
+			fputc (isprint ((gint) *start) ? *start : '.', stdout);
 			start++;
 		}
 
diff --git a/camel/tests/message/Makefile.am b/camel/tests/message/Makefile.am
index b4ad27f..4dface2 100644
--- a/camel/tests/message/Makefile.am
+++ b/camel/tests/message/Makefile.am
@@ -2,7 +2,6 @@
 INCLUDES =						\
 	-I$(includedir)					\
 	-I$(top_srcdir)					\
-	-I$(top_srcdir)/intl			 	\
 	-I$(top_srcdir)/camel				\
 	-I$(top_srcdir)/camel/tests/lib 		\
 	-DG_LOG_DOMAIN=\"evolution-tests\"		\
diff --git a/camel/tests/message/test2.c b/camel/tests/message/test2.c
index 3b43fb4..0ae182a 100644
--- a/camel/tests/message/test2.c
+++ b/camel/tests/message/test2.c
@@ -19,7 +19,7 @@ static gchar *convert(const gchar *in, const gchar *from, const gchar *to)
 	iconv_t ic = iconv_open(to, from);
 	gchar *out, *outp;
 	const gchar *inp;
-	size_t inlen, outlen;
+	gsize inlen, outlen;
 
 	if (ic == (iconv_t)-1)
 		return g_strdup(in);
diff --git a/camel/tests/mime-filter/Makefile.am b/camel/tests/mime-filter/Makefile.am
index 2e5a472..06e3a5c 100644
--- a/camel/tests/mime-filter/Makefile.am
+++ b/camel/tests/mime-filter/Makefile.am
@@ -2,7 +2,6 @@
 INCLUDES =						\
 	-I$(includedir)					\
 	-I$(top_srcdir)					\
-	-I$(top_srcdir)/intl			 	\
 	-I$(top_srcdir)/camel				\
 	-I$(top_srcdir)/camel/tests/lib 		\
 	-DG_LOG_DOMAIN=\"evolution-tests\"		\
diff --git a/camel/tests/mime-filter/test-charset.c b/camel/tests/mime-filter/test-charset.c
index 00dc1dd..60aaffb 100644
--- a/camel/tests/mime-filter/test-charset.c
+++ b/camel/tests/mime-filter/test-charset.c
@@ -23,7 +23,7 @@
 gint
 main (gint argc, gchar **argv)
 {
-	ssize_t comp_progress, comp_correct_chunk, comp_filter_chunk;
+	gssize comp_progress, comp_correct_chunk, comp_filter_chunk;
 	gchar comp_correct[CHUNK_SIZE], comp_filter[CHUNK_SIZE];
 	CamelStream *source;
 	CamelStream *correct;
@@ -99,7 +99,7 @@ main (gint argc, gchar **argv)
 				break;
 
 			while (comp_filter_chunk < comp_correct_chunk) {
-				ssize_t delta;
+				gssize delta;
 
 				delta = camel_stream_read (CAMEL_STREAM (filter),
 							   comp_filter + comp_filter_chunk,
diff --git a/camel/tests/mime-filter/test-crlf.c b/camel/tests/mime-filter/test-crlf.c
index 82a90ba..e87a1a6 100644
--- a/camel/tests/mime-filter/test-crlf.c
+++ b/camel/tests/mime-filter/test-crlf.c
@@ -34,7 +34,7 @@ main (gint argc, gchar **argv)
 	CamelMimeFilter *sh;
 	gchar *work;
 	gint i;
-	ssize_t comp_progress, comp_correct_chunk, comp_filter_chunk;
+	gssize comp_progress, comp_correct_chunk, comp_filter_chunk;
 	gint comp_i;
 	gchar comp_correct[CHUNK_SIZE], comp_filter[CHUNK_SIZE];
 
@@ -112,7 +112,7 @@ main (gint argc, gchar **argv)
 					break;
 
 				while (comp_filter_chunk < comp_correct_chunk) {
-					ssize_t delta;
+					gssize delta;
 
 					delta = camel_stream_read (CAMEL_STREAM (filter),
 								   comp_filter + comp_filter_chunk,
diff --git a/camel/tests/misc/Makefile.am b/camel/tests/misc/Makefile.am
index 93c714b..bb3343e 100644
--- a/camel/tests/misc/Makefile.am
+++ b/camel/tests/misc/Makefile.am
@@ -2,7 +2,6 @@
 INCLUDES =						\
 	-I$(includedir)					\
 	-I$(top_srcdir)					\
-	-I$(top_srcdir)/intl			 	\
 	-I$(top_srcdir)/camel				\
 	-I$(top_srcdir)/camel/tests/lib 		\
 	-DG_LOG_DOMAIN=\"evolution-tests\"		\
diff --git a/camel/tests/misc/split.c b/camel/tests/misc/split.c
index a612c76..841591b 100644
--- a/camel/tests/misc/split.c
+++ b/camel/tests/misc/split.c
@@ -28,7 +28,7 @@ static struct {
 	{ "\"quoted\"", 1, { { "quoted", CAMEL_SEARCH_WORD_SIMPLE } } },
 	{ "\"quoted double\"", 1, { { "quoted double", CAMEL_SEARCH_WORD_COMPLEX } } },
 	{ "\"quoted double\" compl;ex", 2, { { "quoted double", CAMEL_SEARCH_WORD_COMPLEX }, { "compl;ex", CAMEL_SEARCH_WORD_COMPLEX } } },
-	{ "\"quoted double \\\" escaped\"", 1, { { "quoted double \" escaped", CAMEL_SEARCH_WORD_COMPLEX } } },
+	{ "\"quoted gdouble \\\" escaped\"", 1, { { "quoted gdouble \" escaped", CAMEL_SEARCH_WORD_COMPLEX } } },
 	{ "\"quoted\\\"double\" \\\" escaped\\\"", 3, { { "quoted\"double", CAMEL_SEARCH_WORD_COMPLEX }, {"\"", CAMEL_SEARCH_WORD_COMPLEX}, { "escaped\"", CAMEL_SEARCH_WORD_COMPLEX } } },
 	{ "\\\"escaped", 1, { { "\"escaped", CAMEL_SEARCH_WORD_COMPLEX } } },
 
diff --git a/camel/tests/smime/Makefile.am b/camel/tests/smime/Makefile.am
index 05883f7..39ecda9 100644
--- a/camel/tests/smime/Makefile.am
+++ b/camel/tests/smime/Makefile.am
@@ -2,7 +2,6 @@
 INCLUDES =						\
 	-I$(includedir)					\
 	-I$(top_srcdir)					\
-	-I$(top_srcdir)/intl			 	\
 	-I$(top_srcdir)/camel				\
 	-I$(top_srcdir)/camel/tests/lib 		\
 	-DG_LOG_DOMAIN=\"evolution-tests\"		\
diff --git a/camel/tests/stream/Makefile.am b/camel/tests/stream/Makefile.am
index 1a6903e..0f30894 100644
--- a/camel/tests/stream/Makefile.am
+++ b/camel/tests/stream/Makefile.am
@@ -2,7 +2,6 @@
 INCLUDES =						\
 	-I$(includedir)					\
 	-I$(top_srcdir)					\
-	-I$(top_srcdir)/intl			 	\
 	-I$(top_srcdir)/camel				\
 	-I$(top_srcdir)/camel/tests/lib 		\
 	-DG_LOG_DOMAIN=\"evolution-tests\"		\
diff --git a/docs/reference/camel/tmpl/camel-file-utils.sgml b/docs/reference/camel/tmpl/camel-file-utils.sgml
index 4e1d3b0..0006831 100644
--- a/docs/reference/camel/tmpl/camel-file-utils.sgml
+++ b/docs/reference/camel/tmpl/camel-file-utils.sgml
@@ -104,26 +104,6 @@ camel-file-utils
 @Returns: 
 
 
-<!-- ##### FUNCTION camel_file_util_encode_size_t ##### -->
-<para>
-
-</para>
-
- out: 
- value: 
- Returns: 
-
-
-<!-- ##### FUNCTION camel_file_util_decode_size_t ##### -->
-<para>
-
-</para>
-
- in: 
- dest: 
- Returns: 
-
-
 <!-- ##### FUNCTION camel_file_util_encode_string ##### -->
 <para>
 
diff --git a/docs/reference/camel/tmpl/camel-unused.sgml b/docs/reference/camel/tmpl/camel-unused.sgml
index 1f34b69..a111b56 100644
--- a/docs/reference/camel/tmpl/camel-unused.sgml
+++ b/docs/reference/camel/tmpl/camel-unused.sgml
@@ -472,6 +472,24 @@ camel-types
 
 @Returns: 
 
+<!-- ##### FUNCTION camel_file_util_decode_size_t ##### -->
+<para>
+
+</para>
+
+ in: 
+ dest: 
+ Returns: 
+
+<!-- ##### FUNCTION camel_file_util_encode_size_t ##### -->
+<para>
+
+</para>
+
+ out: 
+ value: 
+ Returns: 
+
 <!-- ##### FUNCTION camel_folder_summary_array_free ##### -->
 <para>
 
diff --git a/libebackend/e-db3-utils.c b/libebackend/e-db3-utils.c
index e94c9e6..9a086fd 100644
--- a/libebackend/e-db3-utils.c
+++ b/libebackend/e-db3-utils.c
@@ -30,7 +30,7 @@ get_copy_filename (const gchar *filename)
 	return g_strdup_printf ("%s-copy", filename);
 }
 
-static int
+static gint
 cp_file (const gchar *src, const gchar *dest)
 {
 	gint i;
@@ -89,7 +89,7 @@ cp_file (const gchar *src, const gchar *dest)
 	return (i == -1) ? -1 : 0;
 }
 
-static int
+static gint
 touch_file (const gchar *file)
 {
 	gint o;
@@ -100,7 +100,7 @@ touch_file (const gchar *file)
 	return close (o);
 }
 
-static int
+static gint
 resume_upgrade (const gchar *filename, const gchar *copy_filename, const gchar *check_filename)
 {
 	DB *db;
diff --git a/libedataserver/e-account.h b/libedataserver/e-account.h
index 8aa702e..a14255a 100644
--- a/libedataserver/e-account.h
+++ b/libedataserver/e-account.h
@@ -177,7 +177,7 @@ void      e_account_set_string   (EAccount *,
 				  e_account_item_t type, const gchar *);
 
 void      e_account_set_int      (EAccount *,
-				  e_account_item_t type, int);
+				  e_account_item_t type, gint);
 
 void      e_account_set_bool     (EAccount *,
 				  e_account_item_t type, gboolean);
diff --git a/libedataserver/e-data-server-util.c b/libedataserver/e-data-server-util.c
index 507cdac..45bf506 100644
--- a/libedataserver/e-data-server-util.c
+++ b/libedataserver/e-data-server-util.c
@@ -303,7 +303,7 @@ e_util_utf8_remove_accents (const gchar *str)
 		return g_strdup (str);
 
 	for (i = 0, j = 0; res [i]; i++) {
-		if ((unsigned char)res[i] != 0xCC || res [i + 1] == 0) {
+		if ((guchar)res[i] != 0xCC || res [i + 1] == 0) {
 			res [j] = res [i];
 			j++;
 		} else {
@@ -328,9 +328,9 @@ e_util_utf8_remove_accents (const gchar *str)
  *
  * Returns: The number of characters placed in @s.
  **/
-size_t e_strftime(gchar *s, size_t max, const gchar *fmt, const struct tm *tm)
+gsize e_strftime(gchar *s, gsize max, const gchar *fmt, const struct tm *tm)
 {
-	size_t ret;
+	gsize ret;
 #ifdef HAVE_LKSTRFTIME
 	ret = strftime(s, max, fmt, tm);
 #else
@@ -377,10 +377,10 @@ size_t e_strftime(gchar *s, size_t max, const gchar *fmt, const struct tm *tm)
  *
  * Returns: The number of characters placed in @s.
  **/
-size_t
-e_utf8_strftime(gchar *s, size_t max, const gchar *fmt, const struct tm *tm)
+gsize
+e_utf8_strftime(gchar *s, gsize max, const gchar *fmt, const struct tm *tm)
 {
-	size_t sz, ret;
+	gsize sz, ret;
 	gchar *locale_fmt, *buf;
 
 	locale_fmt = g_locale_from_utf8(fmt, -1, NULL, &sz, NULL);
@@ -454,7 +454,7 @@ e_util_pthread_id (pthread_t t)
 	/* 64-bit Windows */
 	return (guint64) t.p;
 #else
-	return (int) t.p;
+	return (gint) t.p;
 #endif
 #else
 	/* Just return a checksum of the contents of the pthread_t */
diff --git a/libedataserver/e-data-server-util.h b/libedataserver/e-data-server-util.h
index 9628180..57e2581 100644
--- a/libedataserver/e-data-server-util.h
+++ b/libedataserver/e-data-server-util.h
@@ -39,13 +39,13 @@ gchar       *e_util_strstrcase (const gchar *haystack, const gchar *needle);
 gchar       *e_util_unicode_get_utf8 (const gchar *text, gunichar *out);
 const gchar *e_util_utf8_strstrcase (const gchar *haystack, const gchar *needle);
 const gchar *e_util_utf8_strstrcasedecomp (const gchar *haystack, const gchar *needle);
-int	     e_util_utf8_strcasecmp (const gchar *s1, const gchar *s2);
+gint	     e_util_utf8_strcasecmp (const gchar *s1, const gchar *s2);
 gchar       *e_util_utf8_remove_accents (const gchar *str);
 guint64      e_util_pthread_id (pthread_t t);
 void         e_filename_make_safe (gchar *string);
 
-size_t e_utf8_strftime(gchar *s, size_t max, const gchar *fmt, const struct tm *tm);
-size_t e_strftime(gchar *s, size_t max, const gchar *fmt, const struct tm *tm);
+gsize e_utf8_strftime(gchar *s, gsize max, const gchar *fmt, const struct tm *tm);
+gsize e_strftime(gchar *s, gsize max, const gchar *fmt, const struct tm *tm);
 
 #ifdef G_OS_WIN32
 const gchar  *e_util_get_prefix (void) G_GNUC_CONST;
diff --git a/libedataserver/e-iconv.c b/libedataserver/e-iconv.c
index 3570305..f933119 100644
--- a/libedataserver/e-iconv.c
+++ b/libedataserver/e-iconv.c
@@ -503,7 +503,7 @@ iconv_t e_iconv_open(const gchar *oto, const gchar *ofrom)
 			/* work around some broken iconv implementations
 			 * that die if the length arguments are NULL
 			 */
-			size_t buggy_iconv_len = 0;
+			gsize buggy_iconv_len = 0;
 			gchar *buggy_iconv_buf = NULL;
 
 			/* resets the converter */
@@ -535,7 +535,7 @@ iconv_t e_iconv_open(const gchar *oto, const gchar *ofrom)
 	return ip;
 }
 
-size_t e_iconv(iconv_t cd, const gchar **inbuf, size_t *inbytesleft, gchar ** outbuf, size_t *outbytesleft)
+gsize e_iconv(iconv_t cd, const gchar **inbuf, gsize *inbytesleft, gchar ** outbuf, gsize *outbytesleft)
 {
 	return iconv(cd, (gchar **) inbuf, inbytesleft, outbuf, outbytesleft);
 }
diff --git a/libedataserver/e-iconv.h b/libedataserver/e-iconv.h
index ef6a834..5b3de40 100644
--- a/libedataserver/e-iconv.h
+++ b/libedataserver/e-iconv.h
@@ -38,7 +38,7 @@ extern "C" {
 
 const gchar *e_iconv_charset_name(const gchar *charset);
 iconv_t e_iconv_open(const gchar *oto, const gchar *ofrom);
-size_t e_iconv(iconv_t cd, const gchar **inbuf, size_t *inbytesleft, gchar ** outbuf, size_t *outbytesleft);
+gsize e_iconv(iconv_t cd, const gchar **inbuf, gsize *inbytesleft, gchar ** outbuf, gsize *outbytesleft);
 void e_iconv_close(iconv_t ip);
 const gchar *e_iconv_locale_charset(void);
 
diff --git a/libedataserver/e-memory.c b/libedataserver/e-memory.c
index aaa041f..1c5da6d 100644
--- a/libedataserver/e-memory.c
+++ b/libedataserver/e-memory.c
@@ -57,7 +57,7 @@ static time_start(const gchar *desc)
 
 static time_end(const gchar *desc)
 {
-	unsigned long diff;
+	gulong diff;
 	struct timeval end;
 
 	gettimeofday(&end, NULL);
@@ -549,7 +549,7 @@ void e_mempool_destroy(MemPool *pool)
   string array classes
 */
 
-#define STRV_UNPACKED ((unsigned char)(~0))
+#define STRV_UNPACKED ((guchar)(~0))
 
 struct _EStrv {
 	guchar length;	/* how many entries we have (or the token STRV_UNPACKED) */
@@ -875,7 +875,7 @@ static GPtrArray *poolv_table = NULL;
 #ifdef PROFILE_POOLV
 static gulong poolv_hits = 0;
 static gulong poolv_misses = 0;
-static unsigned long poolv_mem, poolv_count;
+static gulong poolv_mem, poolv_count;
 #endif
 
 #ifdef G_THREADS_ENABLED
@@ -1028,7 +1028,7 @@ poolv_profile_update (void)
 
 	printf("poolv profile: %lu hits, %lu misses: %d%% hit rate, memory: %lu, instances: %lu\n",
 	       poolv_hits, poolv_misses,
-	       (int)(100.0 * ((double) poolv_hits / (double) (poolv_hits + poolv_misses))),
+	       (gint)(100.0 * ((double) poolv_hits / (double) (poolv_hits + poolv_misses))),
 	       poolv_mem, poolv_count);
 
 	last_time = new_time;
diff --git a/libedataserver/e-msgport.c b/libedataserver/e-msgport.c
index a04601f..4ca5834 100644
--- a/libedataserver/e-msgport.c
+++ b/libedataserver/e-msgport.c
@@ -66,7 +66,7 @@
 #define E_IS_STATUS_INTR() (errno == EINTR)
 #endif
 
-static int
+static gint
 e_pipe (gint *fds)
 {
 #ifndef G_OS_WIN32
@@ -281,7 +281,7 @@ struct _EMCache {
 	GMutex *lock;
 	GHashTable *key_table;
 	EDList lru_list;
-	size_t node_size;
+	gsize node_size;
 	gint node_count;
 	time_t timeout;
 	GFreeFunc node_free;
@@ -299,7 +299,7 @@ struct _EMCache {
  * Return value:
  **/
 EMCache *
-em_cache_new(time_t timeout, size_t nodesize, GFreeFunc nodefree)
+em_cache_new(time_t timeout, gsize nodesize, GFreeFunc nodefree)
 {
 	struct _EMCache *emc;
 
@@ -500,7 +500,7 @@ enum {
 };
 
 #ifdef HAVE_NSS
-static int
+static gint
 e_prpipe (PRFileDesc **fds)
 {
 #ifdef G_OS_WIN32
@@ -1317,7 +1317,7 @@ gpointer fdserver(gpointer data)
 {
 	gint fd;
 	EMsg *msg;
-	gint id = (int)data;
+	gint id = (gint)data;
 	fd_set rfds;
 
 	fd = e_msgport_fd(server_port);
@@ -1344,7 +1344,7 @@ gpointer fdserver(gpointer data)
 gpointer server(gpointer data)
 {
 	EMsg *msg;
-	gint id = (int)data;
+	gint id = (gint)data;
 
 	while (1) {
 		printf("server %d: waiting\n", id);
diff --git a/libedataserver/e-msgport.h b/libedataserver/e-msgport.h
index 769d62f..6e1573e 100644
--- a/libedataserver/e-msgport.h
+++ b/libedataserver/e-msgport.h
@@ -40,7 +40,7 @@ struct _EMCacheNode {
 	time_t stamp;
 };
 
-EMCache *em_cache_new(time_t timeout, size_t nodesize, GFreeFunc nodefree);
+EMCache *em_cache_new(time_t timeout, gsize nodesize, GFreeFunc nodefree);
 void em_cache_destroy(EMCache *emc);
 EMCacheNode *em_cache_lookup(EMCache *emc, const gchar *key);
 EMCacheNode *em_cache_node_new(EMCache *emc, const gchar *key);
diff --git a/libedataserver/e-sexp.c b/libedataserver/e-sexp.c
index 7f3eb1c..dd6b261 100644
--- a/libedataserver/e-sexp.c
+++ b/libedataserver/e-sexp.c
@@ -59,9 +59,9 @@
 
   Comparison operators:
 
-  bool = (< gint int)
-  bool = (> gint int)
-  bool = (= gint int)
+  bool = (< gint gint)
+  bool = (> gint gint)
+  bool = (= gint gint)
 
   bool = (< string string)
   bool = (> string string)
@@ -104,7 +104,7 @@ static struct _ESExpTerm * parse_list(ESExp *f, gint gotbrace);
 static struct _ESExpTerm * parse_value(ESExp *f);
 
 #ifdef TESTER
-static void parse_dump_term(struct _ESExpTerm *t, int depth);
+static void parse_dump_term(struct _ESExpTerm *t, gint depth);
 #endif
 
 #ifdef E_SEXP_IS_G_OBJECT
@@ -760,7 +760,7 @@ eval_dump_result(ESExpResult *r, gint depth)
 		printf("bool: %c\n", r->value.bool?'t':'f');
 		break;
 	case ESEXP_RES_TIME:
-		printf("time_t: %ld\n", (long) r->value.time);
+		printf("time_t: %ld\n", (glong) r->value.time);
 		break;
 	case ESEXP_RES_UNDEFINED:
 		printf(" <undefined>\n");
@@ -795,7 +795,7 @@ parse_dump_term(struct _ESExpTerm *t, gint depth)
 		printf(" #%c", t->value.bool?'t':'f');
 		break;
 	case ESEXP_TERM_TIME:
-		printf(" %ld", (long) t->value.time);
+		printf(" %ld", (glong) t->value.time);
 		break;
 	case ESEXP_TERM_IFUNC:
 	case ESEXP_TERM_FUNC:
@@ -1130,9 +1130,9 @@ e_sexp_init (ESExp *s)
 	/* load in builtin symbols? */
 	for(i=0;i<sizeof(symbols)/sizeof(symbols[0]);i++) {
 		if (symbols[i].type == 1) {
-			e_sexp_add_ifunction(s, 0, symbols[i].name, (ESExpIFunc *)symbols[i].func, (void *)&symbols[i]);
+			e_sexp_add_ifunction(s, 0, symbols[i].name, (ESExpIFunc *)symbols[i].func, (gpointer)&symbols[i]);
 		} else {
-			e_sexp_add_function(s, 0, symbols[i].name, symbols[i].func, (void *)&symbols[i]);
+			e_sexp_add_function(s, 0, symbols[i].name, symbols[i].func, (gpointer)&symbols[i]);
 		}
 	}
 
@@ -1199,7 +1199,7 @@ e_sexp_unref (ESExp *f)
 #endif
 
 void
-e_sexp_add_function(ESExp *f, int scope, const char *name, ESExpFunc *func, void *data)
+e_sexp_add_function(ESExp *f, gint scope, const gchar *name, ESExpFunc *func, gpointer data)
 {
 	struct _ESExpSymbol *s;
 
@@ -1217,7 +1217,7 @@ e_sexp_add_function(ESExp *f, int scope, const char *name, ESExpFunc *func, void
 }
 
 void
-e_sexp_add_ifunction(ESExp *f, int scope, const char *name, ESExpIFunc *ifunc, void *data)
+e_sexp_add_ifunction(ESExp *f, gint scope, const gchar *name, ESExpIFunc *ifunc, gpointer data)
 {
 	struct _ESExpSymbol *s;
 
@@ -1250,7 +1250,7 @@ e_sexp_add_variable(ESExp *f, gint scope, gchar *name, ESExpTerm *value)
 }
 
 void
-e_sexp_remove_symbol(ESExp *f, int scope, const char *name)
+e_sexp_remove_symbol(ESExp *f, gint scope, const gchar *name)
 {
 	gint oldscope;
 	struct _ESExpSymbol *s;
diff --git a/libedataserver/e-sexp.h b/libedataserver/e-sexp.h
index ed32b13..25caa24 100644
--- a/libedataserver/e-sexp.h
+++ b/libedataserver/e-sexp.h
@@ -144,17 +144,17 @@ ESExp	       *e_sexp_new		(void);
 void		e_sexp_ref		(ESExp *f);
 void		e_sexp_unref		(ESExp *f);
 #endif
-void		e_sexp_add_function  	(ESExp *f, int scope, const char *name, ESExpFunc *func, void *data);
-void		e_sexp_add_ifunction  	(ESExp *f, int scope, const char *name, ESExpIFunc *func, void *data);
-void		e_sexp_add_variable  	(ESExp *f, int scope, char *name, ESExpTerm *value);
-void		e_sexp_remove_symbol	(ESExp *f, int scope, const char *name);
-int		e_sexp_set_scope	(ESExp *f, int scope);
+void		e_sexp_add_function	(ESExp *f, gint scope, const gchar *name, ESExpFunc *func, gpointer data);
+void		e_sexp_add_ifunction	(ESExp *f, gint scope, const gchar *name, ESExpIFunc *func, gpointer data);
+void		e_sexp_add_variable	(ESExp *f, gint scope, gchar *name, ESExpTerm *value);
+void		e_sexp_remove_symbol	(ESExp *f, gint scope, const gchar *name);
+gint		e_sexp_set_scope	(ESExp *f, gint scope);
 
 void		e_sexp_input_text	(ESExp *f, const gchar *text, gint len);
 void		e_sexp_input_file	(ESExp *f, gint fd);
 
 
-int		e_sexp_parse		(ESExp *f);
+gint		e_sexp_parse		(ESExp *f);
 ESExpResult    *e_sexp_eval		(ESExp *f);
 
 ESExpResult    *e_sexp_term_eval	(struct _ESExp *f, struct _ESExpTerm *t);
diff --git a/libedataserver/e-source-list.c b/libedataserver/e-source-list.c
index b4f23e3..7a83e83 100644
--- a/libedataserver/e-source-list.c
+++ b/libedataserver/e-source-list.c
@@ -822,7 +822,7 @@ e_source_list_is_gconf_updated (ESourceList *list)
 
 	/* If there is mismatch, free the conf_list and return FALSE */
 	if (!conf_to_list) {
-		for (p = conf_list; p != NULL ; p = p->next) {
+		for (p = conf_list; p != NULL; p = p->next) {
 			gconf_xml = (gchar *) p->data;
 			g_free (gconf_xml);
 		}
@@ -834,7 +834,7 @@ e_source_list_is_gconf_updated (ESourceList *list)
 
 	/* From list to conf */
 
-	for (p = groups ; p != NULL; p = p->next) {
+	for (p = groups; p != NULL; p = p->next) {
 		group = E_SOURCE_GROUP (p->data);
 		source_group_xml = e_source_group_to_xml (group);
 
@@ -854,7 +854,7 @@ e_source_list_is_gconf_updated (ESourceList *list)
 
 	}
 
-	for (p = conf_list; p != NULL ; p = p->next) {
+	for (p = conf_list; p != NULL; p = p->next) {
 		gconf_xml = (gchar *) p->data;
 		g_free (gconf_xml);
 	}
diff --git a/libedataserver/e-time-utils.c b/libedataserver/e-time-utils.c
index ea5174d..e8ab906 100644
--- a/libedataserver/e-time-utils.c
+++ b/libedataserver/e-time-utils.c
@@ -238,7 +238,7 @@ localtime_r (t, tp)
 #define match_char(ch1, ch2) if (ch1 != ch2) return NULL
 #if defined _LIBC && defined __GNUC__ && __GNUC__ >= 2
 # define match_string(cs1, s2) \
-  ({ size_t len = strlen (cs1);						      \
+  ({ gsize len = strlen (cs1);						      \
      gint result = __strncasecmp_l ((cs1), (s2), len, locale) == 0;	      \
      if (result) (s2) += len;						      \
      result; })
@@ -436,7 +436,7 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
 
   const gchar *rp_backup;
   gint cnt;
-  size_t val;
+  gsize val;
   gint have_I, is_pm;
   gint century, want_century;
   gint want_era;
@@ -446,7 +446,7 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
   gint have_uweek, have_wweek;
   gint week_no;
 #ifdef _NL_CURRENT
-  size_t num_eras;
+  gsize num_eras;
 #endif
   struct era_entry *era;
 
@@ -1071,7 +1071,7 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
 
 		  num_eras = _NL_CURRENT_WORD (LC_TIME,
 					       _NL_TIME_ERA_NUM_ENTRIES);
-		  for (era_cnt = 0; era_cnt < (int) num_eras;
+		  for (era_cnt = 0; era_cnt < (gint) num_eras;
 		       ++era_cnt, rp = rp_backup)
 		    {
 		      era = _nl_select_era_entry (era_cnt
@@ -1082,7 +1082,7 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
 			  break;
 			}
 		    }
-		  if (era_cnt != (int) num_eras)
+		  if (era_cnt != (gint) num_eras)
 		    break;
 
 		  era_cnt = -1;
@@ -1126,7 +1126,7 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
 
 		  num_eras = _NL_CURRENT_WORD (LC_TIME,
 					       _NL_TIME_ERA_NUM_ENTRIES);
-		  for (era_cnt = 0; era_cnt < (int) num_eras; ++era_cnt)
+		  for (era_cnt = 0; era_cnt < (gint) num_eras; ++era_cnt)
 		    {
 		      era = _nl_select_era_entry (era_cnt
 						  HELPER_LOCALE_ARG);
@@ -1144,7 +1144,7 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
 			    }
 			}
 		    }
-		  if (era_cnt != (int) num_eras)
+		  if (era_cnt != (gint) num_eras)
 		    break;
 
 		  era_cnt = -1;
@@ -1160,14 +1160,14 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
 		{
 		  num_eras = _NL_CURRENT_WORD (LC_TIME,
 					       _NL_TIME_ERA_NUM_ENTRIES);
-		  for (era_cnt = 0; era_cnt < (int) num_eras;
+		  for (era_cnt = 0; era_cnt < (gint) num_eras;
 		       ++era_cnt, rp = rp_backup)
 		    {
 		      era = _nl_select_era_entry (era_cnt HELPER_LOCALE_ARG);
 		      if (era != NULL && recursive (era->era_format))
 			break;
 		    }
-		  if (era_cnt == (int) num_eras)
+		  if (era_cnt == (gint) num_eras)
 		    {
 		      era_cnt = -1;
 		      if (*decided == loc)
@@ -1501,7 +1501,7 @@ parse_with_strptime (const gchar *value, struct tm *result, const gchar **format
 		return E_TIME_PARSE_INVALID;
 
 	/* Skip whitespace */
-	while (n = (int)((unsigned char)*pos), isspace (n) != 0)
+	while (n = (gint)((guchar)*pos), isspace (n) != 0)
 		pos++;
 
 	/* Try each of the formats in turn */
@@ -1605,7 +1605,7 @@ has_correct_date (const struct tm *value)
  *          E_TIME_PARSE_INVALID if the string could not be parsed.
  */
 ETimeParseStatus
-e_time_parse_date_and_time_ex		(const char	*value,
+e_time_parse_date_and_time_ex		(const gchar	*value,
 					 struct tm	*result,
 					 gboolean	*two_digit_year)
 {
@@ -1735,7 +1735,7 @@ e_time_parse_date_and_time_ex		(const char	*value,
 }
 
 ETimeParseStatus
-e_time_parse_date_and_time		(const char	*value,
+e_time_parse_date_and_time		(const gchar	*value,
 					 struct tm	*result)
 {
 	return e_time_parse_date_and_time_ex (value, result, NULL);
@@ -1882,8 +1882,8 @@ e_time_format_date_and_time		(struct tm	*date_tm,
 					 gboolean	 use_24_hour_format,
 					 gboolean	 show_midnight,
 					 gboolean	 show_zero_seconds,
-					 char		*buffer,
-					 int		 buffer_size)
+					 gchar		*buffer,
+					 gint		 buffer_size)
 {
 	gchar *format;
 
@@ -1933,8 +1933,8 @@ void
 e_time_format_time			(struct tm	*date_tm,
 					 gboolean	 use_24_hour_format,
 					 gboolean	 show_zero_seconds,
-					 char		*buffer,
-					 int		 buffer_size)
+					 gchar		*buffer,
+					 gint		 buffer_size)
 {
 	gchar *format;
 
diff --git a/libedataserver/e-time-utils.h b/libedataserver/e-time-utils.h
index 0f98480..00bd196 100644
--- a/libedataserver/e-time-utils.h
+++ b/libedataserver/e-time-utils.h
@@ -27,25 +27,25 @@ typedef enum {
 } ETimeParseStatus;
 
 /* Tries to parse a string containing a date and time. */
-ETimeParseStatus e_time_parse_date_and_time	(const char	*value,
+ETimeParseStatus e_time_parse_date_and_time	(const gchar	*value,
 						 struct tm	*result);
 
 /* Tries to parse a string containing a date. */
-ETimeParseStatus e_time_parse_date		(const char	*value,
+ETimeParseStatus e_time_parse_date		(const gchar	*value,
 						 struct tm	*result);
 
 
 /* have same behavior like those functions above with two_digit_year set to NULL */
-ETimeParseStatus e_time_parse_date_and_time_ex	(const char	*value,
+ETimeParseStatus e_time_parse_date_and_time_ex	(const gchar	*value,
 						 struct tm	*result,
 						 gboolean	*two_digit_year);
 
-ETimeParseStatus e_time_parse_date_ex		(const char	*value,
+ETimeParseStatus e_time_parse_date_ex		(const gchar	*value,
 						 struct tm	*result,
 						 gboolean	*two_digit_year);
 
 /* Tries to parse a string containing a time. */
-ETimeParseStatus e_time_parse_time		(const char	*value,
+ETimeParseStatus e_time_parse_time		(const gchar	*value,
 						 struct tm	*result);
 
 /* Turns a struct tm into a string like "Wed  3/12/00 12:00:00 AM". */
@@ -53,15 +53,15 @@ void e_time_format_date_and_time		(struct tm	*date_tm,
 						 gboolean	 use_24_hour_format,
 						 gboolean	 show_midnight,
 						 gboolean	 show_zero_seconds,
-						 char		*buffer,
-						 int		 buffer_size);
+						 gchar		*buffer,
+						 gint		 buffer_size);
 
 /* Formats a time from a struct tm, e.g. "01:59 PM". */
 void e_time_format_time				(struct tm	*date_tm,
 						 gboolean	 use_24_hour_format,
 						 gboolean	 show_zero_seconds,
-						 char		*buffer,
-						 int		 buffer_size);
+						 gchar		*buffer,
+						 gint		 buffer_size);
 
 
 /* Like mktime(3), but assumes UTC instead of local timezone. */
diff --git a/libedataserver/e-trie.c b/libedataserver/e-trie.c
index 9e04f28..910248f 100644
--- a/libedataserver/e-trie.c
+++ b/libedataserver/e-trie.c
@@ -63,7 +63,7 @@ struct _ETrie {
 
 
 static inline gunichar
-trie_utf8_getc (const guchar **in, size_t inlen)
+trie_utf8_getc (const guchar **in, gsize inlen)
 {
 	register const guchar *inptr = *in;
 	const guchar *inend = inptr + inlen;
@@ -335,10 +335,10 @@ e_trie_add (ETrie *trie, const gchar *pattern, gint pattern_id)
  * Returns: The matched pattern, or %NULL if no pattern is matched.
  **/
 const gchar *
-e_trie_search (ETrie *trie, const gchar *buffer, size_t buflen, gint *matched_id)
+e_trie_search (ETrie *trie, const gchar *buffer, gsize buflen, gint *matched_id)
 {
 	const guchar *inptr, *inend, *prev, *pat;
-	register size_t inlen = buflen;
+	register gsize inlen = buflen;
 	struct _trie_state *q;
 	struct _trie_match *m = NULL; /* init to please gcc */
 	gunichar c;
diff --git a/libedataserver/e-trie.h b/libedataserver/e-trie.h
index 1652c48..2a534fc 100644
--- a/libedataserver/e-trie.h
+++ b/libedataserver/e-trie.h
@@ -41,7 +41,7 @@ void e_trie_free (ETrie *trie);
 
 void e_trie_add (ETrie *trie, const gchar *pattern, gint pattern_id);
 
-const gchar *e_trie_search (ETrie *trie, const gchar *buffer, size_t buflen, gint *matched_id);
+const gchar *e_trie_search (ETrie *trie, const gchar *buffer, gsize buflen, gint *matched_id);
 
 #ifdef __cplusplus
 }
diff --git a/libedataserver/e-uid.c b/libedataserver/e-uid.c
index 732a990..42bfa12 100644
--- a/libedataserver/e-uid.c
+++ b/libedataserver/e-uid.c
@@ -47,8 +47,8 @@ e_uid_new (void)
 	}
 
 	return g_strdup_printf ("%lu %lu %d %s",
-				(unsigned long) time (NULL),
-				(unsigned long) getpid (),
+				(gulong) time (NULL),
+				(gulong) getpid (),
 				serial++,
 				hostname);
 }
diff --git a/libedataserver/e-url.c b/libedataserver/e-url.c
index 5f67ba1..2b45cef 100644
--- a/libedataserver/e-url.c
+++ b/libedataserver/e-url.c
@@ -159,7 +159,7 @@ e_uri_new (const gchar *uri_string)
 
 	/* find protocol: initial [a-z+.-]* substring until ":" */
 	p = uri_string;
-	while (p < end && (isalnum ((unsigned char) *p) ||
+	while (p < end && (isalnum ((guchar) *p) ||
 			   *p == '.' || *p == '+' || *p == '-'))
 		p++;
 
diff --git a/libedataserver/e-xml-utils.c b/libedataserver/e-xml-utils.c
index 98f3658..8901ce3 100644
--- a/libedataserver/e-xml-utils.c
+++ b/libedataserver/e-xml-utils.c
@@ -60,10 +60,10 @@ e_xml_save_file (const gchar *filename, xmlDocPtr doc)
 {
 	gchar *filesave;
 	xmlChar *xmlbuf;
-	size_t n, written = 0;
+	gsize n, written = 0;
 	gint ret, fd, size;
 	gint errnosave;
-	ssize_t w;
+	gssize w;
 	gchar *dirname = g_path_get_dirname (filename);
 	gchar *basename = g_path_get_basename (filename);
 	gchar *savebasename = g_strconcat (".#", basename, NULL);
@@ -88,7 +88,7 @@ e_xml_save_file (const gchar *filename, xmlDocPtr doc)
 		return -1;
 	}
 
-	n = (size_t) size;
+	n = (gsize) size;
 	do {
 		do {
 			w = write (fd, xmlbuf + written, n - written);
diff --git a/libedataserver/test-source-list.c b/libedataserver/test-source-list.c
index 47ea877..ab676b4 100644
--- a/libedataserver/test-source-list.c
+++ b/libedataserver/test-source-list.c
@@ -146,7 +146,7 @@ dump_list (void)
 }
 
 
-static int
+static gint
 idle_dump_callback (gpointer unused_data)
 {
 	dump_list ();
@@ -297,7 +297,7 @@ group_removed_callback (ESourceList *list,
 }
 
 
-static int
+static gint
 on_idle_do_stuff (gpointer unused_data)
 {
 	GConfClient *client = gconf_client_get_default ();
diff --git a/libedataserverui/e-name-selector-dialog.c b/libedataserverui/e-name-selector-dialog.c
index f8dd230..27fb5d4 100644
--- a/libedataserverui/e-name-selector-dialog.c
+++ b/libedataserverui/e-name-selector-dialog.c
@@ -1018,7 +1018,7 @@ transfer_button_clicked (ENameSelectorDialog *name_selector_dialog, GtkButton *t
 		if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (name_selector_dialog->contact_sort),
 				      &iter, path)) {
 			gtk_tree_path_free (path);
-			return ;
+			return;
 		}
 
 		gtk_tree_path_free (path);
diff --git a/libedataserverui/e-name-selector-entry.c b/libedataserverui/e-name-selector-entry.c
index 5b52267..268249d 100644
--- a/libedataserverui/e-name-selector-entry.c
+++ b/libedataserverui/e-name-selector-entry.c
@@ -1681,7 +1681,7 @@ contact_layout_pixbuffer (GtkCellLayout *cell_layout, GtkCellRenderer *cell, Gtk
 
 		if (pixbuf) {
 			gint w, h;
-			double scale = 1.0;
+			gdouble scale = 1.0;
 
 			w = gdk_pixbuf_get_width (pixbuf);
 			h = gdk_pixbuf_get_height (pixbuf);
@@ -2352,10 +2352,10 @@ populate_popup (ENameSelectorEntry *name_selector_entry, GtkMenu *menu)
 	GList        *email_list=NULL;
 	GList        *l;
 	gint          i;
-	char	     *edit_label;
-	char	     *cut_label;
+	gchar	     *edit_label;
+	gchar	     *cut_label;
 	gchar         *copy_label;
-	int	      email_num, len;
+	gint	      email_num, len;
 	GSList	     *group = NULL;
 	gboolean      is_list;
 	gboolean      show_menu = FALSE;
diff --git a/libedataserverui/e-name-selector-list.c b/libedataserverui/e-name-selector-list.c
index df6afbb..058ee3e 100644
--- a/libedataserverui/e-name-selector-list.c
+++ b/libedataserverui/e-name-selector-list.c
@@ -348,7 +348,7 @@ enl_tree_button_press_event (GtkWidget *widget,
 	GtkWidget    *menu_item;
 	GList        *email_list = NULL, *l;
 	gint          i;
-	int	      email_num, len;
+	gint	      email_num, len;
 	gchar         *delete_label;
 	GSList	     *group = NULL;
 	gboolean      is_list;
diff --git a/libedataserverui/e-source-selector.c b/libedataserverui/e-source-selector.c
index 09b0b02..515044a 100644
--- a/libedataserverui/e-source-selector.c
+++ b/libedataserverui/e-source-selector.c
@@ -433,7 +433,7 @@ rebuild_model (ESourceSelector *selector)
 	free_rebuild_data (rebuild_data);
 }
 
-static int
+static gint
 on_idle_rebuild_model_callback (ESourceSelector *selector)
 {
 	rebuild_model (selector);
diff --git a/libedataserverui/e-tree-model-generator.c b/libedataserverui/e-tree-model-generator.c
index ea095ee..1a9894a 100644
--- a/libedataserverui/e-tree-model-generator.c
+++ b/libedataserverui/e-tree-model-generator.c
@@ -648,12 +648,12 @@ child_row_changed (ETreeModelGenerator *tree_model_generator, GtkTreePath *path,
 		gtk_tree_path_next (generated_path);
 	}
 
-	for ( ; i < node->n_generated; ) {
+	for (; i < node->n_generated; ) {
 		node->n_generated--;
 		row_deleted (tree_model_generator, generated_path);
 	}
 
-	for ( ; i < n_generated; i++) {
+	for (; i < n_generated; i++) {
 		node->n_generated++;
 		row_inserted (tree_model_generator, generated_path);
 		gtk_tree_path_next (generated_path);
@@ -707,7 +707,7 @@ child_row_deleted (ETreeModelGenerator *tree_model_generator, GtkTreePath *path)
 
 	/* FIXME: Converting the path to an iter every time is inefficient */
 
-	for ( ; node->n_generated; ) {
+	for (; node->n_generated; ) {
 		node->n_generated--;
 		row_deleted (tree_model_generator, generated_path);
 	}
diff --git a/libedataserverui/test-source-combo-box.c b/libedataserverui/test-source-combo-box.c
index 28b0ca0..813782c 100644
--- a/libedataserverui/test-source-combo-box.c
+++ b/libedataserverui/test-source-combo-box.c
@@ -38,7 +38,7 @@ source_changed_cb (ESourceComboBox *combo_box)
 }
 
 
-static int
+static gint
 on_idle_create_widget (const gchar *gconf_path)
 {
 	GtkWidget *window;
diff --git a/libedataserverui/test-source-selector.c b/libedataserverui/test-source-selector.c
index 3da4c85..93cc942 100644
--- a/libedataserverui/test-source-selector.c
+++ b/libedataserverui/test-source-selector.c
@@ -67,7 +67,7 @@ check_toggled_callback (GtkToggleButton *button,
 	e_source_selector_show_selection (selector, gtk_toggle_button_get_active (button));
 }
 
-static int
+static gint
 on_idle_create_widget (const gchar *gconf_path)
 {
 	GtkWidget *window;
diff --git a/servers/exchange/lib/e2k-action.h b/servers/exchange/lib/e2k-action.h
index 69b425d..d82d5b2 100644
--- a/servers/exchange/lib/e2k-action.h
+++ b/servers/exchange/lib/e2k-action.h
@@ -14,7 +14,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 gboolean     e2k_actions_extract       (guint8		    **data,
-					int		     *len,
+					gint		     *len,
 					GPtrArray	    **actions);
 void         e2k_actions_append        (GByteArray	     *ba,
 					GPtrArray	     *actions);
@@ -31,7 +31,7 @@ E2kAction   *e2k_action_defer          (GByteArray           *data);
 E2kAction   *e2k_action_bounce         (E2kActionBounceCode   bounce_code);
 E2kAction   *e2k_action_forward        (E2kAddrList	     *list);
 E2kAction   *e2k_action_delegate       (E2kAddrList	     *list);
-E2kAction   *e2k_action_tag            (const char	     *propname,
+E2kAction   *e2k_action_tag            (const gchar	     *propname,
 					E2kPropType	      type,
 					gpointer	      value);
 E2kAction   *e2k_action_delete         (void);
@@ -40,16 +40,16 @@ void         e2k_actions_free          (GPtrArray	     *actions);
 void         e2k_action_free           (E2kAction            *act);
 
 
-E2kAddrList *e2k_addr_list_new         (int		      nentries);
+E2kAddrList *e2k_addr_list_new         (gint		      nentries);
 void         e2k_addr_list_set_local   (E2kAddrList	     *list,
-					int		      entry_num,
-					const char	     *display_name,
-					const char	     *exchange_dn,
-					const char	     *email);
+					gint		      entry_num,
+					const gchar	     *display_name,
+					const gchar	     *exchange_dn,
+					const gchar	     *email);
 void         e2k_addr_list_set_oneoff  (E2kAddrList	     *list,
-					int		      entry_num,
-					const char	     *display_name,
-					const char	     *email);
+					gint		      entry_num,
+					const gchar	     *display_name,
+					const gchar	     *email);
 void         e2k_addr_list_free        (E2kAddrList	     *list);
 
 #ifdef __cplusplus
diff --git a/servers/exchange/lib/e2k-autoconfig.c b/servers/exchange/lib/e2k-autoconfig.c
index 9b552a0..b9a2cbd 100644
--- a/servers/exchange/lib/e2k-autoconfig.c
+++ b/servers/exchange/lib/e2k-autoconfig.c
@@ -1437,7 +1437,7 @@ read_config (void)
 	p = config_data;
 
 	while (1) {
-		for (name = p; isspace ((unsigned char)*name); name++)
+		for (name = p; isspace ((guchar)*name); name++)
 			;
 
 		p = strchr (name, ':');
diff --git a/servers/exchange/lib/e2k-global-catalog.c b/servers/exchange/lib/e2k-global-catalog.c
index c6983c6..4d51089 100644
--- a/servers/exchange/lib/e2k-global-catalog.c
+++ b/servers/exchange/lib/e2k-global-catalog.c
@@ -169,7 +169,7 @@ finalize (GObject *object)
 
 E2K_MAKE_TYPE (e2k_global_catalog, E2kGlobalCatalog, class_init, init, PARENT_TYPE)
 
-static int
+static gint
 gc_ldap_result (LDAP *ldap, E2kOperation *op,
 		gint msgid, LDAPMessage **msg)
 {
@@ -195,7 +195,7 @@ gc_ldap_result (LDAP *ldap, E2kOperation *op,
 		return LDAP_SUCCESS;
 }
 
-static int
+static gint
 gc_search (E2kGlobalCatalog *gc, E2kOperation *op,
 	   const gchar *base, gint scope, const gchar *filter,
 	   const gchar **attrs, LDAPMessage **msg)
@@ -228,7 +228,7 @@ gc_search (E2kGlobalCatalog *gc, E2kOperation *op,
 }
 
 #ifdef HAVE_LDAP_NTLM_BIND
-static int
+static gint
 ntlm_bind (E2kGlobalCatalog *gc, E2kOperation *op, LDAP *ldap)
 {
 	LDAPMessage *msg;
@@ -304,7 +304,7 @@ ntlm_bind (E2kGlobalCatalog *gc, E2kOperation *op, LDAP *ldap)
 }
 #endif
 
-static int
+static gint
 connect_ldap (E2kGlobalCatalog *gc, E2kOperation *op, LDAP *ldap)
 {
 	gint ldap_error;
@@ -363,7 +363,7 @@ connect_ldap (E2kGlobalCatalog *gc, E2kOperation *op, LDAP *ldap)
 	return ldap_error;
 }
 
-static int
+static gint
 get_ldap_connection (E2kGlobalCatalog *gc, E2kOperation *op,
 		     const gchar *server, gint port,
 		     LDAP **ldap)
@@ -396,7 +396,7 @@ get_ldap_connection (E2kGlobalCatalog *gc, E2kOperation *op,
 	return ldap_error;
 }
 
-static int
+static gint
 get_gc_connection (E2kGlobalCatalog *gc, E2kOperation *op)
 {
 	gint err;
@@ -1053,7 +1053,7 @@ find_domain_dn (gchar *domain)
 	return dn;
 }
 
-double
+gdouble
 lookup_passwd_max_age (E2kGlobalCatalog *gc, E2kOperation *op)
 {
 	gchar **values = NULL, *filter = NULL, *val=NULL;
@@ -1061,7 +1061,7 @@ lookup_passwd_max_age (E2kGlobalCatalog *gc, E2kOperation *op)
 	LDAP *ldap;
 	LDAPMessage *msg=NULL;
 	gint ldap_error, msgid;
-	double maxAge=0;
+	gdouble maxAge=0;
 	gchar *dn=NULL;
 
 	attrs[0] = "maxPwdAge";
diff --git a/servers/exchange/lib/e2k-global-catalog.h b/servers/exchange/lib/e2k-global-catalog.h
index f876d5a..ea0c1be 100644
--- a/servers/exchange/lib/e2k-global-catalog.h
+++ b/servers/exchange/lib/e2k-global-catalog.h
@@ -102,7 +102,7 @@ void             e2k_global_catalog_async_lookup (E2kGlobalCatalog *gc,
 						  E2kGlobalCatalogCallback callback,
 						  gpointer user_data);
 
-double		lookup_passwd_max_age (E2kGlobalCatalog *gc,
+gdouble		lookup_passwd_max_age (E2kGlobalCatalog *gc,
 				      E2kOperation *op);
 
 
diff --git a/servers/exchange/lib/e2k-properties.c b/servers/exchange/lib/e2k-properties.c
index 4e86047..9370e5d 100644
--- a/servers/exchange/lib/e2k-properties.c
+++ b/servers/exchange/lib/e2k-properties.c
@@ -722,7 +722,7 @@ e2k_prop_namespace_name (const gchar *prop)
  *
  * Return value: the abbreviation used for prop's namespace
  **/
-char
+gchar
 e2k_prop_namespace_abbrev (const gchar *prop)
 {
 	const gchar *div = get_div (prop);
diff --git a/servers/exchange/lib/e2k-properties.h b/servers/exchange/lib/e2k-properties.h
index d1878d1..b3dfd50 100644
--- a/servers/exchange/lib/e2k-properties.h
+++ b/servers/exchange/lib/e2k-properties.h
@@ -62,7 +62,7 @@ void           e2k_properties_set_bool          (E2kProperties *props,
 						 gboolean       value);
 void           e2k_properties_set_float         (E2kProperties *props,
 						 const gchar    *propname,
-						 float          value);
+						 gfloat          value);
 void           e2k_properties_set_date          (E2kProperties *props,
 						 const gchar    *propname,
 						 gchar          *value);
diff --git a/servers/exchange/lib/e2k-rule-xml.c b/servers/exchange/lib/e2k-rule-xml.c
index 83c823f..3cd3735 100644
--- a/servers/exchange/lib/e2k-rule-xml.c
+++ b/servers/exchange/lib/e2k-rule-xml.c
@@ -67,7 +67,7 @@ fuzzy_level_to_name (gint fuzzy_level, gboolean negated, const gchar *map[])
 
 static const gchar *is_types[] = { NULL, NULL, NULL, NULL, "is", "is not" };
 static const gchar *date_types[] = { "before", "before", "after", "after", NULL, NULL };
-static const gchar *size_types[] = { "less than", "less than", "greater than", "greater than", NULL, NULL };
+static const gchar *gsizeypes[] = { "less than", "less than", "greater than", "greater than", NULL, NULL };
 
 #if 0
 static gboolean
@@ -531,7 +531,7 @@ restriction_to_xml (E2kRestriction *rn, xmlNode *partset,
 				(xmlChar *) "type",
 				(xmlChar *) "1");
 
-			timestamp = g_strdup_printf ("%lu", (unsigned long)e2k_parse_timestamp (pv->value));
+			timestamp = g_strdup_printf ("%lu", (gulong)e2k_parse_timestamp (pv->value));
 			xmlSetProp (
 				node,
 				(xmlChar *) "value",
@@ -541,7 +541,7 @@ restriction_to_xml (E2kRestriction *rn, xmlNode *partset,
 		}
 
 		case E2K_PROPTAG_PR_MESSAGE_SIZE:
-			relation = relop_to_name (relop, negated, size_types);
+			relation = relop_to_name (relop, negated, gsizeypes);
 			if (!relation)
 				return FALSE;
 
diff --git a/servers/exchange/lib/e2k-security-descriptor.c b/servers/exchange/lib/e2k-security-descriptor.c
index 15f828b..0174be7 100644
--- a/servers/exchange/lib/e2k-security-descriptor.c
+++ b/servers/exchange/lib/e2k-security-descriptor.c
@@ -180,7 +180,7 @@ E2K_MAKE_TYPE (e2k_security_descriptor, E2kSecurityDescriptor, class_init, init,
 /* This determines the relative ordering of any two ACEs in a SID.
  * See docs/security for details.
  */
-static int
+static gint
 ace_compar (E2k_ACE *ace1, E2k_ACE *ace2, E2kSecurityDescriptor *sd)
 {
 	E2kSidType t1;
diff --git a/servers/exchange/lib/e2k-sid.c b/servers/exchange/lib/e2k-sid.c
index 7a95096..bf96e0c 100644
--- a/servers/exchange/lib/e2k-sid.c
+++ b/servers/exchange/lib/e2k-sid.c
@@ -204,7 +204,7 @@ e2k_sid_get_string_sid (E2kSid *sid)
 		/* Subauthorities. */
 		for (sa = 0; sa < sid->priv->binary_sid->SubAuthorityCount; sa++) {
 			g_string_append_printf (string, "-%lu",
-						(unsigned long) GUINT32_FROM_LE (sid->priv->binary_sid->SubAuthority[sa]));
+						(gulong) GUINT32_FROM_LE (sid->priv->binary_sid->SubAuthority[sa]));
 		}
 
 		sid->priv->string_sid = string->str;
diff --git a/servers/exchange/lib/e2k-uri.c b/servers/exchange/lib/e2k-uri.c
index d8c681f..4b584d3 100644
--- a/servers/exchange/lib/e2k-uri.c
+++ b/servers/exchange/lib/e2k-uri.c
@@ -55,7 +55,7 @@ e2k_uri_new (const gchar *uri_string)
 
 	/* Find protocol: initial [a-z+.-]* substring until ":" */
 	p = uri_string;
-	while (p < end && (isalnum ((unsigned char)*p) ||
+	while (p < end && (isalnum ((guchar)*p) ||
 			   *p == '.' || *p == '+' || *p == '-'))
 		p++;
 
@@ -306,7 +306,7 @@ e2k_uri_append_encoded (GString *str, const gchar *in,
 			break;
 		case 1:
 		escape:
-			g_string_append_printf (str, "%%%02x", (int)*s++);
+			g_string_append_printf (str, "%%%02x", (gint)*s++);
 			break;
 		default:
 			g_string_append_c (str, *s++);
diff --git a/servers/exchange/lib/e2k-utils.c b/servers/exchange/lib/e2k-utils.c
index 7dae116..bab34ce 100644
--- a/servers/exchange/lib/e2k-utils.c
+++ b/servers/exchange/lib/e2k-utils.c
@@ -376,7 +376,7 @@ append_entryid_section (GByteArray *entryid, const gchar **permanenturl)
 {
 	const gchar *p;
 	guint8 buf[44], byte;
-	int endlen;
+	gint endlen;
 
 	p = *permanenturl;
 	if (strspn (p, "0123456789abcdefABCDEF") != 32)
diff --git a/servers/exchange/lib/ebrowse.c b/servers/exchange/lib/ebrowse.c
index 60d5006..caa6e5d 100644
--- a/servers/exchange/lib/ebrowse.c
+++ b/servers/exchange/lib/ebrowse.c
@@ -120,7 +120,7 @@ list_contents (E2kContext *ctx, gchar *top, gboolean reverse)
 	test_quit ();
 }
 
-static int
+static gint
 mp_compar (gconstpointer k, gconstpointer m)
 {
 	const gchar *key = k;
@@ -171,7 +171,7 @@ typedef struct {
 	gpointer value;
 } EBrowseProp;
 
-static int
+static gint
 prop_compar (gconstpointer a, gconstpointer b)
 {
 	EBrowseProp **pa = (gpointer)a;
@@ -431,7 +431,7 @@ get_sd (E2kContext *ctx, gchar *uri)
 		printf ("%s: %s (0x%lx)\n",
 			e2k_sid_get_display_name (sid),
 			e2k_permissions_role_get_name (role),
-			(unsigned long)perms);
+			(gulong)perms);
 	}
 	g_list_free (sids);
 
diff --git a/servers/exchange/lib/gctest.c b/servers/exchange/lib/gctest.c
index 750e10e..bd3d0b0 100644
--- a/servers/exchange/lib/gctest.c
+++ b/servers/exchange/lib/gctest.c
@@ -44,7 +44,7 @@ do_lookup (E2kGlobalCatalog *gc, const gchar *user)
 	E2kGlobalCatalogLookupType type;
 	guint32 flags;
 	gint i, pwd_exp_days;
-	double maxAge;
+	gdouble maxAge;
 
 	if (*user == '/')
 		type = E2K_GLOBAL_CATALOG_LOOKUP_BY_LEGACY_EXCHANGE_DN;
@@ -121,7 +121,7 @@ do_lookup (E2kGlobalCatalog *gc, const gchar *user)
 
 	maxAge = lookup_passwd_max_age (gc, &op);
 	printf("Password max age is %f \n", maxAge);
-	pwd_exp_days = (maxAge * 0.000000100)/86400 ;
+	pwd_exp_days = (maxAge * 0.000000100)/86400;
 	printf("Password expiery period is %d \n", pwd_exp_days);
 
 	e2k_operation_free (&op);
diff --git a/servers/exchange/storage/e-folder-exchange.c b/servers/exchange/storage/e-folder-exchange.c
index 92fda14..03f8afb 100644
--- a/servers/exchange/storage/e-folder-exchange.c
+++ b/servers/exchange/storage/e-folder-exchange.c
@@ -312,7 +312,7 @@ e_folder_exchange_set_permanent_uri (EFolder *folder, const gchar *permanent_uri
  *
  * Return value: @folder's size
  **/
-long long int
+gint64
 e_folder_exchange_get_folder_size (EFolder *folder)
 {
 	g_return_val_if_fail (E_IS_FOLDER_EXCHANGE (folder), -1);
diff --git a/servers/exchange/storage/e-folder-exchange.h b/servers/exchange/storage/e-folder-exchange.h
index 6b5e968..7cb61d2 100644
--- a/servers/exchange/storage/e-folder-exchange.h
+++ b/servers/exchange/storage/e-folder-exchange.h
@@ -55,7 +55,7 @@ const gchar *e_folder_exchange_get_permanent_uri    (EFolder    *folder);
 void        e_folder_exchange_set_permanent_uri    (EFolder    *folder,
 						    const gchar *permanent_uri);
 
-long long int	e_folder_exchange_get_folder_size (EFolder *folder);
+gint64	e_folder_exchange_get_folder_size (EFolder *folder);
 void		e_folder_exchange_set_folder_size (EFolder *folder, gint64 folder_size);
 
 gboolean    e_folder_exchange_get_has_subfolders   (EFolder    *folder);
diff --git a/servers/exchange/storage/exchange-account.c b/servers/exchange/storage/exchange-account.c
index 3aed5f0..a973c77 100644
--- a/servers/exchange/storage/exchange-account.c
+++ b/servers/exchange/storage/exchange-account.c
@@ -1041,10 +1041,10 @@ is_password_expired (ExchangeAccount *account, E2kAutoconfig *ac)
 }
 #endif
 
-static int
+static gint
 find_passwd_exp_period (ExchangeAccount *account, E2kGlobalCatalogEntry *entry)
 {
-	double max_pwd_age = 0;
+	gdouble max_pwd_age = 0;
 	gint max_pwd_age_days;
 	E2kOperation gcop;
 	E2kGlobalCatalogStatus gcstatus;
@@ -1922,7 +1922,7 @@ exchange_account_get_folder (ExchangeAccount *account,
 	return folder;
 }
 
-static int
+static gint
 folder_comparator (gconstpointer a, gconstpointer b)
 {
 	EFolder **fa = (EFolder **)a;
@@ -2048,7 +2048,7 @@ exchange_account_get_folder_tree (ExchangeAccount *account, gchar * path)
  *
  * Return the value of the quota limit reached.
  *
- * Return value: an int
+ * Return value: an gint
  **/
 gint
 exchange_account_get_quota_limit (ExchangeAccount *account)
diff --git a/servers/exchange/storage/exchange-account.h b/servers/exchange/storage/exchange-account.h
index d07abc6..4ef7467 100644
--- a/servers/exchange/storage/exchange-account.h
+++ b/servers/exchange/storage/exchange-account.h
@@ -94,7 +94,7 @@ gchar                  *exchange_account_get_foreign_uri      (ExchangeAccount
 							      const gchar       *std_uri_prop);
 ExchangeHierarchy     *exchange_account_get_hierarchy_by_email (ExchangeAccount *account, const gchar *email);
 
-char		      *exchange_account_get_authtype	     (ExchangeAccount *account);
+gchar		      *exchange_account_get_authtype	     (ExchangeAccount *account);
 
 E2kContext            *exchange_account_connect              (ExchangeAccount  *acct,
 							      const gchar *pword,
@@ -111,7 +111,7 @@ ExchangeHierarchy     *exchange_account_get_hierarchy_by_type	      (ExchangeAcc
 
 void                   exchange_account_rescan_tree          (ExchangeAccount  *acct);
 
-char		      *exchange_account_get_password	     (ExchangeAccount  *acct);
+gchar		      *exchange_account_get_password	     (ExchangeAccount  *acct);
 
 ExchangeAccountResult exchange_account_set_password	     (ExchangeAccount  *acct,
 							      gchar             *old_password,
diff --git a/servers/exchange/storage/exchange-esource.c b/servers/exchange/storage/exchange-esource.c
index 3fee5ca..444ccb6 100644
--- a/servers/exchange/storage/exchange-esource.c
+++ b/servers/exchange/storage/exchange-esource.c
@@ -324,7 +324,7 @@ remove_folder_esource (ExchangeAccount *account,
 	groups = e_source_list_peek_groups (source_list);
 	found_group = FALSE;
 
-	for ( ; groups != NULL && !found_group; groups = g_slist_next (groups)) {
+	for (; groups != NULL && !found_group; groups = g_slist_next (groups)) {
 		group = E_SOURCE_GROUP (groups->data);
 
 		if (strcmp (e_source_group_peek_name (group), account->account_name) == 0
@@ -333,7 +333,7 @@ remove_folder_esource (ExchangeAccount *account,
 
 			sources = e_source_group_peek_sources (group);
 
-			for( ; sources != NULL; sources = g_slist_next (sources)) {
+			for(; sources != NULL; sources = g_slist_next (sources)) {
 
 				source = E_SOURCE (sources->data);
 				read_uri = e_source_get_uri (source);
diff --git a/servers/exchange/storage/exchange-folder-size.c b/servers/exchange/storage/exchange-folder-size.c
index 6f11c4e..b0c7b75 100644
--- a/servers/exchange/storage/exchange-folder-size.c
+++ b/servers/exchange/storage/exchange-folder-size.c
@@ -57,7 +57,7 @@ enum {
 };
 
 static gboolean
-free_fsize_table (gpointer key, gpointer value, gpointer data)
+free_fgsizeable (gpointer key, gpointer value, gpointer data)
 {
 	folder_info *f_info = (folder_info *) value;
 
@@ -80,7 +80,7 @@ finalize (GObject *object)
 {
 	ExchangeFolderSize *fsize = EXCHANGE_FOLDER_SIZE (object);
 
-	g_hash_table_foreach_remove (fsize->priv->table, free_fsize_table, NULL);
+	g_hash_table_foreach_remove (fsize->priv->table, free_fgsizeable, NULL);
 	g_hash_table_destroy (fsize->priv->table);
 	g_hash_table_foreach_remove (fsize->priv->row_refs, free_row_refs, NULL);
 	g_hash_table_destroy (fsize->priv->row_refs);
@@ -142,7 +142,7 @@ exchange_folder_size_update (ExchangeFolderSize *fsize,
 {
 	folder_info *f_info, *cached_info;
 	ExchangeFolderSizePrivate *priv;
-	GHashTable *folder_size_table;
+	GHashTable *folder_gsizeable;
 	GtkTreeRowReference *row;
 	GtkTreeIter iter;
 	GtkTreePath *path;
@@ -150,9 +150,9 @@ exchange_folder_size_update (ExchangeFolderSize *fsize,
 	g_return_if_fail (EXCHANGE_IS_FOLDER_SIZE (fsize));
 
 	priv = fsize->priv;
-	folder_size_table = priv->table;
+	folder_gsizeable = priv->table;
 
-	cached_info = g_hash_table_lookup (folder_size_table, folder_name);
+	cached_info = g_hash_table_lookup (folder_gsizeable, folder_name);
 	if (cached_info) {
 		if (cached_info->folder_size == folder_size) {
 			return;
@@ -173,7 +173,7 @@ exchange_folder_size_update (ExchangeFolderSize *fsize,
 		f_info = g_new0(folder_info, 1);
 		f_info->folder_name = g_strdup (folder_name);
 		f_info->folder_size = folder_size;
-		g_hash_table_insert (folder_size_table, f_info->folder_name, f_info);
+		g_hash_table_insert (folder_gsizeable, f_info->folder_name, f_info);
 
 		gtk_list_store_append (fsize->priv->model, &iter);
 		gtk_list_store_set (fsize->priv->model, &iter,
@@ -194,7 +194,7 @@ exchange_folder_size_remove (ExchangeFolderSize *fsize,
 				const gchar *folder_name)
 {
 	ExchangeFolderSizePrivate *priv;
-	GHashTable *folder_size_table;
+	GHashTable *folder_gsizeable;
 	folder_info *cached_info;
 	GtkTreeRowReference *row;
 	GtkTreeIter iter;
@@ -204,13 +204,13 @@ exchange_folder_size_remove (ExchangeFolderSize *fsize,
 	g_return_if_fail (folder_name != NULL);
 
 	priv = fsize->priv;
-	folder_size_table = priv->table;
+	folder_gsizeable = priv->table;
 
-	cached_info = g_hash_table_lookup (folder_size_table, folder_name);
+	cached_info = g_hash_table_lookup (folder_gsizeable, folder_name);
 	if (cached_info)  {
 		row = g_hash_table_lookup (priv->row_refs, folder_name);
 		path = gtk_tree_row_reference_get_path (row);
-		g_hash_table_remove (folder_size_table, folder_name);
+		g_hash_table_remove (folder_gsizeable, folder_name);
 		if (gtk_tree_model_get_iter (GTK_TREE_MODEL (fsize->priv->model), &iter, path)) {
 			gtk_list_store_remove (fsize->priv->model, &iter);
 		}
@@ -224,15 +224,15 @@ exchange_folder_size_get (ExchangeFolderSize *fsize,
 			  const gchar *folder_name)
 {
 	ExchangeFolderSizePrivate *priv;
-	GHashTable *folder_size_table;
+	GHashTable *folder_gsizeable;
 	folder_info *cached_info;
 
 	g_return_val_if_fail (EXCHANGE_IS_FOLDER_SIZE (fsize), -1);
 
 	priv = fsize->priv;
-	folder_size_table = priv->table;
+	folder_gsizeable = priv->table;
 
-	cached_info = g_hash_table_lookup (folder_size_table, folder_name);
+	cached_info = g_hash_table_lookup (folder_gsizeable, folder_name);
 	if (cached_info)  {
 		return cached_info->folder_size;
 	}
diff --git a/servers/exchange/storage/exchange-hierarchy-foreign.c b/servers/exchange/storage/exchange-hierarchy-foreign.c
index bd12f5e..b0bfb76 100644
--- a/servers/exchange/storage/exchange-hierarchy-foreign.c
+++ b/servers/exchange/storage/exchange-hierarchy-foreign.c
@@ -534,14 +534,14 @@ exchange_hierarchy_foreign_new (ExchangeAccount *account,
 				      source_uri);
 
 	props = g_hash_table_new (g_str_hash, g_str_equal);
-	g_hash_table_insert (props, (gpointer) "name", (char *)hierarchy_name);
+	g_hash_table_insert (props, (gpointer) "name", (gchar *)hierarchy_name);
 	g_hash_table_insert (props, (gpointer) "physical_uri_prefix",
-			     (char *)physical_uri_prefix);
+			     (gchar *)physical_uri_prefix);
 	g_hash_table_insert (props, (gpointer) "internal_uri_prefix",
-			     (char *)internal_uri_prefix);
-	g_hash_table_insert (props, (gpointer) "owner_name", (char *)owner_name);
-	g_hash_table_insert (props, (gpointer) "owner_email", (char *)owner_email);
-	g_hash_table_insert (props, (gpointer) "source_uri", (char *)source_uri);
+			     (gchar *)internal_uri_prefix);
+	g_hash_table_insert (props, (gpointer) "owner_name", (gchar *)owner_name);
+	g_hash_table_insert (props, (gpointer) "owner_email", (gchar *)owner_email);
+	g_hash_table_insert (props, (gpointer) "source_uri", (gchar *)source_uri);
 
 	mf_path = e_folder_exchange_get_storage_file (hier->toplevel, "hierarchy.xml");
 	doc = e_xml_from_hash (props, E_XML_HASH_TYPE_PROPERTY,
diff --git a/servers/exchange/storage/exchange-hierarchy-webdav.c b/servers/exchange/storage/exchange-hierarchy-webdav.c
index 61c3eb9..3915d1f 100644
--- a/servers/exchange/storage/exchange-hierarchy-webdav.c
+++ b/servers/exchange/storage/exchange-hierarchy-webdav.c
@@ -181,7 +181,7 @@ static void
 hierarchy_new_folder (ExchangeHierarchy *hier, EFolder *folder,
 		      gpointer user_data)
 {
-	const gchar *internal_uri ;
+	const gchar *internal_uri;
 	gchar *mf_path;
 
 	g_return_if_fail (E_IS_FOLDER (folder));
@@ -768,7 +768,7 @@ scan_subtree (ExchangeHierarchy *hier, EFolder *parent, gint mode)
 							       E2K_PR_EXCHANGE_FOLDER_SIZE);
 
 			/* FIXME : Find a better way of doing this */
-			fsize_d = g_ascii_strtod (folder_size, NULL)/1024 ;
+			fsize_d = g_ascii_strtod (folder_size, NULL)/1024;
 			exchange_account_folder_size_add (hier->account, name, fsize_d);
 		}
 
diff --git a/servers/exchange/storage/exchange-hierarchy.h b/servers/exchange/storage/exchange-hierarchy.h
index 6c9b3d7..cae9e79 100644
--- a/servers/exchange/storage/exchange-hierarchy.h
+++ b/servers/exchange/storage/exchange-hierarchy.h
@@ -85,7 +85,7 @@ void                        exchange_hierarchy_add_to_storage (ExchangeHierarchy
 void                        exchange_hierarchy_rescan         (ExchangeHierarchy *hier);
 ExchangeAccountFolderResult exchange_hierarchy_scan_subtree   (ExchangeHierarchy *hier,
 							       EFolder           *folder,
-							       int		  mode);
+							       gint		  mode);
 
 ExchangeAccountFolderResult exchange_hierarchy_create_folder (ExchangeHierarchy *hier,
 							      EFolder           *parent,
diff --git a/servers/exchange/xntlm/xntlm.c b/servers/exchange/xntlm/xntlm.c
index 7fc8a94..0bf422f 100644
--- a/servers/exchange/xntlm/xntlm.c
+++ b/servers/exchange/xntlm/xntlm.c
@@ -65,7 +65,7 @@ strip_dup (guchar *mem, gint len)
 	gchar *buf = g_malloc (len / 2 + 1), *p = buf;
 
 	while (len > 0) {
-		*p = (char)*mem;
+		*p = (gchar)*mem;
 		p++;
 		mem += 2;
 		len -= 2;
@@ -238,7 +238,7 @@ setup_schedule (const guchar *key_56, XNTLM_DES_KS ks)
 	guchar key[8];
 	gint i, c, bit;
 
-	key[0] = (key_56[0])                                 ;
+	key[0] = (key_56[0]);
 	key[1] = (key_56[1] >> 1) | ((key_56[0] << 7) & 0xFF);
 	key[2] = (key_56[2] >> 2) | ((key_56[1] << 6) & 0xFF);
 	key[3] = (key_56[3] >> 3) | ((key_56[2] << 5) & 0xFF);
@@ -273,7 +273,7 @@ ntlm_lanmanager_hash (const gchar *password, gchar hash[21])
 	guint i;
 
 	for (i = 0; i < 14 && password [i]; i++)
-		lm_password [i] = toupper ((unsigned char) password [i]);
+		lm_password [i] = toupper ((guchar) password [i]);
 
 	for (; i < sizeof (lm_password); i++)
 		lm_password [i] = '\0';
diff --git a/servers/groupwise/e-gw-connection.c b/servers/groupwise/e-gw-connection.c
index 3ec7fce..ae41722 100644
--- a/servers/groupwise/e-gw-connection.c
+++ b/servers/groupwise/e-gw-connection.c
@@ -55,7 +55,7 @@ struct _EGwConnectionPrivate {
 	gchar *user_email;
 	gchar *user_uuid;
 	gchar *version;
-	gchar *server_time ;
+	gchar *server_time;
 	GHashTable *categories_by_name;
 	GHashTable *categories_by_id;
 	GList *book_list;
@@ -373,13 +373,13 @@ e_gw_connection_dispose (GObject *object)
 		}
 
 		if (priv->version) {
-			g_free (priv->version) ;
-			priv->opts = NULL ;
+			g_free (priv->version);
+			priv->opts = NULL;
 		}
 
 		if (priv->server_time) {
-			g_free (priv->server_time) ;
-			priv->server_time = NULL ;
+			g_free (priv->server_time);
+			priv->server_time = NULL;
 		}
 
 		if (priv->proxy) {
@@ -1477,7 +1477,7 @@ e_gw_connection_get_item (EGwConnection *cnc, const gchar *container, const gcha
 	e_gw_message_write_string_parameter (msg, "id", NULL, id);
 
 	if (view)
-		e_gw_message_write_string_parameter (msg, "view", NULL, view) ;
+		e_gw_message_write_string_parameter (msg, "view", NULL, view);
 	e_gw_message_write_footer (msg);
 
         /* send message to server */
@@ -1808,9 +1808,9 @@ e_gw_connection_get_user_uuid (EGwConnection *cnc)
 const gchar *
 e_gw_connection_get_server_time (EGwConnection *cnc)
 {
-	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL) ;
+	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
 
-	return (const gchar *) cnc->priv->server_time ;
+	return (const gchar *) cnc->priv->server_time;
 }
 
 gchar *
@@ -2400,7 +2400,7 @@ e_gw_connection_create_cursor (EGwConnection *cnc, const gchar *container, const
                 return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
         }
 
-	*cursor =(int) g_ascii_strtod (value, NULL);
+	*cursor =(gint) g_ascii_strtod (value, NULL);
 
 	g_free (value);
 	g_object_unref (response);
@@ -2659,7 +2659,7 @@ e_gw_connection_create_folder(EGwConnection *cnc, const gchar *parent_name,const
 {
 	SoupSoapMessage *msg;
 	SoupSoapResponse *response;
-	SoupSoapParameter *param ;
+	SoupSoapParameter *param;
 	EGwConnectionStatus status = E_GW_CONNECTION_STATUS_UNKNOWN;
 
 	msg = e_gw_message_new_with_header (e_gw_connection_get_uri (cnc), e_gw_connection_get_session_id(cnc), "createItemRequest");
@@ -2687,12 +2687,12 @@ e_gw_connection_create_folder(EGwConnection *cnc, const gchar *parent_name,const
                 g_object_unref (msg);
 		return status;
 	} else {
-		param = soup_soap_response_get_first_parameter_by_name (response, "id") ;
-		*container_id = soup_soap_parameter_get_string_value(param) ;
-		printf ("CONTAINER ID %s \n", *container_id) ;
+		param = soup_soap_response_get_first_parameter_by_name (response, "id");
+		*container_id = soup_soap_parameter_get_string_value(param);
+		printf ("CONTAINER ID %s \n", *container_id);
 	}
 
-	return status ;
+	return status;
 
 }
 
@@ -2706,8 +2706,8 @@ e_gw_connection_get_attachment (EGwConnection *cnc, const gchar *id, gint offset
 	SoupSoapMessage *msg;
         SoupSoapResponse *response;
         EGwConnectionStatus status;
-	SoupSoapParameter *param ;
-	gchar *buffer = NULL, *buf_length = NULL ;
+	SoupSoapParameter *param;
+	gchar *buffer = NULL, *buf_length = NULL;
 
         g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
 
@@ -2742,24 +2742,24 @@ e_gw_connection_get_attachment (EGwConnection *cnc, const gchar *id, gint offset
 	}
 
 
-	param = soup_soap_response_get_first_parameter_by_name (response, "part") ;
+	param = soup_soap_response_get_first_parameter_by_name (response, "part");
 	if (param) {
-		buf_length =  soup_soap_parameter_get_property (param, "length") ;
-		buffer = soup_soap_parameter_get_string_value (param) ;
+		buf_length =  soup_soap_parameter_get_property (param, "length");
+		buffer = soup_soap_parameter_get_string_value (param);
 	}
 
 	if (buffer && buf_length && atoi (buf_length) > 0) {
-		gsize len = atoi (buf_length) ;
-		*attachment = (gchar *) g_base64_decode (buffer,&len) ;
-		*attach_length = len ;
+		gsize len = atoi (buf_length);
+		*attachment = (gchar *) g_base64_decode (buffer,&len);
+		*attach_length = len;
 	} else {
 		*attachment = NULL;
 		*attach_length = 0;
 	}
 
 	/* free memory */
-	g_free (buffer) ;
-	g_free (buf_length) ;
+	g_free (buffer);
+	g_free (buf_length);
         g_object_unref (response);
 	g_object_unref (msg);
 
@@ -2776,7 +2776,7 @@ e_gw_connection_get_attachment_base64 (EGwConnection *cnc, const gchar *id, gint
 	SoupSoapMessage *msg;
         SoupSoapResponse *response;
         EGwConnectionStatus status;
-	SoupSoapParameter *param ;
+	SoupSoapParameter *param;
 	gchar *buffer = NULL, *buf_length = NULL, *o_return = NULL;
 
         g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
@@ -2812,15 +2812,15 @@ e_gw_connection_get_attachment_base64 (EGwConnection *cnc, const gchar *id, gint
 	}
 
 
-	param = soup_soap_response_get_first_parameter_by_name (response, "part") ;
+	param = soup_soap_response_get_first_parameter_by_name (response, "part");
 	if (param) {
-		buf_length =  soup_soap_parameter_get_property (param, "length") ;
-		o_return =  soup_soap_parameter_get_property (param, "offset") ;
-		buffer = soup_soap_parameter_get_string_value (param) ;
+		buf_length =  soup_soap_parameter_get_property (param, "length");
+		o_return =  soup_soap_parameter_get_property (param, "offset");
+		buffer = soup_soap_parameter_get_string_value (param);
 	}
 
 	if (buffer && buf_length && atoi (buf_length) > 0) {
-		gint len = atoi (buf_length) ;
+		gint len = atoi (buf_length);
 		*attachment = g_strdup (buffer);
 		*attach_length = len;
 		if (len && o_return)
@@ -2834,8 +2834,8 @@ e_gw_connection_get_attachment_base64 (EGwConnection *cnc, const gchar *id, gint
 	}
 
 	/* free memory */
-	g_free (buffer) ;
-	g_free (buf_length) ;
+	g_free (buffer);
+	g_free (buf_length);
 	g_free (o_return);
         g_object_unref (response);
 	g_object_unref (msg);
@@ -2939,8 +2939,8 @@ e_gw_connection_rename_folder (EGwConnection *cnc, const gchar *id ,const gchar
 	soup_soap_message_start_element (msg, "updates", NULL, NULL);
 	soup_soap_message_start_element (msg, "update", NULL, NULL);
 	e_gw_message_write_string_parameter (msg, "name", NULL, new_name);
-	soup_soap_message_end_element (msg) ;
-	soup_soap_message_end_element (msg) ;
+	soup_soap_message_end_element (msg);
+	soup_soap_message_end_element (msg);
 
 	e_gw_message_write_footer (msg);
 
@@ -3211,7 +3211,7 @@ e_gw_connection_reply_item (EGwConnection *cnc, const gchar *id, const gchar *vi
 	e_gw_message_write_string_parameter (msg, "id", NULL, id);
 
 	if (view)
-		e_gw_message_write_string_parameter (msg, "view", NULL, view) ;
+		e_gw_message_write_string_parameter (msg, "view", NULL, view);
 	e_gw_message_write_footer (msg);
 
 	/* send message to server */
@@ -3270,7 +3270,7 @@ e_gw_connection_forward_item (EGwConnection *cnc, const gchar *id, const gchar *
 	e_gw_message_write_string_parameter (msg, "id", NULL, id);
 
 	if (view)
-		e_gw_message_write_string_parameter (msg, "view", NULL, view) ;
+		e_gw_message_write_string_parameter (msg, "view", NULL, view);
 
 	if (embed)
 		e_gw_message_write_int_parameter (msg, "embed", NULL,1);
@@ -3365,7 +3365,7 @@ parse_junk_settings (SoupSoapParameter *param, gint *use_junk, gint *use_block,
 	SoupSoapParameter *subparam, *field_param, *val_param;
 
 	if (param == NULL)
-		return ;
+		return;
 	else	{
 		/* parse these parameters into junk settings*/
 		for (subparam = soup_soap_parameter_get_first_child_by_name (param, "setting");
@@ -3456,7 +3456,7 @@ e_gw_connection_get_junk_settings (EGwConnection *cnc, gint *use_junk, gint *use
 }
 
 static void
-msg_add_settings (SoupSoapMessage *msg, const gchar *field, int value)
+msg_add_settings (SoupSoapMessage *msg, const gchar *field, gint value)
 {
 	soup_soap_message_start_element (msg, "setting", NULL, NULL);
 	e_gw_message_write_string_parameter (msg, "field", NULL, field);
diff --git a/servers/groupwise/e-gw-connection.h b/servers/groupwise/e-gw-connection.h
index 7744763..0ac9c81 100644
--- a/servers/groupwise/e-gw-connection.h
+++ b/servers/groupwise/e-gw-connection.h
@@ -61,7 +61,7 @@ struct _EGwConnectionClass {
 
 /* TODO:This has to go either in a generic file or specific to junk*/
 typedef struct {
-	gchar *id ;
+	gchar *id;
 	gchar *match;
 	gchar *matchType;
 	gchar *lastUsed;
@@ -120,8 +120,8 @@ const gchar         *e_gw_connection_get_session_id (EGwConnection *cnc);
 const gchar         *e_gw_connection_get_user_name (EGwConnection *cnc);
 const gchar         *e_gw_connection_get_user_email (EGwConnection *cnc);
 const gchar         *e_gw_connection_get_user_uuid (EGwConnection *cnc);
-const char	   *e_gw_connection_get_version (EGwConnection *cnc);
-const char	   *e_gw_connection_get_server_time (EGwConnection *cnc) ;
+const gchar	   *e_gw_connection_get_version (EGwConnection *cnc);
+const gchar	   *e_gw_connection_get_server_time (EGwConnection *cnc);
 
 
 time_t              e_gw_connection_get_date_from_string (const gchar *dtstring);
@@ -152,14 +152,14 @@ EGwConnectionStatus e_gw_connection_position_cursor (EGwConnection *cnc, const g
 
 EGwConnectionStatus e_gw_connection_get_quick_messages (EGwConnection *cnc, const gchar *container, const gchar *view, gchar **start_date, const gchar *message_list, const gchar *item_types, const gchar *item_sources, gint count, GSList **item_list);
 
-EGwConnectionStatus e_gw_connection_create_folder(EGwConnection *cnc, const gchar *parent_name,const gchar *folder_name, gchar **container_id) ;
+EGwConnectionStatus e_gw_connection_create_folder(EGwConnection *cnc, const gchar *parent_name,const gchar *folder_name, gchar **container_id);
 EGwConnectionStatus
-e_gw_connection_get_attachment (EGwConnection *cnc, const gchar *id, gint offset, gint length, const gchar **attachment, gint *attach_length) ;
+e_gw_connection_get_attachment (EGwConnection *cnc, const gchar *id, gint offset, gint length, const gchar **attachment, gint *attach_length);
 EGwConnectionStatus e_gw_connection_get_attachment_base64 (EGwConnection *cnc, const gchar *id, gint offset, gint length, const gchar **attachment, gint *attach_length, gint *offset_r);
-EGwConnectionStatus e_gw_connection_add_item (EGwConnection *cnc, const gchar *container, const gchar *id) ;
-EGwConnectionStatus e_gw_connection_add_items (EGwConnection *cnc, const gchar *container, GList *item_ids) ;
+EGwConnectionStatus e_gw_connection_add_item (EGwConnection *cnc, const gchar *container, const gchar *id);
+EGwConnectionStatus e_gw_connection_add_items (EGwConnection *cnc, const gchar *container, GList *item_ids);
 EGwConnectionStatus e_gw_connection_move_item (EGwConnection *cnc, const gchar *id, const gchar *dest_container_id, const gchar *from_container_id);
-EGwConnectionStatus e_gw_connection_rename_folder (EGwConnection *cnc, const gchar *id ,const gchar *new_name) ;
+EGwConnectionStatus e_gw_connection_rename_folder (EGwConnection *cnc, const gchar *id ,const gchar *new_name);
 EGwConnectionStatus e_gw_connection_get_settings (EGwConnection *cnc, EGwSendOptions **opts);
 EGwConnectionStatus e_gw_connection_modify_settings (EGwConnection *cnc, EGwSendOptions *opts);
 EGwConnectionStatus e_gw_connection_share_folder (EGwConnection *cnc, gchar *id, GList *new_list, const gchar *sub, const gchar *mesg ,int flag);
@@ -167,9 +167,9 @@ EGwConnectionStatus e_gw_connection_accept_shared_folder (EGwConnection *cnc, gc
 EGwConnectionStatus e_gw_connection_purge_deleted_items (EGwConnection *cnc);
 EGwConnectionStatus e_gw_connection_purge_selected_items (EGwConnection *cnc, GList *item_ids);
 
-EGwConnectionStatus e_gw_connection_mark_read(EGwConnection *cnc, GList *item_ids) ;
-EGwConnectionStatus e_gw_connection_mark_unread(EGwConnection *cnc, GList *item_ids) ;
-EGwConnectionStatus e_gw_connection_reply_item (EGwConnection *cnc, const gchar *id, const gchar *view, EGwItem **item) ;
+EGwConnectionStatus e_gw_connection_mark_read(EGwConnection *cnc, GList *item_ids);
+EGwConnectionStatus e_gw_connection_mark_unread(EGwConnection *cnc, GList *item_ids);
+EGwConnectionStatus e_gw_connection_reply_item (EGwConnection *cnc, const gchar *id, const gchar *view, EGwItem **item);
 EGwConnectionStatus e_gw_connection_forward_item (EGwConnection *cnc, const gchar *id, const gchar *view, gboolean embed, EGwItem **item);
 EGwConnectionStatus e_gw_connection_create_junk_entry (EGwConnection *cnc, const gchar *value, const gchar *match_type , const gchar *list_type);
 EGwConnectionStatus e_gw_connection_get_junk_settings (EGwConnection *cnc, gint *use_junk, gint *use_block, gint *use_pab,  gint *persistence);
diff --git a/servers/groupwise/e-gw-container.c b/servers/groupwise/e-gw-container.c
index 4d2a911..981976f 100644
--- a/servers/groupwise/e-gw-container.c
+++ b/servers/groupwise/e-gw-container.c
@@ -32,14 +32,14 @@ struct _EGwContainerPrivate {
 	gchar *name;
 	gchar *id;
 	gchar *parent;
-	guint32 unread ;
-	guint32 total ;
+	guint32 unread;
+	guint32 total;
 	gint sequence;
 	gchar *owner;
 	GList *user_list;
 	gchar *modified;
-	EGwContainerType type ;
-	gboolean is_root ;
+	EGwContainerType type;
+	gboolean is_root;
 	gboolean is_writable;
 	gboolean is_frequent_contacts; /*indicates  whether this folder is frequent contacts or not */
 	gboolean is_shared_by_me;
@@ -62,7 +62,7 @@ free_node(EShUsers *user)
 		g_free (user->email);
 		g_free (user);
 	}
-	return ;
+	return;
 }
 
 static void
@@ -229,37 +229,37 @@ e_gw_container_set_from_soap_parameter (EGwContainer *container, SoupSoapParamet
 	subparam = soup_soap_parameter_get_first_child_by_name (param, "parent");
 	if (!subparam) {
 		e_gw_container_set_parent_id (container, "");
-		container->priv->is_root = TRUE ;
+		container->priv->is_root = TRUE;
 	} else {
 
 		value = soup_soap_parameter_get_string_value (subparam);
 		e_gw_container_set_parent_id (container, (const gchar *) value);
-		g_free (value) ;
+		g_free (value);
 	}
 
 	/*retrieve the folder type*/
-	subparam = soup_soap_parameter_get_first_child_by_name (param, "folderType") ;
+	subparam = soup_soap_parameter_get_first_child_by_name (param, "folderType");
 	if (!subparam)
-		container->priv->type = E_GW_CONTAINER_TYPE_FOLDER ;
+		container->priv->type = E_GW_CONTAINER_TYPE_FOLDER;
 	else {
 		value = soup_soap_parameter_get_string_value (subparam);
 		if (!strcmp (value, "Root"))
-			container->priv->type = E_GW_CONTAINER_TYPE_ROOT ;
+			container->priv->type = E_GW_CONTAINER_TYPE_ROOT;
 		else if (!strcmp (value, "Mailbox"))
-			container->priv->type = E_GW_CONTAINER_TYPE_INBOX ;
+			container->priv->type = E_GW_CONTAINER_TYPE_INBOX;
 		else if (!strcmp (value, "SentItems"))
 			container->priv->type = E_GW_CONTAINER_TYPE_SENT;
 		else if (!strcmp (value, "Calendar"))
-			container->priv->type = E_GW_CONTAINER_TYPE_CALENDAR ;
+			container->priv->type = E_GW_CONTAINER_TYPE_CALENDAR;
 		else if (!strcmp (value, "Contacts"))
-			container->priv->type = E_GW_CONTAINER_TYPE_CONTACTS ;
+			container->priv->type = E_GW_CONTAINER_TYPE_CONTACTS;
 		else if (!strcmp (value, "Draft"))
-			container->priv->type = E_GW_CONTAINER_TYPE_DRAFT ;
+			container->priv->type = E_GW_CONTAINER_TYPE_DRAFT;
 		else if (!strcmp (value, "Trash"))
-			container->priv->type = E_GW_CONTAINER_TYPE_TRASH ;
+			container->priv->type = E_GW_CONTAINER_TYPE_TRASH;
 		else if (!strcmp (value, "JunkMail"))
 			container->priv->type = E_GW_CONTAINER_TYPE_JUNK;
-		g_free (value) ;
+		g_free (value);
 	}
 
 	subparam = soup_soap_parameter_get_first_child_by_name (param, "isSystemFolder");
@@ -272,28 +272,28 @@ e_gw_container_set_from_soap_parameter (EGwContainer *container, SoupSoapParamet
 
 
 	/* retrive the unread and total count */
-	subparam = soup_soap_parameter_get_first_child_by_name (param, "hasUnread") ;
+	subparam = soup_soap_parameter_get_first_child_by_name (param, "hasUnread");
 	if (!subparam) {
-		container->priv->unread = 0 ;
+		container->priv->unread = 0;
 	} else {
-		subparam = soup_soap_parameter_get_first_child_by_name (param, "unreadCount") ;
+		subparam = soup_soap_parameter_get_first_child_by_name (param, "unreadCount");
 		if (subparam) {
-			value = soup_soap_parameter_get_string_value (subparam) ;
+			value = soup_soap_parameter_get_string_value (subparam);
 			if (value)
-				container->priv->unread = atoi(value) ;
+				container->priv->unread = atoi(value);
 			else
-				container->priv->unread = 0 ; /*XXX:should it be 0?*/
+				container->priv->unread = 0; /*XXX:should it be 0?*/
 
-			g_free (value) ;
+			g_free (value);
 		}
 	}
 
-	subparam = soup_soap_parameter_get_first_child_by_name (param, "count") ;
+	subparam = soup_soap_parameter_get_first_child_by_name (param, "count");
 	if (subparam) {
-		value = soup_soap_parameter_get_string_value (subparam) ;
+		value = soup_soap_parameter_get_string_value (subparam);
 		if (value)
-			container->priv->total = atoi(value) ;
-		g_free (value) ;
+			container->priv->total = atoi(value);
+		g_free (value);
 	}
 	/* Is shared by me*/
 	subparam = soup_soap_parameter_get_first_child_by_name (param, "isSharedByMe");
@@ -425,7 +425,7 @@ e_gw_container_get_sequence (EGwContainer *container)
 {
 	g_return_val_if_fail (E_IS_GW_CONTAINER (container), 0);
 
-	return (int)container->priv->sequence;
+	return (gint)container->priv->sequence;
 }
 
 static  void
@@ -605,33 +605,33 @@ e_gw_container_get_parent_id (EGwContainer *container)
 void
 e_gw_container_set_parent_id (EGwContainer *container, const gchar *parent_id)
 {
-	EGwContainerPrivate *priv ;
+	EGwContainerPrivate *priv;
 
 	g_return_if_fail (E_IS_GW_CONTAINER (container));
 	g_return_if_fail (parent_id != NULL);
 
-	priv = container->priv ;
+	priv = container->priv;
 
 	if (priv->parent)
-		g_free (priv->parent) ;
+		g_free (priv->parent);
 
-	priv->parent = g_strdup (parent_id) ;
+	priv->parent = g_strdup (parent_id);
 }
 
 guint32
 e_gw_container_get_total_count (EGwContainer *container)
 {
-	g_return_val_if_fail (E_IS_GW_CONTAINER (container), -1) ;
+	g_return_val_if_fail (E_IS_GW_CONTAINER (container), -1);
 
-	return container->priv->total ;
+	return container->priv->total;
 }
 
 guint32
 e_gw_container_get_unread_count (EGwContainer *container)
 {
-	g_return_val_if_fail (E_IS_GW_CONTAINER (container), -1) ;
+	g_return_val_if_fail (E_IS_GW_CONTAINER (container), -1);
 
-	return container->priv->unread ;
+	return container->priv->unread;
 
 }
 
@@ -673,16 +673,16 @@ e_gw_container_set_is_frequent_contacts (EGwContainer *container, gboolean is_fr
 gboolean
 e_gw_container_is_root (EGwContainer *container)
 {
-	g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE) ;
+	g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
 
-	return container->priv->is_root ;
+	return container->priv->is_root;
 }
 
 EGwContainerType
 e_gw_container_get_container_type (EGwContainer *container)
 {
-	g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE) ;
-	return container->priv->type ;
+	g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
+	return container->priv->type;
 }
 
 /* flag specifies whether we are adding to acl or deleting one or more entries*/
diff --git a/servers/groupwise/e-gw-container.h b/servers/groupwise/e-gw-container.h
index e198a6f..3aa7719 100644
--- a/servers/groupwise/e-gw-container.h
+++ b/servers/groupwise/e-gw-container.h
@@ -69,7 +69,7 @@ typedef enum {
 	E_GW_CONTAINER_TYPE_JUNK,
 	E_GW_CONTAINER_TYPE_FOLDER
 
-} EGwContainerType ;
+} EGwContainerType;
 
 GType         e_gw_container_get_type (void);
 EGwContainer *e_gw_container_new_from_soap_parameter (SoupSoapParameter *param);
@@ -79,22 +79,22 @@ const gchar   *e_gw_container_get_name (EGwContainer *container);
 void          e_gw_container_set_name (EGwContainer *container, const gchar *new_name);
 const gchar   *e_gw_container_get_id (EGwContainer *container);
 void          e_gw_container_set_id (EGwContainer *container, const gchar *new_id);
-const gchar   *e_gw_container_get_parent_id (EGwContainer *container) ;
-void	      e_gw_container_set_parent_id (EGwContainer *container, const gchar *parent_id) ;
-guint32       e_gw_container_get_total_count (EGwContainer *container) ;
-guint32       e_gw_container_get_unread_count (EGwContainer *container) ;
+const gchar   *e_gw_container_get_parent_id (EGwContainer *container);
+void	      e_gw_container_set_parent_id (EGwContainer *container, const gchar *parent_id);
+guint32       e_gw_container_get_total_count (EGwContainer *container);
+guint32       e_gw_container_get_unread_count (EGwContainer *container);
 gboolean      e_gw_container_get_is_writable (EGwContainer *container);
 void          e_gw_container_set_is_writable (EGwContainer *container, gboolean writable);
 gboolean     e_gw_container_get_is_frequent_contacts (EGwContainer *container);
 void         e_gw_container_set_is_frequent_contacts (EGwContainer *container, gboolean is_frequent_contacts);
-gboolean    e_gw_container_is_root (EGwContainer *container) ;
+gboolean    e_gw_container_is_root (EGwContainer *container);
 const gchar *  e_gw_container_get_owner(EGwContainer *container);
 const gchar *  e_gw_container_get_modified(EGwContainer *container);
 gint           e_gw_container_get_sequence(EGwContainer *container);
 gboolean      e_gw_container_get_is_shared_by_me(EGwContainer *container);
 gboolean      e_gw_container_get_is_shared_to_me(EGwContainer *container);
-int	      e_gw_container_get_rights(EGwContainer *container, gchar *email);
-EGwContainerType e_gw_container_get_container_type (EGwContainer *container) ;
+gint	      e_gw_container_get_rights(EGwContainer *container, gchar *email);
+EGwContainerType e_gw_container_get_container_type (EGwContainer *container);
 void	      e_gw_container_get_user_list(EGwContainer *container, GList **user_list);
 void	      e_gw_container_form_message (SoupSoapMessage *msg, gchar *id, GList *new_list, const gchar *sub, const gchar *mesg, gint flag);
 gboolean e_gw_container_get_is_system_folder (EGwContainer *container);
diff --git a/servers/groupwise/e-gw-item.c b/servers/groupwise/e-gw-item.c
index 002cc96..5ffc568 100644
--- a/servers/groupwise/e-gw-item.c
+++ b/servers/groupwise/e-gw-item.c
@@ -3100,7 +3100,7 @@ e_gw_item_set_calendar_item_elements (EGwItem *item, SoupSoapMessage *msg)
 		gchar *str;
 
 		str = g_base64_encode ((guchar *) priv->message, strlen (priv->message));
-		dtstring = g_strdup_printf ("%d", (int)strlen (str));
+		dtstring = g_strdup_printf ("%d", (gint)strlen (str));
 		soup_soap_message_add_attribute (msg, "length", dtstring, NULL, NULL);
 		g_free (dtstring);
 		soup_soap_message_write_string (msg, str);
@@ -3289,7 +3289,7 @@ e_gw_item_append_to_soap_message (EGwItem *item, SoupSoapMessage *msg)
 
 			str = g_base64_encode ((guchar *) priv->message, strlen (priv->message));
 			/*str = g_strdup (priv->message);*/
-			str_len = g_strdup_printf ("%d", str ? (int)strlen (str) : 0);
+			str_len = g_strdup_printf ("%d", str ? (gint)strlen (str) : 0);
 			soup_soap_message_start_element (msg, "part", NULL, NULL);
 			soup_soap_message_add_attribute (msg, "length", str_len, NULL, NULL);
 			soup_soap_message_add_attribute (msg, "contentType", priv->content_type, NULL, NULL);
@@ -3530,7 +3530,7 @@ append_event_changes_to_soap_message (EGwItem *item, SoupSoapMessage *msg, gint
 			gchar *str, *message;
 
 			str = g_base64_encode ((guchar *) priv->message, strlen (priv->message));
-			message = g_strdup_printf ("%d", (int)strlen (str));
+			message = g_strdup_printf ("%d", (gint)strlen (str));
 			soup_soap_message_add_attribute (msg, "length", message, NULL, NULL);
 			g_free (message);
 			soup_soap_message_write_string (msg, str);
diff --git a/servers/groupwise/e-gw-item.h b/servers/groupwise/e-gw-item.h
index 927d245..016af61 100644
--- a/servers/groupwise/e-gw-item.h
+++ b/servers/groupwise/e-gw-item.h
@@ -122,16 +122,16 @@ typedef struct {
 } EGwItemOrganizer;
 
 typedef struct {
-	gchar *id ;
-	gchar *name ;
+	gchar *id;
+	gchar *name;
 	gchar *item_reference;
 	gchar *contentid;
-	gchar *contentType ;
-	gint size ;
-	gchar *date ;
-	gchar *data ;
+	gchar *contentType;
+	gint size;
+	gchar *date;
+	gchar *data;
 	gboolean hidden;
-} EGwItemAttachment ;
+} EGwItemAttachment;
 
 typedef enum {
 	E_GW_ITEM_NOTIFY_NONE,
@@ -195,8 +195,8 @@ gboolean    e_gw_item_get_completed (EGwItem *item);
 void        e_gw_item_set_completed (EGwItem *item, gboolean new_completed);
 gboolean    e_gw_item_get_is_allday_event (EGwItem *item);
 void	    e_gw_item_set_is_allday_event (EGwItem *item, gboolean is_allday);
-char*       e_gw_item_get_field_value (EGwItem *item, const gchar *field_name);
-void        e_gw_item_set_field_value (EGwItem *item, const gchar *field_name, char* field_value);
+gchar *       e_gw_item_get_field_value (EGwItem *item, const gchar *field_name);
+void        e_gw_item_set_field_value (EGwItem *item, const gchar *field_name, gchar * field_value);
 GList*      e_gw_item_get_email_list (EGwItem *item);
 void        e_gw_item_set_email_list (EGwItem *item, GList *email_list);
 FullName*   e_gw_item_get_full_name (EGwItem *item);
@@ -209,16 +209,16 @@ GList*      e_gw_item_get_im_list (EGwItem *item);
 void        e_gw_item_set_im_list (EGwItem *item, GList *im_list);
 void        e_gw_item_set_categories (EGwItem *item, GList *category_list);
 GList*      e_gw_item_get_categories (EGwItem *item);
-void	    e_gw_item_set_to (EGwItem *item, const gchar *to) ;
-const gchar * e_gw_item_get_to (EGwItem *item) ;
-const gchar *e_gw_item_get_msg_content_type (EGwItem *item) ;
+void	    e_gw_item_set_to (EGwItem *item, const gchar *to);
+const gchar * e_gw_item_get_to (EGwItem *item);
+const gchar *e_gw_item_get_msg_content_type (EGwItem *item);
 guint32     e_gw_item_get_item_status (EGwItem *item);
-void	    e_gw_item_set_content_type (EGwItem *item, const gchar *content_type) ;
+void	    e_gw_item_set_content_type (EGwItem *item, const gchar *content_type);
 void	    e_gw_item_set_link_info (EGwItem *item, EGwItemLinkInfo *info);
 EGwItemLinkInfo *e_gw_item_get_link_info (EGwItem *item);
-char	    *e_gw_item_get_content_type (EGwItem *item) ;
+gchar	    *e_gw_item_get_content_type (EGwItem *item);
 const gchar *e_gw_item_get_msg_body_id (EGwItem *item);
-int	    e_gw_item_get_mail_size (EGwItem *item);
+gint	    e_gw_item_get_mail_size (EGwItem *item);
 void e_gw_item_set_change (EGwItem *item, EGwItemChangeType change_type, const gchar *field_name, gpointer field_value);
 gboolean e_gw_item_append_changes_to_soap_message (EGwItem *item, SoupSoapMessage *msg);
 void e_gw_item_set_category_name (EGwItem *item, gchar *cateogry_name);
@@ -279,8 +279,8 @@ void e_gw_item_set_recipient_list (EGwItem *item, GSList *new_recipient_list);
 EGwItemOrganizer *e_gw_item_get_organizer (EGwItem *item);
 void e_gw_item_set_organizer (EGwItem  *item, EGwItemOrganizer *organizer);
 
-GSList * e_gw_item_get_attach_id_list (EGwItem *item) ;
-void e_gw_item_set_attach_id_list (EGwItem *item, GSList *attach_list) ;
+GSList * e_gw_item_get_attach_id_list (EGwItem *item);
+void e_gw_item_set_attach_id_list (EGwItem *item, GSList *attach_list);
 
 
 GSList *e_gw_item_get_recurrence_dates (EGwItem *item);
diff --git a/servers/groupwise/e-gw-message.c b/servers/groupwise/e-gw-message.c
index 9f825c7..ec81ca2 100644
--- a/servers/groupwise/e-gw-message.c
+++ b/servers/groupwise/e-gw-message.c
@@ -93,7 +93,7 @@ e_gw_message_write_base64_parameter (SoupSoapMessage *msg, const gchar *name, co
 }
 
 void
-e_gw_message_write_int_parameter (SoupSoapMessage *msg, const gchar *name, const gchar *prefix, long value)
+e_gw_message_write_int_parameter (SoupSoapMessage *msg, const gchar *name, const gchar *prefix, glong value)
 {
 	soup_soap_message_start_element (msg, name, prefix, NULL);
 	soup_soap_message_write_int (msg, value);
diff --git a/servers/groupwise/e-gw-message.h b/servers/groupwise/e-gw-message.h
index d6aed50..25541f4 100644
--- a/servers/groupwise/e-gw-message.h
+++ b/servers/groupwise/e-gw-message.h
@@ -41,7 +41,7 @@ void             e_gw_message_write_base64_parameter (SoupSoapMessage *msg,
 						      const gchar *name,
 						      const gchar *prefix,
 						      const gchar *value);
-void e_gw_message_write_int_parameter (SoupSoapMessage *msg, const gchar *name, const gchar *prefix, long value);
+void e_gw_message_write_int_parameter (SoupSoapMessage *msg, const gchar *name, const gchar *prefix, glong value);
 
 
 void             e_gw_message_write_footer (SoupSoapMessage *msg);
diff --git a/servers/groupwise/e-gw-sendoptions.c b/servers/groupwise/e-gw-sendoptions.c
index 15be5cb..70ff7c9 100644
--- a/servers/groupwise/e-gw-sendoptions.c
+++ b/servers/groupwise/e-gw-sendoptions.c
@@ -174,8 +174,8 @@ parse_status_tracking_options (SoupSoapParameter *group_param, guint i, EGwSendO
 {
 	SoupSoapParameter *subparam, *field_param, *val_param;
 
-	for (subparam = soup_soap_parameter_get_first_child_by_name(group_param, "setting") ;
-			     subparam != NULL ;
+	for (subparam = soup_soap_parameter_get_first_child_by_name(group_param, "setting");
+			     subparam != NULL;
 			     subparam = soup_soap_parameter_get_next_child_by_name (subparam, "setting")) {
 
 		gchar *field = NULL, *val = NULL;
@@ -282,8 +282,8 @@ parse_general_options (SoupSoapParameter *group_param, EGwSendOptionsGeneral *go
 {
 	SoupSoapParameter *subparam, *field_param, *val_param;
 
-	for (subparam = soup_soap_parameter_get_first_child_by_name(group_param, "setting") ;
-			     subparam != NULL ;
+	for (subparam = soup_soap_parameter_get_first_child_by_name(group_param, "setting");
+			     subparam != NULL;
 			     subparam = soup_soap_parameter_get_next_child_by_name (subparam, "setting")) {
 		gchar *field = NULL, *val = NULL;
 		field_param = soup_soap_parameter_get_first_child_by_name (subparam, "field");
@@ -364,8 +364,8 @@ parse_advanced_settings (SoupSoapParameter *group_param, EGwSendOptionsGeneral *
 {
 	SoupSoapParameter *subparam, *field_param, *val_param;
 
-	for (subparam = soup_soap_parameter_get_first_child_by_name(group_param, "setting") ;
-			     subparam != NULL ;
+	for (subparam = soup_soap_parameter_get_first_child_by_name(group_param, "setting");
+			     subparam != NULL;
 			     subparam = soup_soap_parameter_get_next_child_by_name (subparam, "setting")) {
 		gchar *field = NULL, *val = NULL;
 		field_param = soup_soap_parameter_get_first_child_by_name (subparam, "field");
@@ -406,8 +406,8 @@ e_gw_sendoptions_store_settings (SoupSoapParameter *param, EGwSendOptions *opts)
 
 	priv = opts->priv;
 
-	for (group_param = soup_soap_parameter_get_first_child_by_name(param, "group") ;
-			     group_param != NULL ;
+	for (group_param = soup_soap_parameter_get_first_child_by_name(param, "group");
+			     group_param != NULL;
 			     group_param = soup_soap_parameter_get_next_child_by_name (group_param, "group")) {
 		gchar *temp = NULL;
 
diff --git a/servers/groupwise/soup-soap-message.c b/servers/groupwise/soup-soap-message.c
index 1817fd8..b776db0 100644
--- a/servers/groupwise/soup-soap-message.c
+++ b/servers/groupwise/soup-soap-message.c
@@ -495,7 +495,7 @@ soup_soap_message_write_int (SoupSoapMessage *msg, glong i)
  * Writes the stringified value of @d as the current element's content.
  */
 void
-soup_soap_message_write_double (SoupSoapMessage *msg, double d)
+soup_soap_message_write_double (SoupSoapMessage *msg, gdouble d)
 {
 	gchar *str = g_strdup_printf ("%f", d);
 	soup_soap_message_write_string (msg, str);
diff --git a/servers/groupwise/soup-soap-message.h b/servers/groupwise/soup-soap-message.h
index bc8d6f4..30caf29 100644
--- a/servers/groupwise/soup-soap-message.h
+++ b/servers/groupwise/soup-soap-message.h
@@ -64,7 +64,7 @@ void              soup_soap_message_start_header_element (SoupSoapMessage *msg,
 							  const gchar *ns_uri);
 void              soup_soap_message_end_header_element (SoupSoapMessage *msg);
 void              soup_soap_message_write_int (SoupSoapMessage *msg, glong i);
-void              soup_soap_message_write_double (SoupSoapMessage *msg, double d);
+void              soup_soap_message_write_double (SoupSoapMessage *msg, gdouble d);
 void              soup_soap_message_write_base64 (SoupSoapMessage *msg, const gchar *string, gint len);
 void              soup_soap_message_write_time (SoupSoapMessage *msg, const time_t *timeval);
 void              soup_soap_message_write_string (SoupSoapMessage *msg, const gchar *string);



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