patch 7.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.
diff --git a/src/term.c b/src/term.c
index 4d505e3..9879ba8 100644
--- a/src/term.c
+++ b/src/term.c
@@ -77,9 +77,6 @@
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 @@
return t;
}
- long_u
+ guicolor_T
termgui_mch_get_rgb(guicolor_T color)
{
- return (long_u)color;
+ return color;
}
#endif
@@ -2634,24 +2631,13 @@
}
#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 @@
(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) \