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

Alexandre Julliard julliard at winehq.org
Mon Mar 1 15:54:03 CST 2021


Module: wine
Branch: master
Commit: 65cff869513f8f66655b602ab2bc62e1c3b69c51
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=65cff869513f8f66655b602ab2bc62e1c3b69c51

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sun Feb 28 11:29:46 2021 +0100

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

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/loader.c            |  1 -
 dlls/ntdll/locale.c            | 74 ------------------------------------------
 dlls/ntdll/ntdll_misc.h        |  3 --
 dlls/ntdll/unix/env.c          | 11 -------
 dlls/ntdll/unix/loader.c       |  1 -
 dlls/ntdll/unix/unix_private.h |  1 -
 dlls/ntdll/unixlib.h           |  3 +-
 7 files changed, 1 insertion(+), 93 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index c21c62c10b0..2a6b8467812 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3968,7 +3968,6 @@ static NTSTATUS process_init(void)
     is_wow64 = !!NtCurrentTeb64();
 #endif
 
-    init_unix_codepage();
     init_user_process_params();
     params = peb->ProcessParameters;
 
diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c
index 892f3fe9e70..758789a533c 100644
--- a/dlls/ntdll/locale.c
+++ b/dlls/ntdll/locale.c
@@ -104,7 +104,6 @@ LCID user_lcid = 0, system_lcid = 0;
 
 static NLSTABLEINFO nls_info;
 static HMODULE kernel32_handle;
-static CPTABLEINFO unix_table;
 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 )
 {
     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,
                                                  WCHAR *buffer, ULONG *size )
 {
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index aebea12e6ba..72340a171c9 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -61,7 +61,6 @@ extern void version_init(void) DECLSPEC_HIDDEN;
 extern void debug_init(void) DECLSPEC_HIDDEN;
 extern void actctx_init(void) 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_user_process_params(void) 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 */
 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__vsnwprintf( WCHAR *str, SIZE_T len, const WCHAR *format, __ms_va_list args ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index a8f490e8740..84d5ab298a4 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -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
  *
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index df8d99ce489..21e1e1893c0 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -1715,7 +1715,6 @@ static struct unix_funcs unix_funcs =
     ntdll_sin,
     ntdll_sqrt,
     ntdll_tan,
-    get_unix_codepage_data,
     get_locales,
     virtual_release_address_space,
     load_so_dll,
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 529cb6edb69..d56fc9b0f19 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -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,
                                     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 virtual_release_address_space(void) DECLSPEC_HIDDEN;
 
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h
index bd2512030c2..6a7f008ed9c 100644
--- a/dlls/ntdll/unixlib.h
+++ b/dlls/ntdll/unixlib.h
@@ -26,7 +26,7 @@
 struct _DISPATCHER_CONTEXT;
 
 /* increment this when you change the function table */
-#define NTDLL_UNIXLIB_VERSION 113
+#define NTDLL_UNIXLIB_VERSION 114
 
 struct unix_funcs
 {
@@ -70,7 +70,6 @@ struct unix_funcs
     double        (CDECL *tan)( double d );
 
     /* environment functions */
-    USHORT *      (CDECL *get_unix_codepage_data)(void);
     void          (CDECL *get_locales)( WCHAR *sys, WCHAR *user );
 
     /* virtual memory functions */




More information about the wine-cvs mailing list