From 45f1263112565aaf428a154637eaf3486de58915 Mon Sep 17 00:00:00 2001 From: axel Date: Fri, 20 Oct 2006 01:39:50 +1000 Subject: Minor code fixes darcs-hash:20061019153950-ac50b-9a7d5939ce47cd5f8b7167a97b0e9c62315b7b6e.gz --- builtin.c | 2 +- common.c | 4 ++-- common.h | 3 ++- env_universal_common.c | 6 +++--- fallback.h | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/builtin.c b/builtin.c index bc25929d..23feee57 100644 --- a/builtin.c +++ b/builtin.c @@ -1440,7 +1440,7 @@ static int builtin_random( wchar_t **argv ) } lrand48_r( &seed_buffer, &res ); - sb_printf( sb_out, L"%d\n", res%32767 ); + sb_printf( sb_out, L"%d\n", abs(res%32767) ); break; } diff --git a/common.c b/common.c index dcd618d9..ca05b369 100644 --- a/common.c +++ b/common.c @@ -408,13 +408,13 @@ wchar_t **strv2wcsv( const char **in ) } -wchar_t *wcsvarname( wchar_t *str ) +wchar_t *wcsvarname( const wchar_t *str ) { while( *str ) { if( (!iswalnum(*str)) && (*str != L'_' ) ) { - return str; + return (wchar_t *)str; } str++; } diff --git a/common.h b/common.h index 2cefd584..5aa6c276 100644 --- a/common.h +++ b/common.h @@ -207,7 +207,8 @@ __sentinel wchar_t *wcsdupcat2( const wchar_t *a, ... ); \return null if this is a valid name, and a pointer to the first invalid character otherwise */ -wchar_t *wcsvarname( wchar_t *str ); +wchar_t *wcsvarname( const wchar_t *str ); + /** Test if the given string is valid in a variable name diff --git a/env_universal_common.c b/env_universal_common.c index 80f7119e..caa0e5ce 100644 --- a/env_universal_common.c +++ b/env_universal_common.c @@ -126,7 +126,7 @@ static int get_names_show_exported; static int get_names_show_unexported; -wchar_t *utf2wcs( char *in ) +wchar_t *utf2wcs( const char *in ) { iconv_t cd=(iconv_t) -1; int i,j; @@ -185,7 +185,7 @@ wchar_t *utf2wcs( char *in ) } - nconv = iconv( cd, &in, &in_len, &nout, &out_len ); + nconv = iconv( cd, (char **)&in, &in_len, &nout, &out_len ); if (nconv == (size_t) -1) { @@ -201,7 +201,7 @@ wchar_t *utf2wcs( char *in ) return out; } -char *wcs2utf( wchar_t *in ) +char *wcs2utf( const wchar_t *in ) { iconv_t cd=(iconv_t) -1; int i,j; diff --git a/fallback.h b/fallback.h index 2cad4e32..df4141fc 100644 --- a/fallback.h +++ b/fallback.h @@ -50,7 +50,7 @@ typedef char tputs_arg_t; #endif #ifndef SIGWINCH -#define SIGIO SIGUSR2 +#define SIGWINCH SIGUSR2 #endif #ifndef HAVE_WINSIZE -- cgit v1.2.3