diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-02-06 00:57:43 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-02-06 00:57:43 -0800 |
commit | a534c397f5df818cfb6d07a6c51dc6ba88dac986 (patch) | |
tree | fb0937f8e9864748e88d997457252a3a6ad25844 /parse_util.cpp | |
parent | 737589ec01d3985674db0d85c3eb95ad636e54a0 (diff) |
Const correctness changes
Diffstat (limited to 'parse_util.cpp')
-rw-r--r-- | parse_util.cpp | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/parse_util.cpp b/parse_util.cpp index 759c50e4..795b4c53 100644 --- a/parse_util.cpp +++ b/parse_util.cpp @@ -109,10 +109,10 @@ int parse_util_lineno( const wchar_t *str, int len ) } -int parse_util_get_line_from_offset( wchar_t *buff, int pos ) +int parse_util_get_line_from_offset( const wcstring &str, int pos ) { // return parse_util_lineno( buff, pos ); - + const wchar_t *buff = str.c_str(); int i; int count = 0; if( pos < 0 ) @@ -136,8 +136,9 @@ int parse_util_get_line_from_offset( wchar_t *buff, int pos ) } -int parse_util_get_offset_from_line( wchar_t *buff, int line ) +int parse_util_get_offset_from_line( const wcstring &str, int line ) { + const wchar_t *buff = str.c_str(); int i; int count = 0; @@ -168,8 +169,9 @@ int parse_util_get_offset_from_line( wchar_t *buff, int line ) } } -int parse_util_get_offset( wchar_t *buff, int line, int line_offset ) +int parse_util_get_offset( const wcstring &str, int line, int line_offset ) { + const wchar_t *buff = str.c_str(); int off = parse_util_get_offset_from_line( buff, line ); int off2 = parse_util_get_offset_from_line( buff, line+1 ); int line_offset2 = line_offset; @@ -292,8 +294,8 @@ int parse_util_locate_cmdsubst( const wchar_t *in, void parse_util_cmdsubst_extent( const wchar_t *buff, int cursor_pos, - wchar_t **a, - wchar_t **b ) + const wchar_t **a, + const wchar_t **b ) { wchar_t *begin, *end; wchar_t *pos; @@ -363,11 +365,11 @@ void parse_util_cmdsubst_extent( const wchar_t *buff, */ static void job_or_process_extent( const wchar_t *buff, int cursor_pos, - wchar_t **a, - wchar_t **b, + const wchar_t **a, + const wchar_t **b, int process ) { - wchar_t *begin, *end; + const wchar_t *begin, *end; int pos; wchar_t *buffcpy; int finished=0; @@ -460,16 +462,16 @@ static void job_or_process_extent( const wchar_t *buff, void parse_util_process_extent( const wchar_t *buff, int pos, - wchar_t **a, - wchar_t **b ) + const wchar_t **a, + const wchar_t **b ) { job_or_process_extent( buff, pos, a, b, 1 ); } void parse_util_job_extent( const wchar_t *buff, int pos, - wchar_t **a, - wchar_t **b ) + const wchar_t **a, + const wchar_t **b ) { job_or_process_extent( buff,pos,a, b, 0 ); } @@ -477,18 +479,18 @@ void parse_util_job_extent( const wchar_t *buff, void parse_util_token_extent( const wchar_t *buff, int cursor_pos, - wchar_t **tok_begin, - wchar_t **tok_end, - wchar_t **prev_begin, - wchar_t **prev_end ) + const wchar_t **tok_begin, + const wchar_t **tok_end, + const wchar_t **prev_begin, + const wchar_t **prev_end ) { - wchar_t *begin, *end; + const wchar_t *begin, *end; int pos; wchar_t *buffcpy; tokenizer tok; - wchar_t *a, *b, *pa, *pb; + const wchar_t *a, *b, *pa, *pb; CHECK( buff, ); @@ -505,9 +507,9 @@ void parse_util_token_extent( const wchar_t *buff, pos = cursor_pos - (begin - buff); - a = (wchar_t *)buff + pos; + a = buff + pos; b = a; - pa = (wchar_t *)buff + pos; + pa = buff + pos; pb = pa; assert( begin >= buff ); |