Constify colour source
authorkrj <krj@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 22 Sep 2009 04:10:50 +0000 (04:10 +0000)
committerkrj <krj@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 22 Sep 2009 04:10:50 +0000 (04:10 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30059 f5534014-38df-0310-8fa8-9805f1628bb7

gtk/color_utils.c
gtk/color_utils.h

index a3ad539198bdf58bc375cf7f066032c8768ff477..6298597d38fe5f89027f8fefe243575197ded2d3 100644 (file)
@@ -25,8 +25,8 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
-#include <string.h>
 
+#include <string.h>
 
 #include <gtk/gtk.h>
 
@@ -36,7 +36,6 @@
 #include "gtk/color_utils.h"
 #include "gtk/gtkglobals.h"
 
-
 static GdkColormap*    sys_cmap;
 static GdkColormap*    our_cmap = NULL;
 
@@ -44,7 +43,6 @@ GdkColor      WHITE = { 0, 65535, 65535, 65535 };
 GdkColor       LTGREY = { 0, 57343, 57343, 57343 };
 GdkColor       BLACK = { 0, 0, 0, 0 };
 
-
 /*
  * Initialize a color with R, G, and B values, including any toolkit-dependent
  * work that needs to be done.
@@ -80,14 +78,14 @@ colors_init(void)
        if (!got_white) {
                if (!got_black)
                        simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
-                           "Could not allocate colors black or white.");
+                               "Could not allocate colors black or white.");
                else
                        simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
-                           "Could not allocate color white.");
+                               "Could not allocate color white.");
        } else {
                if (!got_black)
                        simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
-                           "Could not allocate color black.");
+                               "Could not allocate color black.");
        }
 }
 
@@ -99,11 +97,11 @@ get_color(GdkColor *new_color)
 
        if (!our_cmap) {
                if (!gdk_colormap_alloc_color (sys_cmap, new_color, FALSE,
-                   TRUE)) {
+                       TRUE)) {
                        pv = gdk_visual_get_best();
                        if (!(our_cmap = gdk_colormap_new(pv, TRUE))) {
                                simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
-                                   "Could not create new colormap");
+                                       "Could not create new colormap");
                        }
                } else
                        return (TRUE);
@@ -112,7 +110,7 @@ get_color(GdkColor *new_color)
 }
 
 void
-color_t_to_gdkcolor(GdkColor *target, color_t *source)
+color_t_to_gdkcolor(GdkColor *target, const color_t *source)
 {
        target->pixel = source->pixel;
        target->red   = source->red;
@@ -121,7 +119,7 @@ color_t_to_gdkcolor(GdkColor *target, color_t *source)
 }
 
 void
-gdkcolor_to_color_t(color_t *target, GdkColor *source)
+gdkcolor_to_color_t(color_t *target, const GdkColor *source)
 {
        target->pixel = source->pixel;
        target->red   = source->red;
@@ -147,11 +145,9 @@ gdkcolor_to_color_t(color_t *target, GdkColor *source)
 gchar *
 gdk_color_to_string (const GdkColor *color)
 {
+       g_return_val_if_fail (color != NULL, NULL);
 
-  g_return_val_if_fail (color != NULL, NULL);
-
-  return g_strdup_printf ("#%04x%04x%04x", color->red, color->green, color->blue);
-
+       return g_strdup_printf ("#%04x%04x%04x", color->red, color->green, color->blue);
 }
 #endif /* GTK_CHECK_VERSION(2,12,0) */
 
index d19a47e7a822bbd08db4630dcf8e05cc76a8e3f1..1f28e1d1dac1ae9f1cf8837eb1c325a2d4320004 100644 (file)
@@ -52,14 +52,14 @@ gboolean get_color(GdkColor *new_color);
  * @param target the GdkColor to be filled
  * @param source the source color_t
  */
-void color_t_to_gdkcolor(GdkColor *target, color_t *source);
+void color_t_to_gdkcolor(GdkColor *target, const color_t *source);
 
 /** Convert GdkColor to color_t.
  *
  * @param target the source color_t
  * @param source the GdkColor to be filled
  */
-void gdkcolor_to_color_t(color_t *target, GdkColor *source);
+void gdkcolor_to_color_t(color_t *target, const GdkColor *source);
 
 #if GTK_CHECK_VERSION(2,12,0)
 #else