Skip to content
  • Patrick Storz's avatar
    Preferences: Work around issue with parsing unsigned integers · 85f5be05
    Patrick Storz authored
    As we handle unsigned integers the same way as signed integers,
    large unsigned values (notably RGBA values) overflow the signed type.
    
    The issue became apparent when we switched from atoi to strtol in
      0e92e8e5
    
    While the former has undefined behavior for out of range numbers
    it luckily seemed to "just" overflow as expected on supported OSs.
    
    The latter however returns LONG_MAX (which for a 32-bit value is
    0x7fffffff and turned out to show turquoise in unexpected places,
    e.g. the default path highlighting color in node tool).
    
    Avoid this by catching the error and try to parse as unsigned type
    in this case (which will still overflow, but seems to have worked
    as expected so far).
    85f5be05