Unbreak C++11 due to narrowing; use non-conflicting declaration FISH_COLORS instead of COLORS; remove deprecated register type.

This commit is contained in:
ridiculousfish 2014-02-05 16:20:09 -08:00
parent 35f2302352
commit fd10844c2b
3 changed files with 10 additions and 6 deletions

View file

@ -52,7 +52,7 @@
/** /**
Number of color names in the col array Number of color names in the col array
*/ */
#define COLORS (sizeof(col)/sizeof(wchar_t *)) #define FISH_COLORS (sizeof(col)/sizeof(wchar_t *))
static int writeb_internal(char c); static int writeb_internal(char c);
@ -622,7 +622,7 @@ int output_color_code(const wcstring &val, bool is_background)
if (! color_name.empty()) if (! color_name.empty())
{ {
for (i=0; i<COLORS; i++) for (i=0; i<FISH_COLORS; i++)
{ {
if (wcscasecmp(col[i], color_name.c_str()) == 0) if (wcscasecmp(col[i], color_name.c_str()) == 0)
{ {

View file

@ -1065,10 +1065,14 @@ static parse_keyword_t keyword_for_token(token_type tok, const wchar_t *tok_txt)
} }
/* Placeholder invalid token */ /* Placeholder invalid token */
static const parse_token_t kInvalidToken = {token_type_invalid, parse_keyword_none, false, false, -1, -1}; static const parse_token_t kInvalidToken = {token_type_invalid,
parse_keyword_none, false, false, static_cast<size_t>(-1),
static_cast<size_t>(-1)};
/* Terminal token */ /* Terminal token */
static const parse_token_t kTerminalToken = {parse_token_type_terminate, parse_keyword_none, false, false, -1, -1}; static const parse_token_t kTerminalToken = {parse_token_type_terminate,
parse_keyword_none, false, false, static_cast<size_t>(-1),
static_cast<size_t>(-1)};
static inline bool is_help_argument(const wchar_t *txt) static inline bool is_help_argument(const wchar_t *txt)
{ {

View file

@ -270,7 +270,7 @@ exchange(wchar_t **argv)
{ {
/* Bottom segment is the short one. */ /* Bottom segment is the short one. */
int len = middle - bottom; int len = middle - bottom;
register int i; short i;
/* Swap it with the top part of the top segment. */ /* Swap it with the top part of the top segment. */
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
@ -286,7 +286,7 @@ exchange(wchar_t **argv)
{ {
/* Top segment is the short one. */ /* Top segment is the short one. */
int len = top - middle; int len = top - middle;
register int i; short i;
/* Swap it with the bottom part of the bottom segment. */ /* Swap it with the bottom part of the bottom segment. */
for (i = 0; i < len; i++) for (i = 0; i < len; i++)