Mercurial > hg > xemacs-beta
comparison src/objects-msw.c @ 288:e11d67e05968 r21-0b42
Import from CVS: tag r21-0b42
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:35:54 +0200 |
parents | 57709be46d1b |
children | 4b85ae5eabfb |
comparison
equal
deleted
inserted
replaced
287:13a0bd77a29d | 288:e11d67e05968 |
---|---|
773 } | 773 } |
774 else if (!strncmp(name, "rgb:", 4)) | 774 else if (!strncmp(name, "rgb:", 4)) |
775 { | 775 { |
776 unsigned int r,g,b; | 776 unsigned int r,g,b; |
777 | 777 |
778 if (sscanf(name, "rgb:%04x/%04x/%04x", &r, &g, &b) <0) | 778 if (sscanf(name, "rgb:%04x/%04x/%04x", &r, &g, &b) == 3) |
779 { | |
780 int len = strlen (name); | |
781 if (len == 18) | |
782 { | |
783 r /= 257; | |
784 g /= 257; | |
785 b /= 257; | |
786 } | |
787 else if (len == 15) | |
788 { | |
789 r /= 17; | |
790 g /= 17; | |
791 b /= 17; | |
792 } | |
793 return (PALETTERGB (r, g, b)); | |
794 } | |
795 else | |
779 return -1; | 796 return -1; |
780 | |
781 r /= 257; | |
782 g /= 257; | |
783 b /= 257; | |
784 | |
785 return (PALETTERGB (r, g, b)); | |
786 } | 797 } |
787 else if (*name) /* Can't be an empty string */ | 798 else if (*name) /* Can't be an empty string */ |
788 { | 799 { |
789 char *nospaces = alloca (strlen (name)+1); | 800 char *nospaces = alloca (strlen (name)+1); |
790 char *c=nospaces; | 801 char *c=nospaces; |