change in ternaire condition

Change of ternaire condition to if condition for a better cross compiler
compatibility. add bracket to in a switch case.
the switch cases must in the future add a default value.