linprog test: fix build.
BMessage::ReplaceData: potential corruption on realloc fail

The method would update the field offsets first, and would not restore
them in case of realloc failure, leaving them pointing to the wrong
place.
FileTypes: Avoid useless call to ReplaceRef

Don't replace the ref with itself in the most common case where the
scanned file is not a symlink. Save a lot of useless memory copies and
ref flattening in BMessage.