Fix compiler warnings

Unused variable warnings and signed versus unsigned types
comparisions in for loops.

Change-Id: I2d7881c9d02bd99a0c6b79aa93db34a398413f5c
Reviewed-on: http://review.couchbase.org/25792
Reviewed-by: Fulu Li <fulu@couchbase.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>