thezbyg / gpick

Advanced color picker written in C++ using GTK+ toolkit
BSD 3-Clause "New" or "Revised" License
381 stars 34 forks source link

Tautological comparison warnings #159

Open ryandesign opened 6 years ago

ryandesign commented 6 years ago

These warnings occur when compiling the latest gpick code from your repo:

source/ColorPicker.cpp:760:14: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
        if (color_n < 0 || color_n > 6) return -1;
            ~~~~~~~ ^ ~
source/ColorPicker.cpp:768:14: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
        if (color_n < 0 || color_n > 6) return -1;
            ~~~~~~~ ^ ~
source/GenerateScheme.cpp:606:14: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
        if (color_n < 0 || color_n > 6) return -1;
            ~~~~~~~ ^ ~
source/GenerateScheme.cpp:857:12: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]
        if (index >= 0 && index < generate_scheme_get_n_scheme_types())
            ~~~~~ ^  ~