Remove compile warnings on windows

The code emitted too many warnings making it impossible
to see if there was any serious warnings being reported

Most of the changes are due to return values doing conversions
that would cause some sort of data loss.

Change-Id: Ic5bca0a889d70d903baa8377a54b538d16e4edef
Reviewed-on: http://review.couchbase.org/32736
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>