Corrected some stdinc inline functions (thanks, Martin!).

qsort() returns void, so remove the "return" keyword, plus some C++
 const_casting magic.

 Fixes Bugzilla #1785.