mity/mctrl — pull request #5 by ArmstrongJ (2013-07-02 15:49:04+00:00)
Title: Added safety checks to string type conversions

I implemented these changes thinking there was an error occurring in these conversion routines. Turns out I was incorrect. However, I think the changes merit a commit. Basically, the WideCharToMultiByte and it's reversed equivalent will return 0 when they fail. The changes effectively:

1. Stop 0-length strings from being converted, returning NULL (and 0 length counts if applicable) with no error
2. Correctly handle occasions where the Windows conversions routines return 0 as an error

I doubt this breaks anything internally in mCtrl.