WNDO: add CMake file.
WNDO: fix prototypes and unused variables.
WNDO: fix signed/unsigned mismatches.
WNDO: fix casts.