Refactored common dialog load/save code.
Added cast for signed/unsigned warnings.