mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 01:36:39 +08:00
Remoce C99:ism (Non-constant expression as array size)
darcs-hash:20060512154447-ac50b-5731603e1bf75f91703bf79cc06f6bbdb94e6a61.gz
This commit is contained in:
parent
f5c6306bde
commit
3d192a8e93
30
wutil.c
30
wutil.c
|
@ -137,16 +137,28 @@ struct wdirent *wreaddir(DIR *dir )
|
|||
|
||||
wchar_t *wgetcwd( wchar_t *buff, size_t sz )
|
||||
{
|
||||
char buffc[sz*MAX_UTF8_BYTES];
|
||||
char *res = getcwd( buffc, sz*MAX_UTF8_BYTES );
|
||||
if( !res )
|
||||
return 0;
|
||||
|
||||
if( (size_t)-1 == mbstowcs( buff, buffc, sizeof( wchar_t ) * sz ) )
|
||||
char *buffc = malloc( sz*MAX_UTF8_BYTES);
|
||||
char *res;
|
||||
wchar_t *ret = 0;
|
||||
|
||||
if( !buffc )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return buff;
|
||||
errno = ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
res = getcwd( buffc, sz*MAX_UTF8_BYTES );
|
||||
if( res )
|
||||
{
|
||||
if( (size_t)-1 != mbstowcs( buff, buffc, sizeof( wchar_t ) * sz ) )
|
||||
{
|
||||
ret = buff;
|
||||
}
|
||||
}
|
||||
|
||||
free( buffc );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int wchdir( const wchar_t * dir )
|
||||
|
|
Loading…
Reference in New Issue
Block a user