Fix numerous indentation inconsistencies

It looks like editors with both space and tab modes for indentation
have been used, which resulted in a mix of the two spread throughout.
Even worse, it seems that one of the editors expanded the tabs to
spaces inside a line, resulting in long lines consisting mostly of
spaces.

I've switched the main source files to use 4 space identation, since
this seems to have been the predominant mode. I've also manually
fixed some identation inconsistencies.