Minor code fixes

darcs-hash:20061019153950-ac50b-9a7d5939ce47cd5f8b7167a97b0e9c62315b7b6e.gz
This commit is contained in:
axel 2006-10-20 01:39:50 +10:00
parent 4683f4c989
commit 45f1263112
5 changed files with 9 additions and 8 deletions

View file

@ -1440,7 +1440,7 @@ static int builtin_random( wchar_t **argv )
} }
lrand48_r( &seed_buffer, &res ); 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; break;
} }

View file

@ -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 ) while( *str )
{ {
if( (!iswalnum(*str)) && (*str != L'_' ) ) if( (!iswalnum(*str)) && (*str != L'_' ) )
{ {
return str; return (wchar_t *)str;
} }
str++; str++;
} }

View file

@ -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 \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 Test if the given string is valid in a variable name

View file

@ -126,7 +126,7 @@ static int get_names_show_exported;
static int get_names_show_unexported; static int get_names_show_unexported;
wchar_t *utf2wcs( char *in ) wchar_t *utf2wcs( const char *in )
{ {
iconv_t cd=(iconv_t) -1; iconv_t cd=(iconv_t) -1;
int i,j; 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) if (nconv == (size_t) -1)
{ {
@ -201,7 +201,7 @@ wchar_t *utf2wcs( char *in )
return out; return out;
} }
char *wcs2utf( wchar_t *in ) char *wcs2utf( const wchar_t *in )
{ {
iconv_t cd=(iconv_t) -1; iconv_t cd=(iconv_t) -1;
int i,j; int i,j;

View file

@ -50,7 +50,7 @@ typedef char tputs_arg_t;
#endif #endif
#ifndef SIGWINCH #ifndef SIGWINCH
#define SIGIO SIGUSR2 #define SIGWINCH SIGUSR2
#endif #endif
#ifndef HAVE_WINSIZE #ifndef HAVE_WINSIZE