Commit 848b93be authored by stefano's avatar stefano

Use an unsigned int to contain all the color values of the expressions

of the type 0xRRGBBAA parsed by av_parse_color(), using a simple int
was resulting in unexpected results as the most significant bit was
used for the sign.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@20778 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 9e12ae1d
...@@ -227,7 +227,7 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx) ...@@ -227,7 +227,7 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)
if (!strncmp(color_string, "0x", 2)) { if (!strncmp(color_string, "0x", 2)) {
char *tail; char *tail;
int len = strlen(color_string); int len = strlen(color_string);
int rgba = strtol(color_string, &tail, 16); unsigned int rgba = strtoul(color_string, &tail, 16);
if (*tail || (len != 8 && len != 10)) { if (*tail || (len != 8 && len != 10)) {
av_log(log_ctx, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", color_string); av_log(log_ctx, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", color_string);
...@@ -412,6 +412,7 @@ int main(void) ...@@ -412,6 +412,7 @@ int main(void)
"Red", "Red",
"0x000000", "0x000000",
"0x0000000", "0x0000000",
"0xff000000",
"0x3e34ff", "0x3e34ff",
"0x3e34ffaa", "0x3e34ffaa",
"0xffXXee", "0xffXXee",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment