Support building on win32 and some other fixes

The first three commits fix building on win32. The fourth commit fixes building cppmyth. The last commit fixes an incomplete sync with upstream.