Lots of work towards making fish build without warnings on Mountain Lion, mostly in terms of using size_t instead of int

This commit is contained in:
ridiculousfish 2012-08-01 16:32:52 -07:00
parent 2e1b3325c6
commit 8185bee4b8
17 changed files with 85 additions and 85 deletions

View file

@ -1692,7 +1692,7 @@ static int builtin_function( parser_t &parser, wchar_t **argv )
else else
{ {
errno = 0; errno = 0;
pid = wcstol( woptarg, &end, 10 ); pid = (pid_t)wcstol( woptarg, &end, 10 );
if( errno || !end || *end ) if( errno || !end || *end )
{ {
append_format(stderr_buffer, append_format(stderr_buffer,
@ -1821,7 +1821,7 @@ static int builtin_function( parser_t &parser, wchar_t **argv )
for( i=0; i<names.size(); i++ ) for( i=0; i<names.size(); i++ )
{ {
const wchar_t *nxt = names.at(i).c_str(); const wchar_t *nxt = names.at(i).c_str();
int l = wcslen( nxt + 2 ); size_t l = wcslen( nxt + 2 );
if( chars+l > common_get_width() ) if( chars+l > common_get_width() )
{ {
chars = 0; chars = 0;
@ -2542,7 +2542,7 @@ static int builtin_exit( parser_t &parser, wchar_t **argv )
{ {
int argc = builtin_count_args( argv ); int argc = builtin_count_args( argv );
int ec=0; long ec=0;
switch( argc ) switch( argc )
{ {
case 1: case 1:
@ -2580,7 +2580,7 @@ static int builtin_exit( parser_t &parser, wchar_t **argv )
} }
reader_exit( 1, 0 ); reader_exit( 1, 0 );
return ec; return (int)ec;
} }
/** /**

View file

@ -127,7 +127,7 @@ static void replace_part( const wchar_t *begin,
} }
} }
out.append( end ); out.append( end );
reader_set_buffer( out, (int)out_pos ); reader_set_buffer( out, (size_t)out_pos );
} }
/** /**
@ -387,7 +387,7 @@ static int builtin_commandline( parser_t &parser, wchar_t **argv )
case 'I': case 'I':
current_buffer = woptarg; current_buffer = woptarg;
current_cursor_pos = wcslen( woptarg ); current_cursor_pos = (int)wcslen( woptarg );
break; break;
case 'C': case 'C':
@ -545,8 +545,8 @@ static int builtin_commandline( parser_t &parser, wchar_t **argv )
} }
current_buffer = reader_get_buffer(); current_buffer = reader_get_buffer();
new_pos = maxi( 0L, mini( (long)new_pos, (long)wcslen( current_buffer ) ) ); new_pos = maxi( 0L, mini( new_pos, (long)wcslen( current_buffer ) ) );
reader_set_buffer( current_buffer, new_pos ); reader_set_buffer( current_buffer, (size_t)new_pos );
return 0; return 0;
} }
else else

View file

@ -339,7 +339,7 @@ class completer_t {
void complete_cmd_desc( const wcstring &str ); void complete_cmd_desc( const wcstring &str );
bool complete_variable(const wcstring &str, int start_offset); bool complete_variable(const wcstring &str, size_t start_offset);
bool condition_test( const wcstring &condition ); bool condition_test( const wcstring &condition );
@ -1471,7 +1471,7 @@ bool completer_t::complete_param( const wcstring &scmd_orig, const wcstring &spo
int has_arg=0; /* Does this switch have any known arguments */ int has_arg=0; /* Does this switch have any known arguments */
int req_arg=0; /* Does this switch _require_ an argument */ int req_arg=0; /* Does this switch _require_ an argument */
int offset = 0; size_t offset = 0;
complete_flags_t flags = 0; complete_flags_t flags = 0;
@ -1560,11 +1560,11 @@ void completer_t::debug_print_completions()
/** /**
Complete the specified string as an environment variable Complete the specified string as an environment variable
*/ */
bool completer_t::complete_variable(const wcstring &str, int start_offset) bool completer_t::complete_variable(const wcstring &str, size_t start_offset)
{ {
const wchar_t * const whole_var = str.c_str(); const wchar_t * const whole_var = str.c_str();
const wchar_t *var = &whole_var[start_offset]; const wchar_t *var = &whole_var[start_offset];
int varlen = wcslen( var ); size_t varlen = wcslen( var );
int res = 0; int res = 0;
bool wants_description = (type != COMPLETE_AUTOSUGGEST); bool wants_description = (type != COMPLETE_AUTOSUGGEST);
@ -1572,7 +1572,7 @@ bool completer_t::complete_variable(const wcstring &str, int start_offset)
for( size_t i=0; i<names.size(); i++ ) for( size_t i=0; i<names.size(); i++ )
{ {
const wcstring & env_name = names.at(i); const wcstring & env_name = names.at(i);
int namelen = env_name.size(); size_t namelen = env_name.size();
int match=0, match_no_case=0; int match=0, match_no_case=0;
if( varlen > namelen ) if( varlen > namelen )
@ -1667,7 +1667,7 @@ bool completer_t::try_complete_user( const wcstring &str )
if( name_end == 0 ) if( name_end == 0 )
{ {
struct passwd *pw; struct passwd *pw;
int name_len = wcslen( user_name ); size_t name_len = wcslen( user_name );
setpwent(); setpwent();

View file

@ -431,9 +431,7 @@ static int read_byte( connection_t *src )
if( src->buffer_consumed >= src->buffer_used ) if( src->buffer_consumed >= src->buffer_used )
{ {
int res; ssize_t res = read( src->fd, src->buffer, ENV_UNIVERSAL_BUFFER_SIZE );
res = read( src->fd, src->buffer, ENV_UNIVERSAL_BUFFER_SIZE );
// debug(4, L"Read chunk '%.*s'", res, src->buffer ); // debug(4, L"Read chunk '%.*s'", res, src->buffer );
@ -692,7 +690,7 @@ static int try_send( message_t *msg,
debug( 3, debug( 3,
L"before write of %d chars to fd %d", strlen(msg->body), fd ); L"before write of %d chars to fd %d", strlen(msg->body), fd );
int res = write( fd, msg->body, strlen(msg->body) ); ssize_t res = write( fd, msg->body, strlen(msg->body) );
if( res != -1 ) if( res != -1 )
{ {

View file

@ -103,12 +103,12 @@ typedef struct connection
/** /**
Number of bytes that have already been consumed. Number of bytes that have already been consumed.
*/ */
int buffer_consumed; size_t buffer_consumed;
/** /**
Number of bytes that have been read into the buffer. Number of bytes that have been read into the buffer.
*/ */
int buffer_used; size_t buffer_used;
/** /**

View file

@ -480,7 +480,7 @@ static void completion_print( int cols,
int row_stop, int row_stop,
wchar_t *prefix, wchar_t *prefix,
int is_quoted, int is_quoted,
std::vector<comp_t *> &lst ) const std::vector<comp_t *> &lst )
{ {
size_t rows = (lst.size()-1)/cols+1; size_t rows = (lst.size()-1)/cols+1;
@ -549,9 +549,9 @@ static int completion_try_print( int cols,
*/ */
int print=0; int print=0;
int i, j; long i, j;
long rows = (lst.size()-1)/cols+1; int rows = (int)((lst.size()-1)/cols+1);
int pref_tot_width=0; int pref_tot_width=0;
int min_tot_width = 0; int min_tot_width = 0;
@ -573,7 +573,7 @@ static int completion_try_print( int cols,
{ {
int pref,min; int pref,min;
comp_t *c; comp_t *c;
if( (int)lst.size() <= j*rows + i ) if( lst.size() <= j*rows + i )
continue; continue;
c = lst.at(j*rows + i ); c = lst.at(j*rows + i );
@ -613,7 +613,7 @@ static int completion_try_print( int cols,
} }
else else
{ {
int next_rows = (lst.size()-1)/(cols-1)+1; long next_rows = (lst.size()-1)/(cols-1)+1;
/* fwprintf( stderr, /* fwprintf( stderr,
L"cols %d, min_tot %d, term %d, rows=%d, nextrows %d, termrows %d, diff %d\n", L"cols %d, min_tot %d, term %d, rows=%d, nextrows %d, termrows %d, diff %d\n",
cols, cols,

View file

@ -280,7 +280,7 @@ static int sprint_rand_digits( char *str, int maxlen )
*/ */
static char *gen_unique_nfs_filename( const char *filename ) static char *gen_unique_nfs_filename( const char *filename )
{ {
int pidlen, hnlen, orglen = strlen( filename ); size_t pidlen, hnlen, orglen = strlen( filename );
char hostname[HOST_NAME_MAX + 1]; char hostname[HOST_NAME_MAX + 1];
char *newname; char *newname;
@ -452,7 +452,7 @@ done:
*/ */
static char *acquire_socket_lock( const char *sock_name ) static char *acquire_socket_lock( const char *sock_name )
{ {
int len = strlen( sock_name ); size_t len = strlen( sock_name );
char *lockfile = (char *)malloc( len + strlen( LOCKPOSTFIX ) + 1 ); char *lockfile = (char *)malloc( len + strlen( LOCKPOSTFIX ) + 1 );
if( lockfile == NULL ) if( lockfile == NULL )

View file

@ -135,15 +135,15 @@ int parse_util_get_line_from_offset( const wcstring &str, int pos )
} }
int parse_util_get_offset_from_line( const wcstring &str, int line ) size_t parse_util_get_offset_from_line( const wcstring &str, int line )
{ {
const wchar_t *buff = str.c_str(); const wchar_t *buff = str.c_str();
int i; size_t i;
int count = 0; int count = 0;
if( line < 0 ) if( line < 0 )
{ {
return -1; return (size_t)(-1);
} }
if( line == 0 ) if( line == 0 )
@ -168,19 +168,19 @@ int parse_util_get_offset_from_line( const wcstring &str, int line )
} }
} }
int parse_util_get_offset( const wcstring &str, int line, int line_offset ) size_t parse_util_get_offset( const wcstring &str, int line, long line_offset )
{ {
const wchar_t *buff = str.c_str(); const wchar_t *buff = str.c_str();
int off = parse_util_get_offset_from_line( buff, line ); size_t off = parse_util_get_offset_from_line( buff, line );
int off2 = parse_util_get_offset_from_line( buff, line+1 ); size_t off2 = parse_util_get_offset_from_line( buff, line+1 );
int line_offset2 = line_offset; long line_offset2 = line_offset;
if( off < 0 ) if( off == (size_t)(-1) )
{ {
return -1; return -1;
} }
if( off2 < 0 ) if( off2 == (size_t)(-1) )
{ {
off2 = (int)(wcslen( buff )+1); off2 = (int)(wcslen( buff )+1);
} }
@ -292,7 +292,7 @@ int parse_util_locate_cmdsubst( const wchar_t *in,
void parse_util_cmdsubst_extent( const wchar_t *buff, void parse_util_cmdsubst_extent( const wchar_t *buff,
int cursor_pos, size_t cursor_pos,
const wchar_t **a, const wchar_t **a,
const wchar_t **b ) const wchar_t **b )
{ {
@ -477,7 +477,7 @@ void parse_util_job_extent( const wchar_t *buff,
void parse_util_token_extent( const wchar_t *buff, void parse_util_token_extent( const wchar_t *buff,
int cursor_pos, size_t cursor_pos,
const wchar_t **tok_begin, const wchar_t **tok_begin,
const wchar_t **tok_end, const wchar_t **tok_end,
const wchar_t **prev_begin, const wchar_t **prev_begin,

View file

@ -40,7 +40,7 @@ int parse_util_locate_cmdsubst( const wchar_t *in,
\param b the end of the searched string \param b the end of the searched string
*/ */
void parse_util_cmdsubst_extent( const wchar_t *buff, void parse_util_cmdsubst_extent( const wchar_t *buff,
int cursor_pos, size_t cursor_pos,
const wchar_t **a, const wchar_t **a,
const wchar_t **b ); const wchar_t **b );
@ -84,7 +84,7 @@ void parse_util_job_extent( const wchar_t *buff,
\param prev_end the end of the token before the current token \param prev_end the end of the token before the current token
*/ */
void parse_util_token_extent( const wchar_t *buff, void parse_util_token_extent( const wchar_t *buff,
int cursor_pos, size_t cursor_pos,
const wchar_t **tok_begin, const wchar_t **tok_begin,
const wchar_t **tok_end, const wchar_t **tok_end,
const wchar_t **prev_begin, const wchar_t **prev_begin,
@ -104,13 +104,13 @@ int parse_util_get_line_from_offset( const wcstring &str, int pos );
/** /**
Get the offset of the first character on the specified line Get the offset of the first character on the specified line
*/ */
int parse_util_get_offset_from_line( const wcstring &str, int line ); size_t parse_util_get_offset_from_line( const wcstring &str, int line );
/** /**
Return the total offset of the buffer for the cursor position nearest to the specified poition Return the total offset of the buffer for the cursor position nearest to the specified poition
*/ */
int parse_util_get_offset( const wcstring &str, int line, int line_offset ); size_t parse_util_get_offset( const wcstring &str, int line, long line_offset );
/** /**
Set the argv environment variable to the specified null-terminated Set the argv environment variable to the specified null-terminated

View file

@ -1641,7 +1641,7 @@ void reader_sanity_check()
Set the specified string from the history as the current buffer. Do Set the specified string from the history as the current buffer. Do
not modify prefix_width. not modify prefix_width.
*/ */
static void set_command_line_and_position( const wcstring &new_str, int pos ) static void set_command_line_and_position( const wcstring &new_str, size_t pos )
{ {
data->command_line = new_str; data->command_line = new_str;
data->command_line_changed(); data->command_line_changed();
@ -1654,7 +1654,7 @@ void reader_replace_current_token( const wchar_t *new_token )
{ {
const wchar_t *begin, *end; const wchar_t *begin, *end;
int new_pos; size_t new_pos;
/* Find current token */ /* Find current token */
const wchar_t *buff = data->command_line.c_str(); const wchar_t *buff = data->command_line.c_str();
@ -1985,7 +1985,7 @@ history_t *reader_get_history(void) {
return data ? data->history : NULL; return data ? data->history : NULL;
} }
void reader_set_buffer( const wcstring &b, int p ) void reader_set_buffer( const wcstring &b, size_t p )
{ {
if( !data ) if( !data )
return; return;
@ -3232,14 +3232,12 @@ static int read_ni( int fd, io_data_t *io )
if( in_stream != 0 ) if( in_stream != 0 )
{ {
wchar_t *str; wchar_t *str;
int acc_used; size_t acc_used;
while(!feof( in_stream )) while(!feof( in_stream ))
{ {
char buff[4096]; char buff[4096];
int c; size_t c = fread(buff, 1, 4096, in_stream);
c = fread(buff, 1, 4096, in_stream);
if( ferror( in_stream ) && ( errno != EINTR ) ) if( ferror( in_stream ) && ( errno != EINTR ) )
{ {

View file

@ -100,9 +100,10 @@ history_t *reader_get_history(void);
Set the string of characters in the command buffer, as well as the cursor position. Set the string of characters in the command buffer, as well as the cursor position.
\param b the new buffer value \param b the new buffer value
\param p the cursor position. If \c p is less than zero, the cursor is placed on the last character. \param p the cursor position. If \c p is larger than the length of the command line,
the cursor is placed on the last character.
*/ */
void reader_set_buffer( const wcstring &b, int p ); void reader_set_buffer( const wcstring &b, size_t p );
/** /**
Get the current cursor position in the command line. If interactive Get the current cursor position in the command line. If interactive

View file

@ -113,7 +113,7 @@ static int try_sequence( const char *seq, const wchar_t *str )
Returns the number of columns left until the next tab stop, given Returns the number of columns left until the next tab stop, given
the current cursor postion. the current cursor postion.
*/ */
static int next_tab_stop( int in ) static size_t next_tab_stop( size_t in )
{ {
/* /*
Assume tab stops every 8 characters if undefined Assume tab stops every 8 characters if undefined
@ -151,9 +151,9 @@ static int is_term256_escape(const wchar_t *str) {
to detect common escape sequences that may be embeded in a prompt, to detect common escape sequences that may be embeded in a prompt,
such as color codes. such as color codes.
*/ */
static int calc_prompt_width( const wchar_t *prompt ) static size_t calc_prompt_width( const wchar_t *prompt )
{ {
int res = 0; size_t res = 0;
size_t j, k; size_t j, k;
for( j=0; prompt[j]; j++ ) for( j=0; prompt[j]; j++ )
@ -416,7 +416,7 @@ static void s_desired_append_char( screen_t *s,
wchar_t b, wchar_t b,
int c, int c,
int indent, int indent,
int prompt_width ) size_t prompt_width )
{ {
int line_no = s->desired.cursor[1]; int line_no = s->desired.cursor[1];
@ -653,7 +653,7 @@ 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 ) static void s_update( screen_t *scr, const wchar_t *prompt )
{ {
int prompt_width = calc_prompt_width( prompt ); size_t prompt_width = calc_prompt_width( prompt );
int screen_width = common_get_width(); int screen_width = common_get_width();
int need_clear = scr->need_clear; int need_clear = scr->need_clear;
data_buffer_t output; data_buffer_t output;
@ -673,25 +673,25 @@ static void s_update( screen_t *scr, const wchar_t *prompt )
s_move( scr, &output, 0, 0 ); s_move( scr, &output, 0, 0 );
s_write_str( &output, prompt ); s_write_str( &output, prompt );
scr->actual_prompt = prompt; scr->actual_prompt = prompt;
scr->actual.cursor[0] = prompt_width; scr->actual.cursor[0] = (int)prompt_width;
} }
for (size_t 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); const line_t &o_line = scr->desired.line(i);
line_t &s_line = scr->actual.create_line(i); line_t &s_line = scr->actual.create_line(i);
int start_pos = (i==0 ? prompt_width : 0); size_t start_pos = (i==0 ? prompt_width : 0);
int current_width = 0; int current_width = 0;
if( need_clear ) if( need_clear )
{ {
s_move( scr, &output, start_pos, (int)i ); s_move( scr, &output, (int)start_pos, (int)i );
s_write_mbs( &output, clr_eol); s_write_mbs( &output, clr_eol);
s_line.clear(); s_line.clear();
} }
/* Note that skip_remaining is a width, not a character count */ /* Note that skip_remaining is a width, not a character count */
int skip_remaining = start_pos; size_t skip_remaining = start_pos;
/* Compute how much we should skip. At a minimum we skip over the prompt. But also skip over the shared prefix of what we want to output now, and what we output before, to avoid repeatedly outputting it. */ /* Compute how much we should skip. At a minimum we skip over the prompt. But also skip over the shared prefix of what we want to output now, and what we output before, to avoid repeatedly outputting it. */
size_t shared_prefix = line_shared_prefix(o_line, s_line); size_t shared_prefix = line_shared_prefix(o_line, s_line);
@ -771,18 +771,18 @@ static int is_dumb()
void s_write( screen_t *s, void s_write( screen_t *s,
const wchar_t *prompt, const wchar_t *prompt,
const wchar_t *commandline, const wchar_t *commandline,
int explicit_len, size_t explicit_len,
const int *c, const int *c,
const int *indent, const int *indent,
int cursor ) int cursor )
{ {
int i;
int cursor_arr[2]; int cursor_arr[2];
int prompt_width; size_t prompt_width;
int screen_width; size_t screen_width;
int max_line_width = 0, current_line_width = 0, newline_count = 0, explicit_portion_width = 0; int current_line_width = 0, newline_count = 0, explicit_portion_width = 0;
size_t max_line_width = 0;
CHECK( s, ); CHECK( s, );
CHECK( prompt, ); CHECK( prompt, );
@ -838,8 +838,8 @@ void s_write( screen_t *s,
/* /*
Check if we are overflowing Check if we are overflowing
*/ */
int last_char_that_fits = 0; size_t last_char_that_fits = 0;
for( i=0; commandline[i]; i++ ) for( size_t i=0; commandline[i]; i++ )
{ {
if( commandline[i] == L'\n' ) if( commandline[i] == L'\n' )
{ {
@ -874,7 +874,7 @@ void s_write( screen_t *s,
truncated_autosuggestion_line.push_back(ellipsis_char); truncated_autosuggestion_line.push_back(ellipsis_char);
commandline = truncated_autosuggestion_line.c_str(); commandline = truncated_autosuggestion_line.c_str();
} }
for( i=0; i<prompt_width; i++ ) for( size_t i=0; i<prompt_width; i++ )
{ {
s_desired_append_char( s, L' ', 0, 0, prompt_width ); s_desired_append_char( s, L' ', 0, 0, prompt_width );
} }
@ -889,6 +889,7 @@ void s_write( screen_t *s,
prompt_width=0; prompt_width=0;
} }
int i;
for( i=0; commandline[i]; i++ ) for( i=0; commandline[i]; i++ )
{ {
int col = c[i]; int col = c[i];
@ -917,7 +918,6 @@ void s_write( screen_t *s,
cursor_arr[0] = s->desired.cursor[0] - fish_wcwidth(commandline[i]); cursor_arr[0] = s->desired.cursor[0] - fish_wcwidth(commandline[i]);
cursor_arr[1] = s->desired.cursor[1]; cursor_arr[1] = s->desired.cursor[1];
} }
} }
if( i == cursor ) if( i == cursor )
{ {

View file

@ -147,7 +147,7 @@ class screen_t
void s_write( screen_t *s, void s_write( screen_t *s,
const wchar_t *prompt, const wchar_t *prompt,
const wchar_t *commandline, const wchar_t *commandline,
int explicit_len, size_t explicit_len,
const int *colors, const int *colors,
const int *indent, const int *indent,
int cursor_pos ); int cursor_pos );

View file

@ -58,6 +58,10 @@
*/ */
#define GETOPT_STRING "b:hvocu" #define GETOPT_STRING "b:hvocu"
#ifdef _
#undef _
#endif
#ifdef USE_GETTEXT #ifdef USE_GETTEXT
#define _(string) gettext(string) #define _(string) gettext(string)
#else #else

View file

@ -141,7 +141,7 @@ void tok_init( tokenizer *tok, const wchar_t *b, int flags )
tok->accept_unfinished = !! (flags & TOK_ACCEPT_UNFINISHED); tok->accept_unfinished = !! (flags & TOK_ACCEPT_UNFINISHED);
tok->show_comments = !! (flags & TOK_SHOW_COMMENTS); tok->show_comments = !! (flags & TOK_SHOW_COMMENTS);
tok->squash_errors = !! (flags & TOK_SQUASH_ERRORS); tok->squash_errors = !! (flags & TOK_SQUASH_ERRORS);
tok->has_next=1; tok->has_next=true;
tok->has_next = (*b != L'\0'); tok->has_next = (*b != L'\0');
tok->orig_buff = tok->buff = b; tok->orig_buff = tok->buff = b;
@ -153,8 +153,6 @@ void tok_destroy( tokenizer *tok )
CHECK( tok, ); CHECK( tok, );
free( tok->last ); free( tok->last );
if( tok->free_orig )
free( (void *)tok->orig_buff );
} }
int tok_last_type( tokenizer *tok ) int tok_last_type( tokenizer *tok )
@ -432,13 +430,12 @@ static void read_string( tokenizer *tok )
static void read_comment( tokenizer *tok ) static void read_comment( tokenizer *tok )
{ {
const wchar_t *start; const wchar_t *start;
int len;
start = tok->buff; start = tok->buff;
while( *(tok->buff)!= L'\n' && *(tok->buff)!= L'\0' ) while( *(tok->buff)!= L'\n' && *(tok->buff)!= L'\0' )
tok->buff++; tok->buff++;
len = tok->buff - start; size_t len = tok->buff - start;
if( !check_size( tok, len )) if( !check_size( tok, len ))
return; return;
@ -553,7 +550,7 @@ void tok_next( tokenizer *tok )
if( tok_last_type( tok ) == TOK_ERROR ) if( tok_last_type( tok ) == TOK_ERROR )
{ {
tok->has_next=0; tok->has_next=false;
return; return;
} }
@ -610,7 +607,7 @@ void tok_next( tokenizer *tok )
case L'\0': case L'\0':
tok->last_type = TOK_END; tok->last_type = TOK_END;
/*fwprintf( stderr, L"End of string\n" );*/ /*fwprintf( stderr, L"End of string\n" );*/
tok->has_next = 0; tok->has_next = false;
break; break;
case 13: case 13:
case L'\n': case L'\n':
@ -700,7 +697,7 @@ int tok_get_pos( tokenizer *tok )
{ {
CHECK( tok, 0 ); CHECK( tok, 0 );
return tok->last_pos; return (int)tok->last_pos;
} }
@ -709,7 +706,7 @@ void tok_set_pos( tokenizer *tok, int pos )
CHECK( tok, ); CHECK( tok, );
tok->buff = tok->orig_buff + pos; tok->buff = tok->orig_buff + pos;
tok->has_next = 1; tok->has_next = true;
tok_next( tok ); tok_next( tok );
} }

View file

@ -79,15 +79,13 @@ struct tokenizer
/** Length of last token*/ /** Length of last token*/
size_t last_len; size_t last_len;
/** Offset of last token*/ /** Offset of last token*/
int last_pos; size_t last_pos;
/** Whether there are more tokens*/ /** Whether there are more tokens*/
int has_next; bool has_next;
/** Whether incomplete tokens are accepted*/ /** Whether incomplete tokens are accepted*/
int accept_unfinished; bool accept_unfinished;
/** Whether commants should be returned*/ /** Whether commants should be returned*/
int show_comments; bool show_comments;
/** Flag set to true of the orig_buff points to an internal string that needs to be free()d when deallocating the tokenizer. */
int free_orig;
/** Type of last quote, can be either ' or ".*/ /** Type of last quote, can be either ' or ".*/
wchar_t last_quote; wchar_t last_quote;
/** Last error */ /** Last error */

View file

@ -179,6 +179,10 @@ static char *posixly_correct;
/** /**
Use translation functions if available Use translation functions if available
*/ */
#ifdef _
#undef _
#endif
#ifdef HAVE_TRANSLATE_H #ifdef HAVE_TRANSLATE_H
#ifdef USE_GETTEXT #ifdef USE_GETTEXT
#define _(string) wgettext(string) #define _(string) wgettext(string)