MAINT: const correctness and minor fixes to C code

Fixed some more compiler warnings, many of them related to incorrect handling of `const` with C strings.