Mercurial > pidgin.yaz
changeset 12346:f81d458aba18
[gaim-migrate @ 14650]
A couple minor changes to the style of Tak's patch that Luke just committed. I removed a couple '1 *'s because they're irrelevant (* has higher precendence than + and 1 is the identity of *). If they belong in the calculation, then some ()s are needed.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 05 Dec 2005 05:22:47 +0000 |
parents | f6fa5d742c76 |
children | 8337e1286313 |
files | src/gtkconv.c |
diffstat | 1 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkconv.c Mon Dec 05 05:08:38 2005 +0000 +++ b/src/gtkconv.c Mon Dec 05 05:22:47 2005 +0000 @@ -4072,7 +4072,7 @@ else gaim_gtkconv_placement_place(gtkconv); - if(NULL == nick_colors) + if (nick_colors == NULL) nick_colors = generate_nick_colors(NUM_NICK_COLORS, gtk_widget_get_style(gtkconv->imhtml)->base[GTK_STATE_NORMAL]); } @@ -7512,10 +7512,10 @@ gboolean color_is_visible(GdkColor foreground, GdkColor background) { - gulong fg_brightness, - bg_brightness, - br_diff, - col_diff; + gulong fg_brightness; + gulong bg_brightness; + gulong br_diff; + gulong col_diff; fg_brightness = (foreground.red * 299 + foreground.green * 587 + foreground.blue * 114) / 1000; bg_brightness = (background.red * 299 + background.green * 587 + background.blue * 114) / 1000; @@ -7531,13 +7531,14 @@ generate_nick_colors(guint numcolors, GdkColor background) { guint i; - GdkColor *colors = (GdkColor*)g_malloc(numcolors * sizeof(GdkColor)); - - srand(background.red + 1 * background.green + 1 * background.blue + 1); - - for(i = 0; i < numcolors;){ - GdkColor color = { 0, rand()%65536, rand()%65536, rand()%65536 }; - if(color_is_visible(color, background)){ + GdkColor *colors = g_new(GdkColor, numcolors); + + srand(background.red + background.green + background.blue + 1); + + for (i = 0; i < numcolors; ) + { + GdkColor color = { 0, rand() % 65536, rand() % 65536, rand() % 65536 }; + if (color_is_visible(color, background)){ colors[i] = color; i++; }