Remoce C99:ism (Non-constant expression as array size)

darcs-hash:20060512154447-ac50b-5731603e1bf75f91703bf79cc06f6bbdb94e6a61.gz
This commit is contained in:
axel 2006-05-13 01:44:47 +10:00
parent f5c6306bde
commit 3d192a8e93

30
wutil.c
View File

@ -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 )