Make the whitespace replacement a bit more generic and use _ instead of -.

Signed-off-by: Marko Saukko <marko.saukko@jollamobile.com>
Pass parameters as const references where possible.

Signed-off-by: Marko Saukko <marko.saukko@jollamobile.com>