Replace C++-style comments with C-style comments to eliminate warnings.
Fix compiler warning (bad cast leading to signed vs. unsigned comparison).