Mercurial > vim
diff src/term.c @ 9939:ccb6461b82df v7.4.2243
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Aug 22 23:04:33 2016 +0200
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 22 Aug 2016 23:15:07 +0200 |
parents | 579abc260d85 |
children | 4aead6a9b7a9 |
line wrap: on
line diff
--- 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) \