tdefcolor() returns -1 on error, while its return type is unsigned long. At the same time, line 1724 and 1731 are checking the positivity of its unsigned return value.