Warning fixes v2

This fixes a wide range of compile warnings in a number of apps.