Fix gcc compiler warnings

  - unused function
  - signed/unsigned comparisons
  - unused variables