fix VC++ warning warning C4244

explicit cast to size_t inorder to silence VC++ warning C4244