mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
Improved const-correctness, eliminating warnings.
Migrated some int to size_t
This commit is contained in:
parent
f3e2d2f68f
commit
203c749e6c
7 changed files with 18 additions and 18 deletions
|
@ -127,7 +127,7 @@ static int get_names_show_unexported;
|
|||
/**
|
||||
List of names for the UTF-8 character set.
|
||||
*/
|
||||
static char *iconv_utf8_names[]=
|
||||
static const char *iconv_utf8_names[]=
|
||||
{
|
||||
"utf-8", "UTF-8",
|
||||
"utf8", "UTF8",
|
||||
|
@ -138,7 +138,7 @@ static char *iconv_utf8_names[]=
|
|||
/**
|
||||
List of wide character names, undefined byte length.
|
||||
*/
|
||||
static char *iconv_wide_names_unknown[]=
|
||||
static const char *iconv_wide_names_unknown[]=
|
||||
{
|
||||
"wchar_t", "WCHAR_T",
|
||||
"wchar", "WCHAR",
|
||||
|
@ -149,7 +149,7 @@ static char *iconv_wide_names_unknown[]=
|
|||
/**
|
||||
List of wide character names, 4 bytes long.
|
||||
*/
|
||||
static char *iconv_wide_names_4[]=
|
||||
static const char *iconv_wide_names_4[]=
|
||||
{
|
||||
"wchar_t", "WCHAR_T",
|
||||
"wchar", "WCHAR",
|
||||
|
@ -164,7 +164,7 @@ static char *iconv_wide_names_4[]=
|
|||
/**
|
||||
List of wide character names, 2 bytes long.
|
||||
*/
|
||||
static char *iconv_wide_names_2[]=
|
||||
static const char *iconv_wide_names_2[]=
|
||||
{
|
||||
"wchar_t", "WCHAR_T",
|
||||
"wchar", "WCHAR",
|
||||
|
@ -192,7 +192,7 @@ static wchar_t *utf2wcs( const char *in )
|
|||
really the character set used by wchar_t, but it is the best
|
||||
assumption we can make.
|
||||
*/
|
||||
char **to_name=0;
|
||||
const char **to_name=0;
|
||||
|
||||
switch (sizeof (wchar_t))
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ static wchar_t *utf2wcs( const char *in )
|
|||
/*
|
||||
The line protocol fish uses is always utf-8.
|
||||
*/
|
||||
char **from_name = iconv_utf8_names;
|
||||
const char **from_name = iconv_utf8_names;
|
||||
|
||||
size_t in_len = strlen( in );
|
||||
size_t out_len = sizeof( wchar_t )*(in_len+2);
|
||||
|
@ -306,7 +306,7 @@ static char *wcs2utf( const wchar_t *in )
|
|||
really the character set used by wchar_t, but it is the best
|
||||
assumption we can make.
|
||||
*/
|
||||
char **from_name=0;
|
||||
const char **from_name=0;
|
||||
|
||||
switch (sizeof (wchar_t))
|
||||
{
|
||||
|
@ -324,7 +324,7 @@ static char *wcs2utf( const wchar_t *in )
|
|||
break;
|
||||
}
|
||||
|
||||
char **to_name = iconv_utf8_names;
|
||||
const char **to_name = iconv_utf8_names;
|
||||
|
||||
size_t in_len = wcslen( in );
|
||||
size_t out_len = sizeof( char )*( (MAX_UTF8_BYTES*in_len)+1);
|
||||
|
|
|
@ -146,7 +146,7 @@ static buffer_t *pager_buffer;
|
|||
The environment variables used to specify the color of different
|
||||
tokens.
|
||||
*/
|
||||
static wchar_t *hightlight_var[] =
|
||||
static const wchar_t *hightlight_var[] =
|
||||
{
|
||||
L"fish_pager_color_prefix",
|
||||
L"fish_pager_color_completion",
|
||||
|
@ -247,7 +247,7 @@ static void recalc_width( array_list_t *l, const wchar_t *prefix )
|
|||
Test if the specified character sequence has been entered on the
|
||||
keyboard
|
||||
*/
|
||||
static int try_sequence( char *seq )
|
||||
static int try_sequence( const char *seq )
|
||||
{
|
||||
int j, k;
|
||||
wint_t c=0;
|
||||
|
@ -277,7 +277,7 @@ static wint_t readch()
|
|||
{
|
||||
struct mapping
|
||||
{
|
||||
char *seq;
|
||||
const char *seq;
|
||||
wint_t bnd;
|
||||
}
|
||||
;
|
||||
|
|
|
@ -147,7 +147,7 @@ static int quit=0;
|
|||
static char *get_socket_filename()
|
||||
{
|
||||
char *name;
|
||||
char *dir = getenv( "FISHD_SOCKET_DIR" );
|
||||
const char *dir = getenv( "FISHD_SOCKET_DIR" );
|
||||
char *uname = getenv( "USER" );
|
||||
|
||||
if( dir == NULL )
|
||||
|
|
|
@ -67,7 +67,7 @@ static int writeb_internal( char c );
|
|||
/**
|
||||
Names of different colors.
|
||||
*/
|
||||
static wchar_t *col[]=
|
||||
static const wchar_t *col[]=
|
||||
{
|
||||
L"black",
|
||||
L"red",
|
||||
|
@ -89,7 +89,7 @@ static wchar_t *col[]=
|
|||
in highlight.h. Non-ANSI terminals will display the wrong colors,
|
||||
since they use a different mapping.
|
||||
*/
|
||||
static int col_idx[]=
|
||||
static const int col_idx[]=
|
||||
{
|
||||
0,
|
||||
1,
|
||||
|
|
|
@ -1124,7 +1124,7 @@ static int printed_width( const wchar_t *str, int len )
|
|||
}
|
||||
|
||||
|
||||
wchar_t *parser_current_line()
|
||||
const wchar_t *parser_current_line()
|
||||
{
|
||||
int lineno=1;
|
||||
|
||||
|
|
2
parser.h
2
parser.h
|
@ -228,7 +228,7 @@ void error( int ec, int p, const wchar_t *str, ... );
|
|||
|
||||
init.fish (line 127): ls|grep pancake
|
||||
*/
|
||||
wchar_t *parser_current_line();
|
||||
const wchar_t *parser_current_line();
|
||||
|
||||
/**
|
||||
Returns the current line number
|
||||
|
|
|
@ -656,7 +656,7 @@ void reader_write_title()
|
|||
proc_push_interactive(0);
|
||||
if( exec_subshell2( title, lst ) != -1 )
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
if( lst.size() > 0 )
|
||||
{
|
||||
writestr( L"\x1b]2;" );
|
||||
|
@ -782,7 +782,7 @@ static void remove_backward()
|
|||
static int insert_str(const wchar_t *str)
|
||||
{
|
||||
int len = wcslen( str );
|
||||
int old_len = data->buff_len;
|
||||
size_t old_len = data->buff_len;
|
||||
|
||||
assert( data->buff_pos >= 0 );
|
||||
assert( data->buff_pos <= data->buff_len );
|
||||
|
|
Loading…
Reference in a new issue