Declare some arguments of functions as "const" pointers where they are not meant to be modified.
These are some places I found while working on the code. If there are hints for other places in the source where more consts might be missing, let me know and I can try to add them as well.