Fix a warning with const pointers.
Fix warning with enumeration conversions.
Fix static analyzer warning about potential division by zero.