# HG changeset patch # User Richard Laager # Date 1133760167 0 # Node ID f81d458aba18cef972b7556ef038a64019c19998 # Parent f6fa5d742c76c3de61d6107fb34ebd5cf488aff0 [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 diff -r f6fa5d742c76 -r f81d458aba18 src/gtkconv.c --- 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++; }