mingw build fixes. Also a bit of const'ification for searchAll/searchAndReplace
Simplifed some casts in dfa.cpp using dynamic_cast