Standardise line endings to LF

The codebase was inconsistent in its line endings, with some CRLF and
some LF-only. This commit standardises the line endings with the
replacement of all CRLF line endings with LF, and also cleans up all
trailing whitespace. No functionality is affected.
Merge pull request #441 from zmthy/master

Standardise line endings to LF