Mercurial > vim
comparison src/syntax.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 | 7da89d9c744b |
children | 4aead6a9b7a9 |
comparison
equal
deleted
inserted
replaced
9938:5eb7fba8ec4e | 9939:ccb6461b82df |
---|---|
8486 #endif | 8486 #endif |
8487 #ifdef FEAT_GUI | 8487 #ifdef FEAT_GUI |
8488 return gui.norm_pixel; | 8488 return gui.norm_pixel; |
8489 #endif | 8489 #endif |
8490 #ifdef FEAT_TERMGUICOLORS | 8490 #ifdef FEAT_TERMGUICOLORS |
8491 if (cterm_normal_fg_gui_color != (long_u)INVALCOLOR) | 8491 if (cterm_normal_fg_gui_color != INVALCOLOR) |
8492 return cterm_normal_fg_gui_color; | 8492 return cterm_normal_fg_gui_color; |
8493 /* Guess that the foreground is black or white. */ | 8493 /* Guess that the foreground is black or white. */ |
8494 return GUI_GET_COLOR((char_u *)(*p_bg == 'l' ? "black" : "white")); | 8494 return GUI_GET_COLOR((char_u *)(*p_bg == 'l' ? "black" : "white")); |
8495 #endif | 8495 #endif |
8496 } | 8496 } |
8501 #endif | 8501 #endif |
8502 #ifdef FEAT_GUI | 8502 #ifdef FEAT_GUI |
8503 return gui.back_pixel; | 8503 return gui.back_pixel; |
8504 #endif | 8504 #endif |
8505 #ifdef FEAT_TERMGUICOLORS | 8505 #ifdef FEAT_TERMGUICOLORS |
8506 if (cterm_normal_bg_gui_color != (long_u)INVALCOLOR) | 8506 if (cterm_normal_bg_gui_color != INVALCOLOR) |
8507 return cterm_normal_bg_gui_color; | 8507 return cterm_normal_bg_gui_color; |
8508 /* Guess that the background is white or black. */ | 8508 /* Guess that the background is white or black. */ |
8509 return GUI_GET_COLOR((char_u *)(*p_bg == 'l' ? "white" : "black")); | 8509 return GUI_GET_COLOR((char_u *)(*p_bg == 'l' ? "white" : "black")); |
8510 #endif | 8510 #endif |
8511 } | 8511 } |
8780 if (spell_aep->ae_u.cterm.fg_color > 0) | 8780 if (spell_aep->ae_u.cterm.fg_color > 0) |
8781 new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color; | 8781 new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color; |
8782 if (spell_aep->ae_u.cterm.bg_color > 0) | 8782 if (spell_aep->ae_u.cterm.bg_color > 0) |
8783 new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color; | 8783 new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color; |
8784 #ifdef FEAT_TERMGUICOLORS | 8784 #ifdef FEAT_TERMGUICOLORS |
8785 if (spell_aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR) | 8785 if (spell_aep->ae_u.cterm.fg_rgb != INVALCOLOR) |
8786 new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb; | 8786 new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb; |
8787 if (spell_aep->ae_u.cterm.bg_rgb != (long_u)INVALCOLOR) | 8787 if (spell_aep->ae_u.cterm.bg_rgb != INVALCOLOR) |
8788 new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb; | 8788 new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb; |
8789 #endif | 8789 #endif |
8790 } | 8790 } |
8791 } | 8791 } |
8792 return get_attr_entry(&cterm_attr_table, &new_en); | 8792 return get_attr_entry(&cterm_attr_table, &new_en); |
9074 # endif | 9074 # endif |
9075 else | 9075 else |
9076 color = HL_TABLE()[id - 1].sg_gui_bg; | 9076 color = HL_TABLE()[id - 1].sg_gui_bg; |
9077 if (color == INVALCOLOR) | 9077 if (color == INVALCOLOR) |
9078 return NULL; | 9078 return NULL; |
9079 rgb = GUI_MCH_GET_RGB(color); | 9079 rgb = (long_u)GUI_MCH_GET_RGB(color); |
9080 sprintf((char *)buf, "#%02x%02x%02x", | 9080 sprintf((char *)buf, "#%02x%02x%02x", |
9081 (unsigned)(rgb >> 16), | 9081 (unsigned)(rgb >> 16), |
9082 (unsigned)(rgb >> 8) & 255, | 9082 (unsigned)(rgb >> 8) & 255, |
9083 (unsigned)rgb & 255); | 9083 (unsigned)rgb & 255); |
9084 return buf; | 9084 return buf; |