-- ANSI-fying, names (patch #100762 by Peter Schneider-Kamp, minus the indentation changes) -- added INT_PTR workaround to make it build under VC 5.0