fixed potential negative int to size_t casting issue in platform.cpp