Skip to content
Snippets Groups Projects
Commit 63c277f3 authored by David Hedbor's avatar David Hedbor
Browse files

Changed (int)"0x"... to use sscanf, making it work with Pike 0.7.

Rev: lib/modules/Colors.pmod:1.4
parent da4216dc
No related branches found
No related tags found
No related merge requests found
...@@ -549,7 +549,7 @@ array(int) parse_color(string from) ...@@ -549,7 +549,7 @@ array(int) parse_color(string from)
// Is it #rrggbb? // Is it #rrggbb?
if(from[0]=='#') if(from[0]=='#')
{ {
c = (int)("0x"+from[1..]); sscanf(from, "#%x", c);
if(strlen(from)>6) if(strlen(from)>6)
return ({ c>>16, (c>>8)&255, c&255 }); return ({ c>>16, (c>>8)&255, c&255 });
return ({ (c>>8)<<4, ((c>>4)&15)<<4, (c&15)<<4 }); return ({ (c>>8)<<4, ((c>>4)&15)<<4, (c&15)<<4 });
...@@ -577,7 +577,8 @@ array(int) parse_color(string from) ...@@ -577,7 +577,8 @@ array(int) parse_color(string from)
} }
// No luck. It might be a color on the form rrggbb (that is, no leading '#') // No luck. It might be a color on the form rrggbb (that is, no leading '#')
if(c=(int)("0x"+from)) sscanf(from, "%x", c);
if(c)
{ {
if(strlen(from)>5) if(strlen(from)>5)
return ({ c>>16, (c>>8)&255, c&255 }); return ({ c>>16, (c>>8)&255, c&255 });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment