Get rid of most snprintf() fixed buffers in util.cpp, shorten code