MB-100: fix compilation errors and warnings

1) fix some VLA(variable size arrays) which are forbidden in C++;
2) fix warning of comparing unsigned int and int.

Change-Id: I85d3b554305c270dd8c218e1cba6b36b472a53d2
Reviewed-on: http://review.couchbase.org/26813
Tested-by: Junyi Xie <junyi.couchbase@gmail.com>
Reviewed-by: Jin Lim <jin@couchbase.com>