summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-22 23:04:33 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-22 23:04:33 +0200
commit1b58cdd160c2e0ada0f638679a2aa27e4665fc48 (patch)
tree5a88e5a7aec9e04bc428c6a9e468cb2fc7ae2edb /src/term.c
parent17f1347b867cbcc0ce380bf9a2466b4c31896f04 (diff)
downloadvim-git-1b58cdd160c2e0ada0f638679a2aa27e4665fc48.tar.gz
patch 7.4.2243v7.4.2243
Problem: Warning for assigning negative value to unsigned. (Danek Duvall) Solution: Make cterm_normal_fg_gui_color and _bg_ guicolor_T, cast to long_u only when an unsigned is needed.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/term.c b/src/term.c
index 4d505e33d..9879ba83a 100644
--- a/src/term.c
+++ b/src/term.c
@@ -77,9 +77,6 @@ struct builtin_term
static struct builtin_term *find_builtin_term(char_u *name);
static void parse_builtin_tcap(char_u *s);
static void term_color(char_u *s, int n);
-#ifdef FEAT_TERMGUICOLORS
-static void term_rgb_color(char_u *s, long_u rgb);
-#endif
static void gather_termleader(void);
#ifdef FEAT_TERMRESPONSE
static void req_codes_from_term(void);
@@ -1282,10 +1279,10 @@ termgui_get_color(char_u *name)
return t;
}
- long_u
+ guicolor_T
termgui_mch_get_rgb(guicolor_T color)
{
- return (long_u)color;
+ return color;
}
#endif
@@ -2634,24 +2631,13 @@ term_color(char_u *s, int n)
}
#if defined(FEAT_TERMGUICOLORS) || defined(PROTO)
- void
-term_fg_rgb_color(long_u rgb)
-{
- term_rgb_color(T_8F, rgb);
-}
-
- void
-term_bg_rgb_color(long_u rgb)
-{
- term_rgb_color(T_8B, rgb);
-}
-#define RED(rgb) ((rgb>>16)&0xFF)
-#define GREEN(rgb) ((rgb>> 8)&0xFF)
-#define BLUE(rgb) ((rgb )&0xFF)
+#define RED(rgb) (((long_u)(rgb) >> 16) & 0xFF)
+#define GREEN(rgb) (((long_u)(rgb) >> 8) & 0xFF)
+#define BLUE(rgb) (((long_u)(rgb) ) & 0xFF)
static void
-term_rgb_color(char_u *s, long_u rgb)
+term_rgb_color(char_u *s, guicolor_T rgb)
{
#define MAX_COLOR_STR_LEN 100
char buf[MAX_COLOR_STR_LEN];
@@ -2660,6 +2646,18 @@ term_rgb_color(char_u *s, long_u rgb)
(char *)s, RED(rgb), GREEN(rgb), BLUE(rgb));
OUT_STR(buf);
}
+
+ void
+term_fg_rgb_color(guicolor_T rgb)
+{
+ term_rgb_color(T_8F, rgb);
+}
+
+ void
+term_bg_rgb_color(guicolor_T rgb)
+{
+ term_rgb_color(T_8B, rgb);
+}
#endif
#if (defined(FEAT_TITLE) && (defined(UNIX) || defined(VMS) \