mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
Warning cleanup
This commit is contained in:
parent
1b8f1650dc
commit
2e1b3325c6
26 changed files with 94 additions and 126 deletions
|
@ -779,7 +779,7 @@
|
|||
D0A084F213B3AC130099B651 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0420;
|
||||
LastUpgradeCheck = 0440;
|
||||
};
|
||||
buildConfigurationList = D0A084F513B3AC130099B651 /* Build configuration list for PBXProject "FishsFish" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
|
@ -1054,6 +1054,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUGGING_SYMBOLS = YES;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
|
@ -1070,6 +1071,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
|
@ -1083,6 +1085,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
EXECUTABLE_NAME = fish_launcher;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
|
@ -1102,6 +1105,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
EXECUTABLE_NAME = fish_launcher;
|
||||
|
@ -1248,6 +1252,7 @@
|
|||
D0F019EE15A976F30034B3B1 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -1255,6 +1260,7 @@
|
|||
D0F019EF15A976F30034B3B1 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
|
|
|
@ -108,7 +108,7 @@ int autoload_t::load( const wcstring &cmd, bool reload )
|
|||
res = this->locate_file_and_maybe_load_it( cmd, true, reload, path_list );
|
||||
|
||||
/* Clean up */
|
||||
int erased = is_loading_set.erase(cmd);
|
||||
bool erased = !! is_loading_set.erase(cmd);
|
||||
assert(erased);
|
||||
|
||||
return res;
|
||||
|
|
|
@ -94,7 +94,7 @@ static void replace_part( const wchar_t *begin,
|
|||
int append_mode )
|
||||
{
|
||||
const wchar_t *buff = get_buffer();
|
||||
int out_pos=get_cursor_pos();
|
||||
long out_pos=get_cursor_pos();
|
||||
|
||||
wcstring out;
|
||||
|
||||
|
@ -118,7 +118,7 @@ static void replace_part( const wchar_t *begin,
|
|||
}
|
||||
case INSERT_MODE:
|
||||
{
|
||||
int cursor = get_cursor_pos() -(begin-buff);
|
||||
long cursor = get_cursor_pos() -(begin-buff);
|
||||
out.append( begin, cursor );
|
||||
out.append( insert );
|
||||
out.append( begin+cursor, end-begin-cursor );
|
||||
|
@ -127,7 +127,7 @@ static void replace_part( const wchar_t *begin,
|
|||
}
|
||||
}
|
||||
out.append( end );
|
||||
reader_set_buffer( out, out_pos );
|
||||
reader_set_buffer( out, (int)out_pos );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,12 +222,12 @@ static int builtin_commandline( parser_t &parser, wchar_t **argv )
|
|||
current_buffer = (wchar_t *)builtin_complete_get_temporary_buffer();
|
||||
if( current_buffer )
|
||||
{
|
||||
current_cursor_pos = wcslen( current_buffer );
|
||||
current_cursor_pos = (int)wcslen( current_buffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
current_buffer = reader_get_buffer();
|
||||
current_cursor_pos = reader_get_cursor_pos();
|
||||
current_cursor_pos = (int)reader_get_cursor_pos();
|
||||
}
|
||||
|
||||
if( !get_buffer() )
|
||||
|
@ -531,7 +531,7 @@ static int builtin_commandline( parser_t &parser, wchar_t **argv )
|
|||
if( argc-woptind )
|
||||
{
|
||||
wchar_t *endptr;
|
||||
int new_pos;
|
||||
long new_pos;
|
||||
errno = 0;
|
||||
|
||||
new_pos = wcstol( argv[woptind], &endptr, 10 );
|
||||
|
@ -545,7 +545,7 @@ static int builtin_commandline( parser_t &parser, wchar_t **argv )
|
|||
}
|
||||
|
||||
current_buffer = reader_get_buffer();
|
||||
new_pos = maxi( 0, mini( new_pos, wcslen( current_buffer ) ) );
|
||||
new_pos = maxi( 0L, mini( (long)new_pos, (long)wcslen( current_buffer ) ) );
|
||||
reader_set_buffer( current_buffer, new_pos );
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -305,7 +305,7 @@ static int builtin_jobs( parser_t &parser, wchar_t **argv )
|
|||
return 1;
|
||||
}
|
||||
|
||||
j = job_get_from_pid( pid );
|
||||
j = job_get_from_pid( (int)pid );
|
||||
|
||||
if( j && !job_is_completed( j ) )
|
||||
{
|
||||
|
|
|
@ -174,7 +174,7 @@ static int my_env_set( const wchar_t *key, const wcstring_list_t &val, int scope
|
|||
static int parse_index( std::vector<long> &indexes,
|
||||
const wchar_t *src,
|
||||
const wchar_t *name,
|
||||
int var_count )
|
||||
size_t var_count )
|
||||
{
|
||||
size_t len;
|
||||
|
||||
|
@ -715,7 +715,7 @@ static int builtin_set( parser_t &parser, wchar_t **argv )
|
|||
/*
|
||||
Slice mode
|
||||
*/
|
||||
int idx_count, val_count;
|
||||
size_t idx_count, val_count;
|
||||
wcstring_list_t values;
|
||||
std::vector<long> indexes;
|
||||
wcstring_list_t result;
|
||||
|
|
20
common.cpp
20
common.cpp
|
@ -620,7 +620,7 @@ __sentinel bool contains_internal( const wcstring &needle, ... )
|
|||
|
||||
int read_blocked(int fd, void *buf, size_t count)
|
||||
{
|
||||
int res;
|
||||
ssize_t res;
|
||||
sigset_t chldset, oldset;
|
||||
|
||||
sigemptyset( &chldset );
|
||||
|
@ -628,7 +628,7 @@ int read_blocked(int fd, void *buf, size_t count)
|
|||
VOMIT_ON_FAILURE(pthread_sigmask(SIG_BLOCK, &chldset, &oldset));
|
||||
res = read( fd, buf, count );
|
||||
VOMIT_ON_FAILURE(pthread_sigmask(SIG_SETMASK, &oldset, NULL));
|
||||
return res;
|
||||
return (int)res;
|
||||
}
|
||||
|
||||
ssize_t write_loop(int fd, const char *buff, size_t count)
|
||||
|
@ -798,7 +798,7 @@ void format_long_safe(wchar_t buff[128], long val) {
|
|||
while (val > 0) {
|
||||
long rem = val % 10;
|
||||
/* Here we're assuming that wide character digits are contiguous - is that a correct assumption? */
|
||||
buff[idx++] = L'0' + (rem < 0 ? -rem : rem);
|
||||
buff[idx++] = L'0' + (wchar_t)(rem < 0 ? -rem : rem);
|
||||
val /= 10;
|
||||
}
|
||||
if (negative)
|
||||
|
@ -1114,8 +1114,10 @@ wcstring escape_string( const wcstring &in, escape_flags_t flags ) {
|
|||
wchar_t *unescape( const wchar_t * orig, int flags )
|
||||
{
|
||||
|
||||
int mode = 0;
|
||||
int in_pos, out_pos, len;
|
||||
int mode = 0;
|
||||
int out_pos;
|
||||
size_t in_pos;
|
||||
size_t len;
|
||||
int c;
|
||||
int bracket_count=0;
|
||||
wchar_t prev=0;
|
||||
|
@ -1131,7 +1133,7 @@ wchar_t *unescape( const wchar_t * orig, int flags )
|
|||
if( !in )
|
||||
DIE_MEM();
|
||||
|
||||
for( in_pos=0, out_pos=0;
|
||||
for( in_pos=0, out_pos=0;
|
||||
in_pos<len;
|
||||
(prev=(out_pos>=0)?in[out_pos]:0), out_pos++, in_pos++ )
|
||||
{
|
||||
|
@ -1220,6 +1222,8 @@ wchar_t *unescape( const wchar_t * orig, int flags )
|
|||
{
|
||||
base=8;
|
||||
chars=3;
|
||||
// note in_pod must be larger than 0 since we incremented it above
|
||||
assert(in_pos > 0);
|
||||
in_pos--;
|
||||
break;
|
||||
}
|
||||
|
@ -1227,7 +1231,7 @@ wchar_t *unescape( const wchar_t * orig, int flags )
|
|||
|
||||
for( i=0; i<chars; i++ )
|
||||
{
|
||||
int d = convert_digit( in[++in_pos],base);
|
||||
long d = convert_digit( in[++in_pos],base);
|
||||
|
||||
if( d < 0 )
|
||||
{
|
||||
|
@ -1240,7 +1244,7 @@ wchar_t *unescape( const wchar_t * orig, int flags )
|
|||
|
||||
if( (res <= max_val) )
|
||||
{
|
||||
in[out_pos] = (byte?ENCODE_DIRECT_BASE:0)+res;
|
||||
in[out_pos] = (wchar_t)((byte?ENCODE_DIRECT_BASE:0)+res);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
6
common.h
6
common.h
|
@ -135,7 +135,7 @@ extern const wchar_t *program_name;
|
|||
*/
|
||||
#define FATAL_EXIT() \
|
||||
{ \
|
||||
int exit_read_count;char exit_read_buff; \
|
||||
ssize_t exit_read_count;char exit_read_buff; \
|
||||
show_stackframe(); \
|
||||
exit_read_count=read( 0, &exit_read_buff, 1 ); \
|
||||
exit_without_destructors( 1 ); \
|
||||
|
@ -148,8 +148,8 @@ extern const wchar_t *program_name;
|
|||
#define DIE_MEM() \
|
||||
{ \
|
||||
fwprintf( stderr, \
|
||||
L"fish: Out of memory on line %d of file %s, shutting down fish\n", \
|
||||
__LINE__, \
|
||||
L"fish: Out of memory on line %ld of file %s, shutting down fish\n", \
|
||||
(long)__LINE__, \
|
||||
__FILE__ ); \
|
||||
FATAL_EXIT(); \
|
||||
}
|
||||
|
|
|
@ -912,7 +912,6 @@ void completer_t::complete_cmd_desc( const wcstring &str )
|
|||
ASSERT_IS_MAIN_THREAD();
|
||||
|
||||
const wchar_t *cmd_start;
|
||||
int cmd_len;
|
||||
int skip;
|
||||
|
||||
const wchar_t * const cmd = str.c_str();
|
||||
|
@ -923,14 +922,12 @@ void completer_t::complete_cmd_desc( const wcstring &str )
|
|||
else
|
||||
cmd_start = cmd;
|
||||
|
||||
cmd_len = wcslen(cmd_start);
|
||||
|
||||
/*
|
||||
Using apropos with a single-character search term produces far
|
||||
to many results - require at least two characters if we don't
|
||||
know the location of the whatis-database.
|
||||
*/
|
||||
if(cmd_len < 2 )
|
||||
if (wcslen(cmd_start) < 2)
|
||||
return;
|
||||
|
||||
if( wildcard_has( cmd_start, 0 ) )
|
||||
|
|
5
env.cpp
5
env.cpp
|
@ -766,15 +766,14 @@ int env_set(const wcstring &key, const wchar_t *val, int var_mode)
|
|||
if (key == L"umask")
|
||||
{
|
||||
wchar_t *end;
|
||||
int mask;
|
||||
|
||||
|
||||
/*
|
||||
Set the new umask
|
||||
*/
|
||||
if( val && wcslen(val) )
|
||||
{
|
||||
errno=0;
|
||||
mask = wcstol( val, &end, 8 );
|
||||
long mask = wcstol( val, &end, 8 );
|
||||
|
||||
if( !errno && (!*end) && (mask <= 0777) && (mask >= 0) )
|
||||
{
|
||||
|
|
|
@ -915,7 +915,7 @@ int wcwidth( wchar_t c )
|
|||
#endif
|
||||
|
||||
#ifndef HAVE_WCSNDUP
|
||||
wchar_t *wcsndup( const wchar_t *in, int c )
|
||||
wchar_t *wcsndup( const wchar_t *in, size_t c )
|
||||
{
|
||||
wchar_t *res = (wchar_t *)malloc( sizeof(wchar_t)*(c+1) );
|
||||
if( res == 0 )
|
||||
|
|
|
@ -290,7 +290,7 @@ int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
|
|||
Fallback for wcsndup function. Returns a copy of \c in, truncated
|
||||
to a maximum length of \c c.
|
||||
*/
|
||||
wchar_t *wcsndup( const wchar_t *in, int c );
|
||||
wchar_t *wcsndup( const wchar_t *in, size_t c );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
4
fish.cpp
4
fish.cpp
|
@ -319,14 +319,14 @@ static int fish_parse_opt( int argc, char **argv, const char **cmd_ptr )
|
|||
case 'd':
|
||||
{
|
||||
char *end;
|
||||
int tmp;
|
||||
long tmp;
|
||||
|
||||
errno = 0;
|
||||
tmp = strtol(optarg, &end, 10);
|
||||
|
||||
if( tmp >= 0 && tmp <=10 && !*end && !errno )
|
||||
{
|
||||
debug_level=tmp;
|
||||
debug_level = (int)tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -483,8 +483,8 @@ static void completion_print( int cols,
|
|||
std::vector<comp_t *> &lst )
|
||||
{
|
||||
|
||||
int rows = (lst.size()-1)/cols+1;
|
||||
int i, j;
|
||||
size_t rows = (lst.size()-1)/cols+1;
|
||||
size_t i, j;
|
||||
|
||||
for( i = row_start; i<row_stop; i++ )
|
||||
{
|
||||
|
@ -551,7 +551,7 @@ static int completion_try_print( int cols,
|
|||
|
||||
int i, j;
|
||||
|
||||
int rows = (lst.size()-1)/cols+1;
|
||||
long rows = (lst.size()-1)/cols+1;
|
||||
|
||||
int pref_tot_width=0;
|
||||
int min_tot_width = 0;
|
||||
|
@ -758,8 +758,7 @@ static int completion_try_print( int cols,
|
|||
case PAGE_DOWN:
|
||||
{
|
||||
|
||||
npos = mini( rows - termsize.ws_row+1,
|
||||
pos + termsize.ws_row-1 );
|
||||
npos = mini( (int)(rows - termsize.ws_row+1), (int)(pos + termsize.ws_row-1) );
|
||||
if( npos != pos )
|
||||
{
|
||||
pos = npos;
|
||||
|
|
|
@ -309,15 +309,14 @@ static bool is_potential_cd_path(const wcstring &path, const wcstring &working_d
|
|||
|
||||
rgb_color_t highlight_get_color( int highlight, bool is_background )
|
||||
{
|
||||
size_t i;
|
||||
int idx=0;
|
||||
size_t idx=0;
|
||||
rgb_color_t result;
|
||||
|
||||
if( highlight < 0 )
|
||||
return rgb_color_t::normal();
|
||||
if( highlight > (1<<VAR_COUNT) )
|
||||
return rgb_color_t::normal();
|
||||
for( i=0; i<VAR_COUNT; i++ )
|
||||
for( size_t i=0; i<VAR_COUNT; i++ )
|
||||
{
|
||||
if( highlight & (1<<i ))
|
||||
{
|
||||
|
@ -456,7 +455,7 @@ static void highlight_param( const wcstring &buffstr, std::vector<int> &colors,
|
|||
|
||||
for( i=0; i<chars; i++ )
|
||||
{
|
||||
int d = convert_digit( buff[++in_pos],base);
|
||||
long d = convert_digit( buff[++in_pos],base);
|
||||
|
||||
if( d < 0 )
|
||||
{
|
||||
|
|
|
@ -217,7 +217,7 @@ wchar_t input_common_readch( int timed )
|
|||
wint_t b = readb();
|
||||
char bb;
|
||||
|
||||
int sz;
|
||||
size_t sz;
|
||||
|
||||
if( (b >= R_NULL) && (b < R_NULL + 1000) )
|
||||
return b;
|
||||
|
@ -228,11 +228,11 @@ wchar_t input_common_readch( int timed )
|
|||
|
||||
switch( sz )
|
||||
{
|
||||
case -1:
|
||||
case (size_t)(-1):
|
||||
memset (&state, '\0', sizeof (state));
|
||||
debug( 2, L"Illegal input" );
|
||||
return R_NULL;
|
||||
case -2:
|
||||
case (size_t)(-2):
|
||||
break;
|
||||
case 0:
|
||||
return 0;
|
||||
|
|
|
@ -182,7 +182,7 @@ int parse_util_get_offset( const wcstring &str, int line, int line_offset )
|
|||
|
||||
if( off2 < 0 )
|
||||
{
|
||||
off2 = wcslen( buff )+1;
|
||||
off2 = (int)(wcslen( buff )+1);
|
||||
}
|
||||
|
||||
if( line_offset2 < 0 )
|
||||
|
@ -369,7 +369,7 @@ static void job_or_process_extent( const wchar_t *buff,
|
|||
int process )
|
||||
{
|
||||
const wchar_t *begin, *end;
|
||||
int pos;
|
||||
long pos;
|
||||
wchar_t *buffcpy;
|
||||
int finished=0;
|
||||
|
||||
|
@ -484,7 +484,7 @@ void parse_util_token_extent( const wchar_t *buff,
|
|||
const wchar_t **prev_end )
|
||||
{
|
||||
const wchar_t *begin, *end;
|
||||
int pos;
|
||||
long pos;
|
||||
wchar_t *buffcpy;
|
||||
|
||||
tokenizer tok;
|
||||
|
@ -714,9 +714,9 @@ wchar_t *parse_util_unescape_wildcards( const wchar_t *str )
|
|||
token is not quoted.
|
||||
|
||||
*/
|
||||
static wchar_t get_quote( const wchar_t *cmd, int len )
|
||||
static wchar_t get_quote( const wchar_t *cmd, size_t len )
|
||||
{
|
||||
int i=0;
|
||||
size_t i=0;
|
||||
wchar_t res=0;
|
||||
|
||||
while( 1 )
|
||||
|
@ -780,7 +780,7 @@ void parse_util_get_parameter_info( const wcstring &cmd, const size_t pos, wchar
|
|||
|
||||
wchar_t *cmd_tmp = wcsdup(cmd.c_str());
|
||||
cmd_tmp[pos]=0;
|
||||
int cmdlen = wcslen( cmd_tmp );
|
||||
size_t cmdlen = wcslen( cmd_tmp );
|
||||
unfinished = (cmdlen==0);
|
||||
if( !unfinished )
|
||||
{
|
||||
|
|
|
@ -2350,7 +2350,7 @@ void parser_t::eval_job( tokenizer *tok )
|
|||
{
|
||||
if( job_start_pos < tok_get_pos( tok ) )
|
||||
{
|
||||
int stop_pos = tok_get_pos( tok );
|
||||
long stop_pos = tok_get_pos( tok );
|
||||
const wchar_t *newline = wcschr(tok_string(tok)+start_pos, L'\n');
|
||||
if( newline )
|
||||
stop_pos = mini( stop_pos, newline - tok_string(tok) );
|
||||
|
|
2
proc.cpp
2
proc.cpp
|
@ -223,7 +223,7 @@ job_id_t acquire_job_id(void)
|
|||
{
|
||||
/* We found a slot. Note that slot 0 corresponds to job ID 1. */
|
||||
*slot = true;
|
||||
return slot - consumed_job_ids.begin() + 1;
|
||||
return (job_id_t)(slot - consumed_job_ids.begin() + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
12
reader.cpp
12
reader.cpp
|
@ -1953,7 +1953,7 @@ static void move_word( int dir, int erase, int newv )
|
|||
/*
|
||||
Make sure we don't move beyond begining or end of buffer
|
||||
*/
|
||||
end_buff_pos = maxi( 0, mini( end_buff_pos, data->command_length() ) );
|
||||
end_buff_pos = maxi( 0UL, mini( end_buff_pos, data->command_length() ) );
|
||||
|
||||
|
||||
|
||||
|
@ -1997,7 +1997,7 @@ void reader_set_buffer( const wcstring &b, int p )
|
|||
|
||||
if( p>=0 )
|
||||
{
|
||||
data->buff_pos=mini( p, l );
|
||||
data->buff_pos=mini( (size_t)p, l );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2724,7 +2724,7 @@ const wchar_t *reader_readline()
|
|||
const wchar_t *buff = data->command_line.c_str();
|
||||
const wchar_t *begin = &buff[data->buff_pos];
|
||||
const wchar_t *end = begin;
|
||||
int len;
|
||||
long len;
|
||||
|
||||
while( *end && *end != L'\n' )
|
||||
end++;
|
||||
|
@ -2749,7 +2749,7 @@ const wchar_t *reader_readline()
|
|||
const wchar_t *buff = data->command_line.c_str();
|
||||
const wchar_t *end = &buff[data->buff_pos];
|
||||
const wchar_t *begin = end;
|
||||
int len;
|
||||
long len;
|
||||
|
||||
while( begin > buff && *begin != L'\n' )
|
||||
begin--;
|
||||
|
@ -2757,7 +2757,7 @@ const wchar_t *reader_readline()
|
|||
if( *begin == L'\n' )
|
||||
begin++;
|
||||
|
||||
len = maxi( end-begin, 1 );
|
||||
len = maxi( end-begin, 1L );
|
||||
begin = end - len;
|
||||
|
||||
reader_kill( begin - buff, len, KILL_PREPEND, last_char!=R_BACKWARD_KILL_LINE );
|
||||
|
@ -2780,7 +2780,7 @@ const wchar_t *reader_readline()
|
|||
if( *begin == L'\n' )
|
||||
begin++;
|
||||
|
||||
len = maxi( end-begin, 0 );
|
||||
len = maxi( end-begin, 0L );
|
||||
begin = end - len;
|
||||
|
||||
while( *end && *end != L'\n' )
|
||||
|
|
15
screen.cpp
15
screen.cpp
|
@ -460,7 +460,7 @@ static void s_desired_append_char( screen_t *s,
|
|||
{
|
||||
s->desired.line(line_no).append(ellipsis_char, HIGHLIGHT_COMMENT);
|
||||
|
||||
line_no = s->desired.line_count();
|
||||
line_no = (int)s->desired.line_count();
|
||||
s->desired.add_line();
|
||||
s->desired.cursor[1]++;
|
||||
s->desired.cursor[0]=0;
|
||||
|
@ -653,7 +653,6 @@ static size_t line_shared_prefix(const line_t &a, const line_t &b)
|
|||
*/
|
||||
static void s_update( screen_t *scr, const wchar_t *prompt )
|
||||
{
|
||||
size_t i;
|
||||
int prompt_width = calc_prompt_width( prompt );
|
||||
int screen_width = common_get_width();
|
||||
int need_clear = scr->need_clear;
|
||||
|
@ -677,7 +676,7 @@ static void s_update( screen_t *scr, const wchar_t *prompt )
|
|||
scr->actual.cursor[0] = prompt_width;
|
||||
}
|
||||
|
||||
for (i=0; i < scr->desired.line_count(); i++)
|
||||
for (size_t i=0; i < scr->desired.line_count(); i++)
|
||||
{
|
||||
const line_t &o_line = scr->desired.line(i);
|
||||
line_t &s_line = scr->actual.create_line(i);
|
||||
|
@ -686,7 +685,7 @@ static void s_update( screen_t *scr, const wchar_t *prompt )
|
|||
|
||||
if( need_clear )
|
||||
{
|
||||
s_move( scr, &output, start_pos, i );
|
||||
s_move( scr, &output, start_pos, (int)i );
|
||||
s_write_mbs( &output, clr_eol);
|
||||
s_line.clear();
|
||||
}
|
||||
|
@ -725,7 +724,7 @@ static void s_update( screen_t *scr, const wchar_t *prompt )
|
|||
/* Now actually output stuff */
|
||||
for ( ; j < o_line.size(); j++)
|
||||
{
|
||||
s_move( scr, &output, current_width, i );
|
||||
s_move( scr, &output, current_width, (int)i );
|
||||
s_set_color( scr, &output, o_line.color_at(j) );
|
||||
s_write_char( scr, &output, o_line.char_at(j) );
|
||||
current_width += fish_wcwidth(o_line.char_at(j));
|
||||
|
@ -735,15 +734,15 @@ static void s_update( screen_t *scr, const wchar_t *prompt )
|
|||
int prev_length = (s_line.text.empty() ? 0 : fish_wcswidth(&s_line.text.at(0), s_line.text.size()));
|
||||
if (prev_length > current_width )
|
||||
{
|
||||
s_move( scr, &output, current_width, i );
|
||||
s_move( scr, &output, current_width, (int)i );
|
||||
s_write_mbs( &output, clr_eol);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear remaining lines */
|
||||
for( i=scr->desired.line_count(); i < scr->actual.line_count(); i++ )
|
||||
for( size_t i=scr->desired.line_count(); i < scr->actual.line_count(); i++ )
|
||||
{
|
||||
s_move( scr, &output, 0, i );
|
||||
s_move( scr, &output, 0, (int)i );
|
||||
s_write_mbs( &output, clr_eol);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,35 +94,6 @@ const int col_idx[]=
|
|||
8
|
||||
};
|
||||
|
||||
int translate_color( char *str )
|
||||
{
|
||||
char *endptr;
|
||||
int color;
|
||||
|
||||
if( !str )
|
||||
return -1;
|
||||
|
||||
errno = 0;
|
||||
color = strtol( str, &endptr, 10 );
|
||||
|
||||
if( *endptr || color<0 || errno )
|
||||
{
|
||||
size_t i;
|
||||
color = -1;
|
||||
for( i=0; i<COLORS; i++ )
|
||||
{
|
||||
|
||||
if( strcasecmp( col[i], str ) == 0 )
|
||||
{
|
||||
color = col_idx[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return color;
|
||||
|
||||
}
|
||||
|
||||
void print_colors()
|
||||
{
|
||||
size_t i;
|
||||
|
|
|
@ -373,7 +373,7 @@ static int match_signal_name( const wchar_t *canonical,
|
|||
|
||||
int wcs2sig( const wchar_t *str )
|
||||
{
|
||||
int i, res;
|
||||
int i;
|
||||
wchar_t *end=0;
|
||||
|
||||
for( i=0; lookup[i].desc ; i++ )
|
||||
|
@ -384,9 +384,9 @@ int wcs2sig( const wchar_t *str )
|
|||
}
|
||||
}
|
||||
errno=0;
|
||||
res = wcstol( str, &end, 10 );
|
||||
if( !errno && res>=0 && !*end )
|
||||
return res;
|
||||
long res = wcstol( str, &end, 10 );
|
||||
if( !errno && res>=0 && res <= INT_MAX && !*end )
|
||||
return (int)res;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ static int myal( wchar_t c )
|
|||
static void read_string( tokenizer *tok )
|
||||
{
|
||||
const wchar_t *start;
|
||||
int len;
|
||||
long len;
|
||||
int mode=0;
|
||||
int do_loop=1;
|
||||
int paran_count=0;
|
||||
|
|
21
util.cpp
21
util.cpp
|
@ -47,19 +47,6 @@
|
|||
*/
|
||||
#define SB_MAX_SIZE (128*1024*1024)
|
||||
|
||||
int mini( int a,
|
||||
int b )
|
||||
{
|
||||
return a<b?a:b;
|
||||
}
|
||||
|
||||
|
||||
int maxi( int a,
|
||||
int b )
|
||||
{
|
||||
return a>b?a:b;
|
||||
}
|
||||
|
||||
int wcsfilecmp( const wchar_t *a, const wchar_t *b )
|
||||
{
|
||||
CHECK( a, 0 );
|
||||
|
@ -76,13 +63,13 @@ int wcsfilecmp( const wchar_t *a, const wchar_t *b )
|
|||
return 1;
|
||||
}
|
||||
|
||||
int secondary_diff=0;
|
||||
long secondary_diff=0;
|
||||
if( iswdigit( *a ) && iswdigit( *b ) )
|
||||
{
|
||||
wchar_t *aend, *bend;
|
||||
long al;
|
||||
long bl;
|
||||
int diff;
|
||||
long diff;
|
||||
|
||||
errno = 0;
|
||||
al = wcstol( a, &aend, 10 );
|
||||
|
@ -98,7 +85,7 @@ int wcsfilecmp( const wchar_t *a, const wchar_t *b )
|
|||
|
||||
diff = al - bl;
|
||||
if( diff )
|
||||
return diff>0?2:-2;
|
||||
return diff > 0 ? 2 : -2;
|
||||
|
||||
secondary_diff = (aend-a) - (bend-b);
|
||||
|
||||
|
@ -124,7 +111,7 @@ int wcsfilecmp( const wchar_t *a, const wchar_t *b )
|
|||
*/
|
||||
if( secondary_diff )
|
||||
{
|
||||
return secondary_diff>0?1:-1;
|
||||
return secondary_diff > 0 ? 1 :-1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
12
util.h
12
util.h
|
@ -29,12 +29,20 @@ buffer_t;
|
|||
/**
|
||||
Returns the larger of two ints
|
||||
*/
|
||||
int maxi( int a, int b );
|
||||
template<typename T>
|
||||
static inline T maxi( T a, T b )
|
||||
{
|
||||
return a>b?a:b;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the smaller of two ints
|
||||
*/
|
||||
int mini( int a, int b );
|
||||
template<typename T>
|
||||
static inline T mini( T a, T b )
|
||||
{
|
||||
return a<b?a:b;
|
||||
}
|
||||
|
||||
/**
|
||||
Compares two wide character strings with an (arguably) intuitive
|
||||
|
|
|
@ -366,7 +366,7 @@ static wcstring complete_get_desc_suffix_internal( const wcstring &suff )
|
|||
static wcstring complete_get_desc_suffix( const wchar_t *suff_orig )
|
||||
{
|
||||
|
||||
int len;
|
||||
size_t len;
|
||||
wchar_t *suff;
|
||||
wchar_t *pos;
|
||||
wchar_t *tmp;
|
||||
|
@ -687,7 +687,7 @@ static int wildcard_expand_internal( const wchar_t *wc,
|
|||
int res = 0;
|
||||
|
||||
/* Length of the directory to search in */
|
||||
int base_len;
|
||||
size_t base_len;
|
||||
|
||||
/* Variables for testing for presense of recursive wildcards */
|
||||
const wchar_t *wc_recursive;
|
||||
|
@ -714,7 +714,7 @@ static int wildcard_expand_internal( const wchar_t *wc,
|
|||
/*
|
||||
Avoid excessive number of returned matches for wc ending with a *
|
||||
*/
|
||||
int len = wcslen(wc);
|
||||
size_t len = wcslen(wc);
|
||||
if( len && (wc[len-1]==ANY_STRING) )
|
||||
{
|
||||
wchar_t * foo = wcsdup( wc );
|
||||
|
@ -942,7 +942,6 @@ static int wildcard_expand_internal( const wchar_t *wc,
|
|||
|
||||
if( whole_match || partial_match )
|
||||
{
|
||||
int new_len;
|
||||
struct stat buf;
|
||||
char *dir_str;
|
||||
int stat_res;
|
||||
|
@ -960,7 +959,7 @@ static int wildcard_expand_internal( const wchar_t *wc,
|
|||
{
|
||||
if( S_ISDIR(buf.st_mode) )
|
||||
{
|
||||
new_len = wcslen( new_dir );
|
||||
size_t new_len = wcslen( new_dir );
|
||||
new_dir[new_len] = L'/';
|
||||
new_dir[new_len+1] = L'\0';
|
||||
|
||||
|
|
Loading…
Reference in a new issue