From 63c277f3d5bfda678f27aaaf695e7f0b3faa1d1e Mon Sep 17 00:00:00 2001 From: David Hedbor <david@hedbor.org> Date: Fri, 15 Jan 1999 01:19:14 -0800 Subject: [PATCH] Changed (int)"0x"... to use sscanf, making it work with Pike 0.7. Rev: lib/modules/Colors.pmod:1.4 --- lib/modules/Colors.pmod | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/modules/Colors.pmod b/lib/modules/Colors.pmod index 58e95a291e..9cf8a54b8c 100644 --- a/lib/modules/Colors.pmod +++ b/lib/modules/Colors.pmod @@ -549,7 +549,7 @@ array(int) parse_color(string from) // Is it #rrggbb? if(from[0]=='#') { - c = (int)("0x"+from[1..]); + sscanf(from, "#%x", c); if(strlen(from)>6) return ({ c>>16, (c>>8)&255, c&255 }); return ({ (c>>8)<<4, ((c>>4)&15)<<4, (c&15)<<4 }); @@ -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 '#') - if(c=(int)("0x"+from)) + sscanf(from, "%x", c); + if(c) { if(strlen(from)>5) return ({ c>>16, (c>>8)&255, c&255 }); -- GitLab