summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2015-03-19 16:30:03 -0400
committerTingPing <tingping@tingping.se>2015-03-19 16:30:03 -0400
commitdc69f24ae513c6807b502cbc5a264a8c829e9d10 (patch)
treee3003b9966ce9e1b952d4b03f3d62b923bb8bdb9 /src
parentb4906f3d230c22c807cdb00b72de0d60491bba76 (diff)
Use correct type for colors
Diffstat (limited to 'src')
-rw-r--r--src/common/cfgfiles.c8
-rw-r--r--src/common/cfgfiles.h4
-rw-r--r--src/fe-gtk/palette.c2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index 9adaa5d6..9911a161 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -226,12 +226,12 @@ cfg_put_str (int fh, char *var, char *value)
 }
 
 int
-cfg_put_color (int fh, int r, int g, int b, char *var)
+cfg_put_color (int fh, guint16 r, guint16 g, guint16 b, char *var)
 {
 	char buf[400];
 	int len;
 
-	g_snprintf (buf, sizeof buf, "%s = %04x %04x %04x\n", var, r, g, b);
+	g_snprintf (buf, sizeof buf, "%s = %04"G_GUINT16_FORMAT" %04"G_GUINT16_FORMAT" %04"G_GUINT16_FORMAT"\n", var, r, g, b);
 	len = strlen (buf);
 	return (write (fh, buf, len) == len);
 }
@@ -251,14 +251,14 @@ cfg_put_int (int fh, int value, char *var)
 }
 
 int
-cfg_get_color (char *cfg, char *var, int *r, int *g, int *b)
+cfg_get_color (char *cfg, char *var, guint16 *r, guint16 *g, guint16 *b)
 {
 	char str[128];
 
 	if (!cfg_get_str (cfg, var, str, sizeof (str)))
 		return 0;
 
-	sscanf (str, "%04x %04x %04x", r, g, b);
+	sscanf (str, "%04"G_GUINT16_FORMAT" %04"G_GUINT16_FORMAT" %04"G_GUINT16_FORMAT, r, g, b);
 	return 1;
 }
 
diff --git a/src/common/cfgfiles.h b/src/common/cfgfiles.h
index c460ce60..b421884a 100644
--- a/src/common/cfgfiles.h
+++ b/src/common/cfgfiles.h
@@ -34,8 +34,8 @@ int cfg_get_bool (char *var);
 int cfg_get_int_with_result (char *cfg, char *var, int *result);
 int cfg_get_int (char *cfg, char *var);
 int cfg_put_int (int fh, int value, char *var);
-int cfg_get_color (char *cfg, char *var, int *r, int *g, int *b);
-int cfg_put_color (int fh, int r, int g, int b, char *var);
+int cfg_get_color (char *cfg, char *var, guint16 *r, guint16 *g, guint16 *b);
+int cfg_put_color (int fh, guint16 r, guint16 g, guint16 b, char *var);
 char *get_xdir (void);
 int check_config_dir (void);
 void load_default_config (void);
diff --git a/src/fe-gtk/palette.c b/src/fe-gtk/palette.c
index a0f8b9eb..17689756 100644
--- a/src/fe-gtk/palette.c
+++ b/src/fe-gtk/palette.c
@@ -110,7 +110,7 @@ palette_load (void)
 	char prefname[256];
 	struct stat st;
 	char *cfg;
-	int red, green, blue;
+	guint16 red, green, blue;
 
 	fh = hexchat_open_file ("colors.conf", O_RDONLY, 0, 0);
 	if (fh != -1)