ntdll: Remove no longer needed Unix codepage functions from the PE side.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-02-28 11:29:46 +01:00
parent 45bfa4eec3
commit 65cff86951
7 changed files with 1 additions and 93 deletions

View File

@ -3968,7 +3968,6 @@ static NTSTATUS process_init(void)
is_wow64 = !!NtCurrentTeb64(); is_wow64 = !!NtCurrentTeb64();
#endif #endif
init_unix_codepage();
init_user_process_params(); init_user_process_params();
params = peb->ProcessParameters; params = peb->ProcessParameters;

View File

@ -104,7 +104,6 @@ LCID user_lcid = 0, system_lcid = 0;
static NLSTABLEINFO nls_info; static NLSTABLEINFO nls_info;
static HMODULE kernel32_handle; static HMODULE kernel32_handle;
static CPTABLEINFO unix_table;
static struct norm_table *norm_tables[16]; static struct norm_table *norm_tables[16];
@ -534,13 +533,6 @@ static unsigned int compose_string( const struct norm_table *info, WCHAR *str, u
} }
void init_unix_codepage(void)
{
USHORT *data = unix_funcs->get_unix_codepage_data();
if (data) RtlInitCodePageTable( data, &unix_table );
}
static LCID locale_to_lcid( WCHAR *win_name ) static LCID locale_to_lcid( WCHAR *win_name )
{ {
WCHAR *p; WCHAR *p;
@ -586,72 +578,6 @@ void init_locale( HMODULE module )
} }
/******************************************************************
* ntdll_umbstowcs
*/
DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen )
{
DWORD reslen;
if (unix_table.CodePage)
RtlCustomCPToUnicodeN( &unix_table, dst, dstlen * sizeof(WCHAR), &reslen, src, srclen );
else
RtlUTF8ToUnicodeN( dst, dstlen * sizeof(WCHAR), &reslen, src, srclen );
return reslen / sizeof(WCHAR);
}
/******************************************************************
* ntdll_wcstoumbs
*/
int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict )
{
DWORD i, reslen;
if (!unix_table.CodePage)
RtlUnicodeToUTF8N( dst, dstlen, &reslen, src, srclen * sizeof(WCHAR) );
else if (!strict)
RtlUnicodeToCustomCPN( &unix_table, dst, dstlen, &reslen, src, srclen * sizeof(WCHAR) );
else /* do it by hand to make sure every character roundtrips correctly */
{
if (unix_table.DBCSOffsets)
{
const unsigned short *uni2cp = unix_table.WideCharTable;
for (i = dstlen; srclen && i; i--, srclen--, src++)
{
unsigned short ch = uni2cp[*src];
if (ch >> 8)
{
if (unix_table.DBCSOffsets[unix_table.DBCSOffsets[ch >> 8] + (ch & 0xff)] != *src)
return -1;
if (i == 1) break; /* do not output a partial char */
i--;
*dst++ = ch >> 8;
}
else
{
if (unix_table.MultiByteTable[ch] != *src) return -1;
*dst++ = (char)ch;
}
}
reslen = dstlen - i;
}
else
{
const unsigned char *uni2cp = unix_table.WideCharTable;
reslen = min( srclen, dstlen );
for (i = 0; i < reslen; i++)
{
unsigned char ch = uni2cp[src[i]];
if (unix_table.MultiByteTable[ch] != src[i]) return -1;
dst[i] = ch;
}
}
}
return reslen;
}
static NTSTATUS get_dummy_preferred_ui_language( DWORD flags, LANGID lang, ULONG *count, static NTSTATUS get_dummy_preferred_ui_language( DWORD flags, LANGID lang, ULONG *count,
WCHAR *buffer, ULONG *size ) WCHAR *buffer, ULONG *size )
{ {

View File

@ -61,7 +61,6 @@ extern void version_init(void) DECLSPEC_HIDDEN;
extern void debug_init(void) DECLSPEC_HIDDEN; extern void debug_init(void) DECLSPEC_HIDDEN;
extern void actctx_init(void) DECLSPEC_HIDDEN; extern void actctx_init(void) DECLSPEC_HIDDEN;
extern void heap_set_debug_flags( HANDLE handle ) DECLSPEC_HIDDEN; extern void heap_set_debug_flags( HANDLE handle ) DECLSPEC_HIDDEN;
extern void init_unix_codepage(void) DECLSPEC_HIDDEN;
extern void init_locale( HMODULE module ) DECLSPEC_HIDDEN; extern void init_locale( HMODULE module ) DECLSPEC_HIDDEN;
extern void init_user_process_params(void) DECLSPEC_HIDDEN; extern void init_user_process_params(void) DECLSPEC_HIDDEN;
extern void CDECL DECLSPEC_NORETURN signal_start_thread( CONTEXT *ctx ) DECLSPEC_HIDDEN; extern void CDECL DECLSPEC_NORETURN signal_start_thread( CONTEXT *ctx ) DECLSPEC_HIDDEN;
@ -88,8 +87,6 @@ extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
/* locale */ /* locale */
extern LCID user_lcid, system_lcid; extern LCID user_lcid, system_lcid;
extern DWORD ntdll_umbstowcs( const char* src, DWORD srclen, WCHAR* dst, DWORD dstlen ) DECLSPEC_HIDDEN;
extern int ntdll_wcstoumbs( const WCHAR* src, DWORD srclen, char* dst, DWORD dstlen, BOOL strict ) DECLSPEC_HIDDEN;
extern int CDECL NTDLL__vsnprintf( char *str, SIZE_T len, const char *format, __ms_va_list args ) DECLSPEC_HIDDEN; extern int CDECL NTDLL__vsnprintf( char *str, SIZE_T len, const char *format, __ms_va_list args ) DECLSPEC_HIDDEN;
extern int CDECL NTDLL__vsnwprintf( WCHAR *str, SIZE_T len, const WCHAR *format, __ms_va_list args ) DECLSPEC_HIDDEN; extern int CDECL NTDLL__vsnwprintf( WCHAR *str, SIZE_T len, const WCHAR *format, __ms_va_list args ) DECLSPEC_HIDDEN;

View File

@ -1355,17 +1355,6 @@ static void get_initial_directory( UNICODE_STRING *dir )
} }
/*************************************************************************
* get_unix_codepage_data
*
* Return the Unix codepage data.
*/
USHORT * CDECL get_unix_codepage_data(void)
{
return unix_cp.data;
}
/************************************************************************* /*************************************************************************
* get_locales * get_locales
* *

View File

@ -1715,7 +1715,6 @@ static struct unix_funcs unix_funcs =
ntdll_sin, ntdll_sin,
ntdll_sqrt, ntdll_sqrt,
ntdll_tan, ntdll_tan,
get_unix_codepage_data,
get_locales, get_locales,
virtual_release_address_space, virtual_release_address_space,
load_so_dll, load_so_dll,

View File

@ -100,7 +100,6 @@ extern LONGLONG CDECL fast_RtlGetSystemTimePrecise(void) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL fast_wait_cv( RTL_CONDITION_VARIABLE *variable, const void *value, extern NTSTATUS CDECL fast_wait_cv( RTL_CONDITION_VARIABLE *variable, const void *value,
const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN; const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN;
extern USHORT * CDECL get_unix_codepage_data(void) DECLSPEC_HIDDEN;
extern void CDECL get_locales( WCHAR *sys, WCHAR *user ) DECLSPEC_HIDDEN; extern void CDECL get_locales( WCHAR *sys, WCHAR *user ) DECLSPEC_HIDDEN;
extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN; extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN;

View File

@ -26,7 +26,7 @@
struct _DISPATCHER_CONTEXT; struct _DISPATCHER_CONTEXT;
/* increment this when you change the function table */ /* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 113 #define NTDLL_UNIXLIB_VERSION 114
struct unix_funcs struct unix_funcs
{ {
@ -70,7 +70,6 @@ struct unix_funcs
double (CDECL *tan)( double d ); double (CDECL *tan)( double d );
/* environment functions */ /* environment functions */
USHORT * (CDECL *get_unix_codepage_data)(void);
void (CDECL *get_locales)( WCHAR *sys, WCHAR *user ); void (CDECL *get_locales)( WCHAR *sys, WCHAR *user );
/* virtual memory functions */ /* virtual memory functions */