Tautological Compare warning fixes

Since unsigned integers can never be negative, some code can never
be reached and can safely be removed as dead code.
Since enum values are known at compile time, some comparisons are
flagged as always true/false. Special invalid enum values and explicit
casts prevent those warnings.
XDR Tautological Compare fix

Unsigned integers will never be negative. Check for potential
underflows before they happen.