Fix a integer overflow issue
Alpha of 0xff resulted in RGB_8TO16(0xff) == 0x10000. This was cast to uint8_t which resulted in alpha being set to 0. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
388ef61158
commit
b38881b123
2
color.c
2
color.c
|
@ -24,7 +24,7 @@
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#define RGB_8TO16(i) (65536 * ((i) & 0xff) / 255)
|
#define RGB_8TO16(i) (0xffff * ((i) & 0xff) / 0xff)
|
||||||
|
|
||||||
/** Parse an hexadecimal color string to its component.
|
/** Parse an hexadecimal color string to its component.
|
||||||
* \param colstr The color string.
|
* \param colstr The color string.
|
||||||
|
|
Loading…
Reference in New Issue