From d90f0878001549dec6eadcb4078fbec5f9dc08d0 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Fri, 13 Sep 2019 04:33:42 -0700 Subject: [PATCH] Delete dead code in PAL related to locale handling (dotnet/coreclr#26693) * Delete dead code in PAL related to locale handling * Fix build break * Delete PAL_ACP * Delete HAVE_COREFOUNDATION Commit migrated from https://github.com/dotnet/coreclr/commit/6b0dab793260d36e35d66c82678c63046828d01b --- src/coreclr/src/pal/inc/pal.h | 7 - src/coreclr/src/pal/inc/pal_mstypes.h | 7 - src/coreclr/src/pal/src/config.h.in | 4 - src/coreclr/src/pal/src/configure.cmake | 1 - src/coreclr/src/pal/src/cruntime/silent_printf.cpp | 1 - src/coreclr/src/pal/src/cruntime/wchar.cpp | 7 - src/coreclr/src/pal/src/include/pal/locale.h | 71 ----- src/coreclr/src/pal/src/init/pal.cpp | 1 - src/coreclr/src/pal/src/loader/module.cpp | 15 - src/coreclr/src/pal/src/loader/modulename.cpp | 4 - src/coreclr/src/pal/src/locale/unicode.cpp | 301 +-------------------- src/coreclr/src/pal/src/misc/fmtmessage.cpp | 4 - .../src/pal/tests/palsuite/DisabledTests.txt | 6 - .../pal/tests/palsuite/locale_info/CMakeLists.txt | 8 - .../GetSystemDefaultLangID/CMakeLists.txt | 4 - .../GetSystemDefaultLangID/test1/CMakeLists.txt | 17 -- .../GetSystemDefaultLangID/test1/test1.cpp | 59 ---- .../GetSystemDefaultLangID/test1/testinfo.dat | 13 - .../locale_info/GetThreadLocale/CMakeLists.txt | 4 - .../GetThreadLocale/test1/CMakeLists.txt | 17 -- .../locale_info/GetThreadLocale/test1/test1.cpp | 36 --- .../locale_info/GetThreadLocale/test1/testinfo.dat | 12 - .../GetTimeZoneInformation/CMakeLists.txt | 4 - .../GetTimeZoneInformation/test1/CMakeLists.txt | 17 -- .../GetTimeZoneInformation/test1/test1.cpp | 73 ----- .../GetTimeZoneInformation/test1/testinfo.dat | 12 - .../locale_info/GetUserDefaultLCID/CMakeLists.txt | 4 - .../GetUserDefaultLCID/test1/CMakeLists.txt | 17 -- .../locale_info/GetUserDefaultLCID/test1/test1.cpp | 52 ---- .../GetUserDefaultLCID/test1/testinfo.dat | 13 - .../GetUserDefaultLangID/CMakeLists.txt | 4 - .../GetUserDefaultLangID/test1/CMakeLists.txt | 17 -- .../GetUserDefaultLangID/test1/test1.cpp | 60 ---- .../GetUserDefaultLangID/test1/testinfo.dat | 13 - .../locale_info/IsValidCodePage/CMakeLists.txt | 5 - .../IsValidCodePage/test1/CMakeLists.txt | 17 -- .../locale_info/IsValidCodePage/test1/test1.cpp | 50 ---- .../locale_info/IsValidCodePage/test1/testinfo.dat | 12 - .../IsValidCodePage/test2/CMakeLists.txt | 17 -- .../locale_info/IsValidCodePage/test2/test2.cpp | 51 ---- .../locale_info/IsValidCodePage/test2/testinfo.dat | 8 - .../locale_info/IsValidLocale/CMakeLists.txt | 4 - .../locale_info/IsValidLocale/test1/CMakeLists.txt | 17 -- .../locale_info/IsValidLocale/test1/test1.cpp | 76 ------ .../locale_info/IsValidLocale/test1/testinfo.dat | 13 - .../locale_info/SetThreadLocale/CMakeLists.txt | 4 - .../SetThreadLocale/test1/CMakeLists.txt | 17 -- .../locale_info/SetThreadLocale/test1/test1.cpp | 50 ---- .../locale_info/SetThreadLocale/test1/testinfo.dat | 13 - src/coreclr/src/pal/tests/palsuite/paltestlist.txt | 1 - .../tests/palsuite/paltestlist_to_be_reviewed.txt | 8 - 51 files changed, 10 insertions(+), 1238 deletions(-) delete mode 100644 src/coreclr/src/pal/src/include/pal/locale.h delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/test1/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/test1/test1.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/test1/testinfo.dat delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/test1/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/test1/test1.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/test1/testinfo.dat delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/test1/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/test1/test1.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/test1/testinfo.dat delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/test1/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/test1/test1.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/test1/testinfo.dat delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/test1/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/test1/test1.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/test1/testinfo.dat delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/test1/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/test1/test1.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/test1/testinfo.dat delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/test2/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/test2/test2.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/test2/testinfo.dat delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/IsValidLocale/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/IsValidLocale/test1/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/IsValidLocale/test1/test1.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/IsValidLocale/test1/testinfo.dat delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/test1/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/test1/test1.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/test1/testinfo.dat diff --git a/src/coreclr/src/pal/inc/pal.h b/src/coreclr/src/pal/inc/pal.h index 6cd1012..417c73f 100644 --- a/src/coreclr/src/pal/inc/pal.h +++ b/src/coreclr/src/pal/inc/pal.h @@ -2979,13 +2979,6 @@ PALAPI IsDBCSLeadByte( IN BYTE TestChar); -PALIMPORT -BOOL -PALAPI -IsValidCodePage( - IN UINT CodePage); - - #define MB_PRECOMPOSED 0x00000001 #define MB_ERR_INVALID_CHARS 0x00000008 diff --git a/src/coreclr/src/pal/inc/pal_mstypes.h b/src/coreclr/src/pal/inc/pal_mstypes.h index 42fa030..2f53b7c 100644 --- a/src/coreclr/src/pal/inc/pal_mstypes.h +++ b/src/coreclr/src/pal/inc/pal_mstypes.h @@ -700,13 +700,6 @@ typedef struct _FILETIME { /* Code Page Default Values */ #define CP_ACP 0 /* default to ANSI code page */ -#define CP_OEMCP 1 /* default to OEM code page */ -#define CP_MACCP 2 /* default to MAC code page */ -#define CP_THREAD_ACP 3 /* current thread's ANSI code page */ -#define CP_WINUNICODE 1200 -#define CP_UNICODE 1200 /* Unicode */ -#define CP_UNICODESWAP 1201 /* Unicode Big-Endian */ -#define CP_UTF7 65000 /* UTF-7 translation */ #define CP_UTF8 65001 /* UTF-8 translation */ typedef PVOID PSID; diff --git a/src/coreclr/src/pal/src/config.h.in b/src/coreclr/src/pal/src/config.h.in index 27fa87d..9b27d8b 100644 --- a/src/coreclr/src/pal/src/config.h.in +++ b/src/coreclr/src/pal/src/config.h.in @@ -139,7 +139,6 @@ #define PAL_THREAD_PRIORITY_MIN 0 #define PAL_THREAD_PRIORITY_MAX 0 -#cmakedefine01 HAVE_COREFOUNDATION #cmakedefine01 HAVE__NSGETENVIRON #cmakedefine01 DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX #cmakedefine PAL_PTRACE(cmd, pid, addr, data) @PAL_PTRACE@ @@ -157,10 +156,7 @@ #define CHECK_TRACE_SPECIFIERS 0 #define HAVE_GETHRTIME 0 -#define HAVE_LOWERCASE_ISO_NAME 0 #define HAVE_READ_REAL_TIME 0 -#define HAVE_UNDERSCORE_ISO_NAME 0 -#define NEED_DLCOMPAT 0 #define OPEN64_IS_USED_INSTEAD_OF_OPEN 0 #define PAL_IGNORE_NORMAL_THREAD_PRIORITY 0 #define SELF_SUSPEND_FAILS_WITH_NATIVE_SUSPENSION 0 diff --git a/src/coreclr/src/pal/src/configure.cmake b/src/coreclr/src/pal/src/configure.cmake index b8d14ad..9b2530a 100644 --- a/src/coreclr/src/pal/src/configure.cmake +++ b/src/coreclr/src/pal/src/configure.cmake @@ -1336,7 +1336,6 @@ if(NOT CLR_CMAKE_PLATFORM_ARCH_ARM AND NOT CLR_CMAKE_PLATFORM_ARCH_ARM64) endif() if(CMAKE_SYSTEM_NAME STREQUAL Darwin) - set(HAVE_COREFOUNDATION 1) set(HAVE__NSGETENVIRON 1) set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 1) set(PAL_PTRACE "ptrace((cmd), (pid), (caddr_t)(addr), (data))") diff --git a/src/coreclr/src/pal/src/cruntime/silent_printf.cpp b/src/coreclr/src/pal/src/cruntime/silent_printf.cpp index 4047c7e..b9cdd2e 100644 --- a/src/coreclr/src/pal/src/cruntime/silent_printf.cpp +++ b/src/coreclr/src/pal/src/cruntime/silent_printf.cpp @@ -24,7 +24,6 @@ Revision History: #include "pal/palinternal.h" #include "pal/cruntime.h" -#include "pal/locale.h" #include "pal/printfcpp.hpp" #include "pal/thread.hpp" diff --git a/src/coreclr/src/pal/src/cruntime/wchar.cpp b/src/coreclr/src/pal/src/cruntime/wchar.cpp index 69b7980..efd54e0 100644 --- a/src/coreclr/src/pal/src/cruntime/wchar.cpp +++ b/src/coreclr/src/pal/src/cruntime/wchar.cpp @@ -31,14 +31,7 @@ Abstract: #include "config.h" #endif -#if HAVE_COREFOUNDATION -#define CF_EXCLUDE_CSTD_HEADERS -#include #include -#else -#include -#endif - #include #include diff --git a/src/coreclr/src/pal/src/include/pal/locale.h b/src/coreclr/src/pal/src/include/pal/locale.h deleted file mode 100644 index 52362e5..0000000 --- a/src/coreclr/src/pal/src/include/pal/locale.h +++ /dev/null @@ -1,71 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*++ - - - -Module Name: - - locale.h - -Abstract: - - Prototypes for codepage initialization, and control of the readwrite locks - for systems that use them. - -Revision History: - - - ---*/ - -#ifndef _PAL_LOCALE_H_ -#define _PAL_LOCALE_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus - -#if HAVE_LOWERCASE_ISO_NAME -#define ISO_NAME(region, encoding, part) region ".iso" encoding part -#elif HAVE_UNDERSCORE_ISO_NAME -#define ISO_NAME(region, encoding, part) region ".ISO_" encoding "-" part -#else -#define ISO_NAME(region, encoding, part) region ".ISO" encoding "-" part -#endif - -#if HAVE_COREFOUNDATION -#define CF_EXCLUDE_CSTD_HEADERS -#include -#endif // HAVE_COREFOUNDATION - -#if HAVE_COREFOUNDATION - -typedef -struct _CP_MAPPING -{ - UINT nCodePage; /* Code page identifier. */ - CFStringEncoding nCFEncoding; /* The equivalent CFString encoding. */ - UINT nMaxByteSize; /* The max byte size of any character. */ - BYTE LeadByte[ MAX_LEADBYTES ]; /* The lead byte array. */ -} CP_MAPPING; -#elif HAVE_PTHREAD_RWLOCK_T -typedef -struct _CP_MAPPING -{ - UINT nCodePage; // Code page identifier. - LPCSTR lpBSDEquivalent; // The equivalent BSD locale identifier. - UINT nMaxByteSize; // The max byte size of any character. - BYTE LeadByte[ MAX_LEADBYTES ]; // The lead byte array. -} CP_MAPPING; -#else -#error Insufficient platform support for text encodings -#endif -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif /* _PAL_LOCALE_H_ */ diff --git a/src/coreclr/src/pal/src/init/pal.cpp b/src/coreclr/src/pal/src/init/pal.cpp index 92a411b..1184904 100644 --- a/src/coreclr/src/pal/src/init/pal.cpp +++ b/src/coreclr/src/pal/src/init/pal.cpp @@ -40,7 +40,6 @@ SET_DEFAULT_DEBUG_CHANNEL(PAL); // some headers have code with asserts, so do th #include "pal/environ.h" #include "pal/utils.h" #include "pal/debug.h" -#include "pal/locale.h" #include "pal/init.h" #include "pal/numa.h" #include "pal/stackstring.hpp" diff --git a/src/coreclr/src/pal/src/loader/module.cpp b/src/coreclr/src/pal/src/loader/module.cpp index 8ad2ae2..c87f017 100644 --- a/src/coreclr/src/pal/src/loader/module.cpp +++ b/src/coreclr/src/pal/src/loader/module.cpp @@ -41,11 +41,7 @@ SET_DEFAULT_DEBUG_CHANNEL(LOADER); // some headers have code with asserts, so do #include #include #include -#if NEED_DLCOMPAT -#include "dlcompat.h" -#else // NEED_DLCOMPAT #include -#endif // NEED_DLCOMPAT #include #ifdef __APPLE__ @@ -1510,18 +1506,7 @@ static MODSTRUCT *LOADAllocModule(NATIVE_LIBRARY_HANDLE dl_handle, LPCSTR name) } module->dl_handle = dl_handle; -#if NEED_DLCOMPAT - if (isdylib(module)) - { - module->refcount = -1; - } - else - { - module->refcount = 1; - } -#else // NEED_DLCOMPAT module->refcount = 1; -#endif // NEED_DLCOMPAT module->self = module; module->hinstance = nullptr; module->threadLibCalls = TRUE; diff --git a/src/coreclr/src/pal/src/loader/modulename.cpp b/src/coreclr/src/pal/src/loader/modulename.cpp index e7b3ac0..f5c5ccb 100644 --- a/src/coreclr/src/pal/src/loader/modulename.cpp +++ b/src/coreclr/src/pal/src/loader/modulename.cpp @@ -24,11 +24,7 @@ Abstract: #include "pal/dbgmsg.h" #include "pal/modulename.h" -#if NEED_DLCOMPAT -#include "dlcompat.h" -#else // NEED_DLCOMPAT #include -#endif // NEED_DLCOMPAT using namespace CorUnix; diff --git a/src/coreclr/src/pal/src/locale/unicode.cpp b/src/coreclr/src/pal/src/locale/unicode.cpp index f366b0f..b4647e0 100644 --- a/src/coreclr/src/pal/src/locale/unicode.cpp +++ b/src/coreclr/src/pal/src/locale/unicode.cpp @@ -26,24 +26,16 @@ Revision History: #include "pal/dbgmsg.h" #include "pal/file.h" #include "pal/utf8.h" -#include "pal/locale.h" #include "pal/cruntime.h" #include "pal/stackstring.hpp" #include "pal/unicodedata.h" -#if !(HAVE_PTHREAD_RWLOCK_T || HAVE_COREFOUNDATION) -#error Either pthread rwlocks or Core Foundation are required for Unicode support -#endif /* !(HAVE_PTHREAD_RWLOCK_T || HAVE_COREFOUNDATION) */ - #include #include #if HAVE_LIBINTL_H #include #endif // HAVE_LIBINTL_H #include -#if HAVE_COREFOUNDATION -#include -#endif // HAVE_COREFOUNDATION #include @@ -51,35 +43,6 @@ using namespace CorUnix; SET_DEFAULT_DEBUG_CHANNEL(UNICODE); -#if HAVE_COREFOUNDATION - -static CP_MAPPING CP_TO_NATIVE_TABLE[] = { - { 65001, kCFStringEncodingUTF8, 4, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { 1252, kCFStringEncodingWindowsLatin1, 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { 1251, kCFStringEncodingWindowsCyrillic, 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { 1253, kCFStringEncodingWindowsGreek, 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { 1254, kCFStringEncodingWindowsLatin5, 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { 1258, kCFStringEncodingWindowsVietnamese, 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { 932, kCFStringEncodingDOSJapanese, 2, { 129, 159, 224, 252, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { 949, kCFStringEncodingDOSKorean, 2, { 129, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, - { 950, kCFStringEncodingDOSChineseTrad, 2, { 129, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } -}; - -#else // HAVE_COREFOUNDATION - -static const CP_MAPPING CP_TO_NATIVE_TABLE[] = { - { 65001, "utf8", 4, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } -}; - -#endif // HAVE_COREFOUNDATION - -// We hardcode the system's default codepage to be UTF-8. -// There are several reasons for this: -// - On OSX, HFS+ file names are encoded as UTF-8. -// - On OSX, When writing strings to the console, the Terminal.app will interpret them as UTF-8. -// - We want Ansi marshalling to mean marshal to UTF-8 on Mac and Linux -static const UINT PAL_ACP = 65001; - /*++ Function: UnicodeDataComp @@ -214,61 +177,6 @@ PAL_ToLowerInvariant( wchar_16 c ) /*++ Function: -CODEPAGEGetData - - IN UINT CodePage - The code page the caller - is attempting to retrieve data on. - - Returns a pointer to structure, NULL otherwise. ---*/ -const CP_MAPPING * -CODEPAGEGetData( IN UINT CodePage ) -{ - UINT nSize = sizeof( CP_TO_NATIVE_TABLE ) / sizeof( CP_TO_NATIVE_TABLE[ 0 ] ); - UINT nIndex = 0; - - if ( CP_ACP == CodePage ) - { - CodePage = PAL_ACP; - } - - /* checking if the CodePage is ACP and returning true if so */ - while (nIndex < nSize) - { - if ( ( CP_TO_NATIVE_TABLE[ nIndex ] ).nCodePage == CodePage ) - { - return &(CP_TO_NATIVE_TABLE[ nIndex ]); - } - nIndex++; - } - return NULL; -} - -#if HAVE_COREFOUNDATION -/*++ -Function : - -CODEPAGECPToCFStringEncoding - Gets the CFStringEncoding for -the given codepage. - -Returns the CFStringEncoding for the given codepage. ---*/ -CFStringEncoding CODEPAGECPToCFStringEncoding(UINT codepage) -{ - const CP_MAPPING *cp_mapping = CODEPAGEGetData(codepage); - if (cp_mapping == NULL) - { - return kCFStringEncodingInvalidId; - } - else - { - return cp_mapping->nCFEncoding; - } -} -#endif // HAVE_COREFOUNDATION - -/*++ -Function: CharNextA Parameters @@ -352,56 +260,6 @@ GetConsoleOutputCP( return nRet; } - -/*++ -Function: -IsValidCodePage - -See MSDN doc. - -Notes : -"pseudo code pages", like CP_ACP, aren't considered 'valid' in this context. -CP_UTF7 and CP_UTF8, however, *are* considered valid code pages, even though -MSDN fails to mention them in the IsValidCodePage entry. -Note : CP_UTF7 support isn't required for CoreCLR ---*/ -BOOL -PALAPI -IsValidCodePage( - IN UINT CodePage) -{ - BOOL retval = FALSE; - - PERF_ENTRY(IsValidCodePage); - ENTRY("IsValidCodePage(%d)\n", CodePage ); - - switch(CodePage) - { - case CP_ACP : /* fall through */ - case CP_OEMCP : /* fall through */ - case CP_MACCP : /* fall through */ - case CP_THREAD_ACP: - /* 'pseudo code pages' : not valid */ - retval = FALSE; - break; - case CP_UTF7: - /* valid in Win32, but not supported in the PAL */ - retval = FALSE; - break; - case CP_UTF8: - /* valid, but not part of CODEPAGEGetData's tables */ - retval = TRUE; - break; - default: - retval = (NULL != CODEPAGEGetData( CodePage )); - break; - } - - LOGEXIT("IsValidCodePage returns BOOL %d\n",retval); - PERF_EXIT(IsValidCodePage); - return retval; -} - /*++ Function: GetCPInfo @@ -414,14 +272,13 @@ GetCPInfo( IN UINT CodePage, OUT LPCPINFO lpCPInfo) { - const CP_MAPPING * lpStruct = NULL; BOOL bRet = FALSE; PERF_ENTRY(GetCPInfo); ENTRY("GetCPInfo(CodePage=%hu, lpCPInfo=%p)\n", CodePage, lpCPInfo); /*check if the input code page is valid*/ - if( CP_ACP != CodePage && !IsValidCodePage( CodePage ) ) + if( CP_ACP != CodePage && CP_UTF8 != CodePage ) { /* error, invalid argument */ ERROR("CodePage(%d) parameter is invalid\n",CodePage); @@ -438,16 +295,13 @@ GetCPInfo( goto done; } - if ( NULL != ( lpStruct = CODEPAGEGetData( CodePage ) ) ) - { - lpCPInfo->MaxCharSize = lpStruct->nMaxByteSize;; - memcpy( lpCPInfo->LeadByte, lpStruct->LeadByte , MAX_LEADBYTES ); + lpCPInfo->MaxCharSize = 4; + memset( lpCPInfo->LeadByte, 0, MAX_LEADBYTES ); - /* Don't need to be set, according to the spec. */ - memset( lpCPInfo->DefaultChar, '?', MAX_DEFAULTCHAR ); + /* Don't need to be set, according to the spec. */ + memset( lpCPInfo->DefaultChar, '?', MAX_DEFAULTCHAR ); - bRet = TRUE; - } + bRet = TRUE; done: LOGEXIT("GetCPInfo returns BOOL %d \n",bRet); @@ -469,10 +323,10 @@ GetACP(VOID) PERF_ENTRY(GetACP); ENTRY("GetACP(VOID)\n"); - LOGEXIT("GetACP returning UINT %d\n", PAL_ACP ); + LOGEXIT("GetACP returning UINT %d\n", CP_UTF8); PERF_EXIT(GetACP); - return PAL_ACP; + return CP_UTF8; } @@ -557,11 +411,6 @@ MultiByteToWideChar( IN int cchWideChar) { INT retval =0; -#if HAVE_COREFOUNDATION - CFStringRef cfString = NULL; - CFStringEncoding cfEncoding; - int bytesToConvert; -#endif /* HAVE_COREFOUNDATION */ PERF_ENTRY(MultiByteToWideChar); ENTRY("MultiByteToWideChar(CodePage=%u, dwFlags=%#x, lpMultiByteStr=%p (%s)," @@ -589,7 +438,7 @@ MultiByteToWideChar( // Use UTF8ToUnicode on all systems, since it replaces // invalid characters and Core Foundation doesn't do that. - if (CodePage == CP_UTF8 || (CodePage == CP_ACP && GetACP() == CP_UTF8)) + if (CodePage == CP_UTF8 || CodePage == CP_ACP) { if (cbMultiByte <= -1) { @@ -600,63 +449,9 @@ MultiByteToWideChar( goto EXIT; } -#if !HAVE_COREFOUNDATION ERROR( "This code page is not in the system.\n" ); SetLastError( ERROR_INVALID_PARAMETER ); goto EXIT; -#else /* !HAVE_COREFOUNDATION */ - bytesToConvert = cbMultiByte; - if (bytesToConvert == -1) - { - /* Plus one for the trailing '\0', which will end up - * in the CFString. */ - bytesToConvert = strlen(lpMultiByteStr) + 1; - } - - cfEncoding = CODEPAGECPToCFStringEncoding(CodePage); - if (cfEncoding == kCFStringEncodingInvalidId) - { - ERROR( "This code page is not in the system.\n" ); - SetLastError( ERROR_INVALID_PARAMETER ); - goto EXIT; - } - - cfString = CFStringCreateWithBytes(kCFAllocatorDefault, (UInt8*)lpMultiByteStr, - bytesToConvert, cfEncoding, TRUE); - if (cfString == NULL) - { - ERROR( "Failed to convert the string to the specified encoding.\n" ); - SetLastError( ERROR_NO_UNICODE_TRANSLATION ); - goto EXIT; - } - - if (cchWideChar != 0) - { - /* Do the conversion. */ - CFIndex length = CFStringGetLength(cfString); - if (length > cchWideChar) - { - ERROR("Error insufficient buffer\n"); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - retval = 0; - goto ReleaseString; - } - CFStringGetCharacters(cfString, CFRangeMake(0, length), - (UniChar*)lpWideCharStr); - retval = length; - } - else - { - /* Just return the number of wide characters needed. */ - retval = CFStringGetLength(cfString); - } - -ReleaseString: - if (cfString != NULL) - { - CFRelease(cfString); - } -#endif /* !HAVE_COREFOUNDATION */ EXIT: @@ -688,13 +483,6 @@ WideCharToMultiByte( INT retval =0; char defaultChar = '?'; BOOL usedDefaultChar = FALSE; -#if HAVE_COREFOUNDATION - CFStringRef cfString = NULL; - CFStringEncoding cfEncoding; - int charsToConvert; - CFIndex charsConverted; - CFIndex bytesConverted; -#endif /* !HAVE_COREFOUNDATION */ PERF_ENTRY(WideCharToMultiByte); ENTRY("WideCharToMultiByte(CodePage=%u, dwFlags=%#x, lpWideCharStr=%p (%S), " @@ -735,7 +523,7 @@ WideCharToMultiByte( // Use UnicodeToUTF8 on all systems because we use // UTF8ToUnicode in MultiByteToWideChar() on all systems. - if (CodePage == CP_UTF8 || (CodePage == CP_ACP && GetACP() == CP_UTF8)) + if (CodePage == CP_UTF8 || CodePage == CP_ACP) { if (cchWideChar == -1) { @@ -745,78 +533,9 @@ WideCharToMultiByte( goto EXIT; } -#if HAVE_COREFOUNDATION - charsToConvert = cchWideChar; - if (charsToConvert == -1) - { - LPCWSTR ptr = lpWideCharStr; - - charsToConvert = 0; - while(*ptr++ != 0) - { - charsToConvert++; - } - charsToConvert++; /* For the terminating '\0' */ - } - - cfEncoding = CODEPAGECPToCFStringEncoding(CodePage); - if (cfEncoding == kCFStringEncodingInvalidId) - { - ERROR( "This code page is not in the system.\n" ); - SetLastError(ERROR_INVALID_PARAMETER); - goto EXIT; - } - - cfString = CFStringCreateWithCharacters(kCFAllocatorDefault, - (const UniChar*)lpWideCharStr, charsToConvert); - if (cfString == NULL) - { - ERROR("CFString creation failed.\n"); - SetLastError(ERROR_INVALID_PARAMETER); - goto EXIT; - } - - if (cbMultiByte == 0) - { - lpMultiByteStr = NULL; - } - charsConverted = CFStringGetBytes(cfString, - CFRangeMake(0, charsToConvert), - cfEncoding, '?', TRUE, (UInt8*)lpMultiByteStr, - cbMultiByte, &bytesConverted); - if (charsConverted != charsToConvert) - { - if (lpMultiByteStr != NULL) - { - // CFStringGetBytes can fail due to an insufficient buffer or for - // other reasons. We need to check if we're out of buffer space. - charsConverted = CFStringGetBytes(cfString, - CFRangeMake(0, charsToConvert), - cfEncoding, '?', TRUE, NULL, - 0, &bytesConverted); - if (cbMultiByte < bytesConverted) - { - ERROR("Insufficient buffer for CFStringGetBytes.\n"); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - goto ReleaseString; - } - } - ERROR("Not all characters were converted.\n"); - SetLastError(ERROR_INVALID_PARAMETER); - goto ReleaseString; - } - retval = bytesConverted; - -ReleaseString: - if (cfString != NULL) - { - CFRelease(cfString); - } -#else /*HAVE_COREFOUNDATION */ ERROR( "This code page is not in the system.\n" ); SetLastError( ERROR_INVALID_PARAMETER ); goto EXIT; -#endif /* HAVE_COREFOUNDATION */ EXIT: diff --git a/src/coreclr/src/pal/src/misc/fmtmessage.cpp b/src/coreclr/src/pal/src/misc/fmtmessage.cpp index 6ca6669..78d12cc 100644 --- a/src/coreclr/src/pal/src/misc/fmtmessage.cpp +++ b/src/coreclr/src/pal/src/misc/fmtmessage.cpp @@ -31,11 +31,7 @@ Revision History: #include "errorstrings.h" #include -#if NEED_DLCOMPAT -#include "dlcompat.h" -#else // NEED_DLCOMPAT #include -#endif // NEED_DLCOMPAT #include #include diff --git a/src/coreclr/src/pal/tests/palsuite/DisabledTests.txt b/src/coreclr/src/pal/tests/palsuite/DisabledTests.txt index e0667e6..babd443 100644 --- a/src/coreclr/src/pal/tests/palsuite/DisabledTests.txt +++ b/src/coreclr/src/pal/tests/palsuite/DisabledTests.txt @@ -42,12 +42,6 @@ This test will be useful in future versions for testing various languages (code pages). Currently only U.S. English (tested by - test1) is supported. -locale_info/isvalidcodepage/test2: -======================================= -This test will be useful in future versions for testing various -languages (code pages). Currently only U.S. English (tested by - -test1) is supported. - pal_specific/pal_get_stdin/test1 : ======================================= This test case should be run manually. Requires user input. diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/CMakeLists.txt index c9756e9..772ff2b 100644 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/CMakeLists.txt +++ b/src/coreclr/src/pal/tests/palsuite/locale_info/CMakeLists.txt @@ -4,19 +4,11 @@ cmake_minimum_required(VERSION 2.8.12.2) # add_subdirectory(CompareStringA) # add_subdirectory(CompareStringW) # add_subdirectory(GetLocaleInfoW) -# add_subdirectory(GetSystemDefaultLangID) -# add_subdirectory(GetThreadLocale) -# add_subdirectory(GetTimeZoneInformation) -# add_subdirectory(GetUserDefaultLangID) -# add_subdirectory(GetUserDefaultLCID) -# add_subdirectory(IsValidLocale) -# add_subdirectory(SetThreadLocale) add_subdirectory(GetACP) add_subdirectory(GetCPInfo) add_subdirectory(IsDBCSLeadByte) add_subdirectory(IsDBCSLeadByteEx) -add_subdirectory(IsValidCodePage) add_subdirectory(MultiByteToWideChar) add_subdirectory(WideCharToMultiByte) diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/CMakeLists.txt deleted file mode 100644 index f6aa0cb..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/test1/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/test1/CMakeLists.txt deleted file mode 100644 index acbe40d..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.cpp -) - -add_executable(paltest_getsystemdefaultlangid_test1 - ${SOURCES} -) - -add_dependencies(paltest_getsystemdefaultlangid_test1 coreclrpal) - -target_link_libraries(paltest_getsystemdefaultlangid_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/test1/test1.cpp b/src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/test1/test1.cpp deleted file mode 100644 index 1bc5120..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/test1/test1.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Checks that GetSystemDefaultLangID can be used to make a valid -** locale, and that it is consistent with LOCALE_USER_DEFAULT. -** -** -**==========================================================================*/ - -#include - -int __cdecl main(int argc, char *argv[]) -{ - - LCID lcid; - LANGID LangID; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - LangID = GetSystemDefaultLangID(); - if (LangID == 0) - { - Fail("GetSystemDefaultLangID failed!\n"); - } - - /* Try using the langid (with default sort) as a locale */ - if (!SetThreadLocale(MAKELCID(LangID, SORT_DEFAULT))) - { - Fail("Unable to use GetSystemDefaultLangID as a locale!\n"); - } - lcid = GetThreadLocale(); - if (!IsValidLocale(lcid, LCID_INSTALLED)) - { - Fail("Unable to use GetSystemDefaultLangID as a locale!\n"); - } - - /* Make sure results consistent with using LOCALE_USER_DEFAULT */ - if (!SetThreadLocale(LOCALE_USER_DEFAULT)) - { - Fail("Unexpected error testing GetSystemDefaultLangID!\n"); - } - if (GetThreadLocale() != lcid) - { - Fail("Results from GetSystemDefaultLangID inconsistent with " - "LOCALE_USER_DEFAULT!\n"); - } - - PAL_Terminate(); - - return PASS; -} diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/test1/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/test1/testinfo.dat deleted file mode 100644 index e37ce45..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetSystemDefaultLangID/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Locale Information -Function = GetSystemDefaultLangID -Name = Test #1 for GetSystemDefaultLangID -TYPE = DEFAULT -EXE1 = test1 -Description -=Checks that GetSystemDefaultLangID can be used to make a valid -=locale, and that it is consistent with LOCALE_USER_DEFAULT. diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/CMakeLists.txt deleted file mode 100644 index f6aa0cb..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/test1/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/test1/CMakeLists.txt deleted file mode 100644 index b6d0f27..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.cpp -) - -add_executable(paltest_getthreadlocale_test1 - ${SOURCES} -) - -add_dependencies(paltest_getthreadlocale_test1 coreclrpal) - -target_link_libraries(paltest_getthreadlocale_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/test1/test1.cpp b/src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/test1/test1.cpp deleted file mode 100644 index 8eb7252..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/test1/test1.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Tests that GetThreadLocale returns a valid locale. -** -** -**==========================================================================*/ - -#include - -int __cdecl main(int argc, char *argv[]) -{ - LCID lcid; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - lcid = GetThreadLocale(); - - if (!IsValidLocale(lcid, LCID_INSTALLED)) - { - Fail("GetThreadLocale returned a locale that is not installed!\n"); - } - - PAL_Terminate(); - - return PASS; -} - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/test1/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/test1/testinfo.dat deleted file mode 100644 index a58782a..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetThreadLocale/test1/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Locale Information -Function = GetThreadLocale -Name = Test #1 for GetThreadLocale -TYPE = DEFAULT -EXE1 = test1 -Description -=Tests that GetThreadLocale returns a valid locale diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/CMakeLists.txt deleted file mode 100644 index f6aa0cb..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/test1/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/test1/CMakeLists.txt deleted file mode 100644 index d62a4c2..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.cpp -) - -add_executable(paltest_gettimezoneinformation_test1 - ${SOURCES} -) - -add_dependencies(paltest_gettimezoneinformation_test1 coreclrpal) - -target_link_libraries(paltest_gettimezoneinformation_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/test1/test1.cpp b/src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/test1/test1.cpp deleted file mode 100644 index bb83ade..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/test1/test1.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Tests that GetTimeZoneInformation gives reasonable values. -** -** -**==========================================================================*/ - - -#include - -int __cdecl main(int argc, char *argv[]) -{ - TIME_ZONE_INFORMATION tzi; - DWORD ret; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - ret = GetTimeZoneInformation(&tzi); - if (ret == TIME_ZONE_ID_UNKNOWN) - { - /* Occurs in time zones that do not use daylight savings time. */ - if (tzi.StandardBias != 0) - { - Fail("GetTimeZoneInformation() gave invalid data!\n" - "Returned TIME_ZONE_ID_UNKNOWN but StandardBias != 0!\n"); - } - if (tzi.DaylightBias != 0) - { - Fail("GetTimeZoneInformation() gave invalid data!\n" - "Returned TIME_ZONE_ID_UNKNOWN but DaylightBias != 0!\n"); - } - } - else if (ret == TIME_ZONE_ID_STANDARD) - { - if (tzi.StandardBias != 0) - { - Fail("GetTimeZoneInformation() gave invalid data!\n" - "StandardBias is %d, should be 0!\n", tzi.StandardBias); - } - } - else if (ret == TIME_ZONE_ID_DAYLIGHT) - { - if (tzi.DaylightBias != -60 && tzi.DaylightBias != 0) - { - Fail("GetTimeZoneInformation() gave invalid data!\n" - "DaylightBias is %d, should be 0 or -60!\n", tzi.DaylightBias); - } - } - else - { - Fail("GetTimeZoneInformation() returned an invalid value!\n"); - } - - if (tzi.Bias % 30 != 0) - { - Fail("GetTimeZoneInformation() gave an invalid bias of %d!\n", - tzi.Bias); - } - - PAL_Terminate(); - - return PASS; -} - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/test1/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/test1/testinfo.dat deleted file mode 100644 index 382b8d5..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetTimeZoneInformation/test1/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Locale Information -Function = GetTimeZoneInformation -Name = Test #1 for GetTimeZoneInformation -TYPE = DEFAULT -EXE1 = test1 -Description -=Tests that GetTimeZoneInformation gives reasonable values. diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/CMakeLists.txt deleted file mode 100644 index f6aa0cb..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/test1/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/test1/CMakeLists.txt deleted file mode 100644 index 256d818..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.cpp -) - -add_executable(paltest_getuserdefaultlcid_test1 - ${SOURCES} -) - -add_dependencies(paltest_getuserdefaultlcid_test1 coreclrpal) - -target_link_libraries(paltest_getuserdefaultlcid_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/test1/test1.cpp b/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/test1/test1.cpp deleted file mode 100644 index 4a336f9..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/test1/test1.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Tests that GetUserDefaultLCID returns a valid locale that is -** consistent with LOCALE_USER_DEFAULT. -** -** -**==========================================================================*/ - -#include - -int __cdecl main(int argc, char *argv[]) -{ - LCID lcid; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - lcid = GetUserDefaultLCID(); - if (lcid == 0) - { - Fail("GetUserDefaultLCID failed!\n"); - } - - if (!IsValidLocale(lcid, LCID_INSTALLED)) - { - Fail("GetUserDefaultLCID gave an invalid locale!\n"); - } - - /* Make sure results consistent with using LOCALE_USER_DEFAULT */ - if (!SetThreadLocale(LOCALE_USER_DEFAULT)) - { - Fail("Unexpected error testing GetUserDefaultLCID!\n"); - } - if (GetThreadLocale() != lcid) - { - Fail("Results from GetUserDefaultLCID inconsistent with " - "LOCALE_USER_DEFAULT!\n"); - } - - PAL_Terminate(); - - return PASS; -} - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/test1/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/test1/testinfo.dat deleted file mode 100644 index 73565b0..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLCID/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Locale Information -Function = GetUserDefaultLCID -Name = Test #1 for GetUserDefaultLCID -TYPE = DEFAULT -EXE1 = test1 -Description -=Tests that GetUserDefaultLCID returns a valid locale that is -=consistent with LOCALE_USER_DEFAULT. diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/CMakeLists.txt deleted file mode 100644 index f6aa0cb..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/test1/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/test1/CMakeLists.txt deleted file mode 100644 index ac3c78a..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.cpp -) - -add_executable(paltest_getuserdefaultlangid_test1 - ${SOURCES} -) - -add_dependencies(paltest_getuserdefaultlangid_test1 coreclrpal) - -target_link_libraries(paltest_getuserdefaultlangid_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/test1/test1.cpp b/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/test1/test1.cpp deleted file mode 100644 index 51c5678..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/test1/test1.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Checks that GetUserDefaultLangID can be used to make a valid -** locale, and that it is consistent with LOCALE_USER_DEFAULT. -** -** -**==========================================================================*/ - -#include - -int __cdecl main(int argc, char *argv[]) -{ - - LCID lcid; - LANGID LangID; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - LangID = GetUserDefaultLangID(); - if (LangID == 0) - { - Fail("GetUserDefaultLangID failed!\n"); - } - - /* Try using the langid (with default sort) as a locale */ - if (!SetThreadLocale(MAKELCID(LangID, SORT_DEFAULT))) - { - Fail("Unable to use GetUserDefaultLangID as a locale!\n"); - } - lcid = GetThreadLocale(); - if (!IsValidLocale(lcid, LCID_INSTALLED)) - { - Fail("Unable to use GetUserDefaultLangID as a locale!\n"); - } - - /* Make sure results consistent with using LOCALE_USER_DEFAULT */ - if (!SetThreadLocale(LOCALE_USER_DEFAULT)) - { - Fail("Unexpected error testing GetUserDefaultLangID!\n"); - } - if (GetThreadLocale() != lcid) - { - Fail("Results from GetUserDefaultLangID inconsistent with " - "LOCALE_USER_DEFAULT!\n"); - } - - PAL_Terminate(); - - return PASS; -} - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/test1/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/test1/testinfo.dat deleted file mode 100644 index a461257..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/GetUserDefaultLangID/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Locale Information -Function = GetUserDefaultLangID -Name = Test #1 for GetUserDefaultLangID -TYPE = DEFAULT -EXE1 = test1 -Description -=Checks that GetUserDefaultLangID can be used to make a valid -=locale, and that it is consistent with LOCALE_USER_DEFAULT. diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/CMakeLists.txt deleted file mode 100644 index ef14ea5..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) -add_subdirectory(test2) - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/test1/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/test1/CMakeLists.txt deleted file mode 100644 index a907848..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.cpp -) - -add_executable(paltest_isvalidcodepage_test1 - ${SOURCES} -) - -add_dependencies(paltest_isvalidcodepage_test1 coreclrpal) - -target_link_libraries(paltest_isvalidcodepage_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/test1/test1.cpp b/src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/test1/test1.cpp deleted file mode 100644 index deb6a7a..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/IsValidCodePage/test1/test1.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Tests IsValidCodePage with a collection of valid and invalid -** code pages. -** -** -**==========================================================================*/ - - -#include - - -UINT InvalidCodePages[] = -{ - 0, 0x1, 0x2, 0x3, 0xfff -}; - -int NumInvalidPages = sizeof(InvalidCodePages) / sizeof(InvalidCodePages[0]); - -int __cdecl main(int argc, char *argv[]) -{ - int i; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - - for (i=0; i - -UINT ValidCodePages[] = -{ - 0x25, 0x1b5, 0x1f4, 0x352, 0x35c, 0x35d, 0x35f, 0x361, - 0x36a, 0x3a4, 0x3a8, 0x3b5, 0x3b6, 0x4e2, 0x4e3, 0x4e4, 0x4e5, 0x4e6, - 0x4e7, 0x4e8, 0x4e9, 0x4ea, 0x2710, 0x275f, 0x4e9f, 0x4f25, 0x5182, 0x6faf, - 0x6fb0, 0x6fbd, 0xfde8, 0xfde9 -}; - - -int NumValidPages = sizeof(ValidCodePages) / sizeof(ValidCodePages[0]); -int __cdecl main(int argc, char *argv[]) -{ - int i; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - for (i=0; i - - -int __cdecl main(int argc, char *argv[]) -{ - - LCID lcid; - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - - /* - * Passing LOCALE_USER_DEFAULT to IsValidLocale will fail, so instead - * the current thread localed is changed to it, and that lcid is passed - * to IsValidLocale (which should always pass) - */ - if (!SetThreadLocale(LOCALE_USER_DEFAULT)) - { - Fail("Unable to set locale to LOCALE_USER_DEFAULT!\n"); - } - - lcid = GetThreadLocale(); - - if (!IsValidLocale(lcid, LCID_SUPPORTED)) - { - Fail("IsValidLocale found the default user locale unsupported!\n"); - } - if (!IsValidLocale(lcid, LCID_INSTALLED)) - { - Fail("IsValidLocale found the default user locale uninstalled!\n"); - } - - /* - * Test out bad parameters - */ - if (IsValidLocale(-1, LCID_SUPPORTED)) - { - Fail("IsValideLocale passed with an invalid LCID!\n"); - } - if (IsValidLocale(-1, LCID_INSTALLED)) - { - Fail("IsValideLocale passed with an invalid LCID!\n"); - } - - if (IsValidLocale(LOCALE_USER_DEFAULT, LCID_SUPPORTED)) - { - Fail("IsValidLocale passed with LOCALE_USER_DEFAULT!\n"); - } - if (IsValidLocale(LOCALE_USER_DEFAULT, LCID_INSTALLED)) - { - Fail("IsValidLocale passed with LOCALE_USER_DEFAULT!\n"); - } - - PAL_Terminate(); - - return PASS; -} - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/IsValidLocale/test1/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/locale_info/IsValidLocale/test1/testinfo.dat deleted file mode 100644 index e9fcc18..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/IsValidLocale/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Locale Information -Function = IsValidLocale -Name = Test #1 for IsValidLocale -TYPE = DEFAULT -EXE1 = test1 -Description -=Tests IsValidLocale with the current locale, -1, and LOCALE_USER_DEFAULT -=(which actually isn't valid). diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/CMakeLists.txt deleted file mode 100644 index f6aa0cb..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/test1/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/test1/CMakeLists.txt deleted file mode 100644 index 7b0cde4..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.cpp -) - -add_executable(paltest_setthreadlocale_test1 - ${SOURCES} -) - -add_dependencies(paltest_setthreadlocale_test1 coreclrpal) - -target_link_libraries(paltest_setthreadlocale_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/test1/test1.cpp b/src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/test1/test1.cpp deleted file mode 100644 index 794093c..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/test1/test1.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================================ -** -** Source: test1.c -** -** Purpose: Tests SetThreadLocale with every valid locale to see that it passes -** and that it actually sets the locale. -** -** -**==========================================================================*/ - -#include - -int __cdecl main(int argc, char *argv[]) -{ - int i; - - - if (PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* Try all possible locale's */ - for (i=0; i<0x000fffff; i++) - { - if (!IsValidLocale(i, LCID_INSTALLED)) - { - continue; - } - - if (!SetThreadLocale(i)) - { - Fail("SetThreadLocale failed for an installed locale!\n"); - } - - if (GetThreadLocale() != i) - { - Fail("SetThreadLocale didn't actually change to LCID %#x!\n", i); - } - } - - PAL_Terminate(); - - return PASS; -} - diff --git a/src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/test1/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/test1/testinfo.dat deleted file mode 100644 index ba0f5b7..0000000 --- a/src/coreclr/src/pal/tests/palsuite/locale_info/SetThreadLocale/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Locale Information -Function = SetThreadLocale -Name = Test #1 for SetThreadLocale -TYPE = DEFAULT -EXE1 = test1 -Description -=Tests SetThreadLocale with every valid locale to see that it passes -=and that it actually sets the locale. diff --git a/src/coreclr/src/pal/tests/palsuite/paltestlist.txt b/src/coreclr/src/pal/tests/palsuite/paltestlist.txt index d4e41be..2406e1c 100644 --- a/src/coreclr/src/pal/tests/palsuite/paltestlist.txt +++ b/src/coreclr/src/pal/tests/palsuite/paltestlist.txt @@ -606,7 +606,6 @@ locale_info/GetCPInfo/test1/paltest_getcpinfo_test1 locale_info/GetCPInfo/test3/paltest_getcpinfo_test3 locale_info/IsDBCSLeadByte/test1/paltest_isdbcsleadbyte_test1 locale_info/IsDBCSLeadByteEx/test1/paltest_isdbcsleadbyteex_test1 -locale_info/IsValidCodePage/test1/paltest_isvalidcodepage_test1 locale_info/MultiByteToWideChar/test1/paltest_multibytetowidechar_test1 locale_info/MultiByteToWideChar/test2/paltest_multibytetowidechar_test2 locale_info/MultiByteToWideChar/test3/paltest_multibytetowidechar_test3 diff --git a/src/coreclr/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt b/src/coreclr/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt index 375f682..e630ee5 100644 --- a/src/coreclr/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt +++ b/src/coreclr/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt @@ -111,14 +111,6 @@ locale_info/GetLocaleInfoW/test1/paltest_getlocaleinfow_test1 locale_info/GetLocaleInfoW/test2/paltest_getlocaleinfow_test2 locale_info/GetStringTypeExW/test1/paltest_getstringtypeexw_test1 locale_info/GetStringTypeExW/test2/paltest_getstringtypeexw_test2 -locale_info/GetSystemDefaultLangID/test1/paltest_getsystemdefaultlangid_test1 -locale_info/GetThreadLocale/test1/paltest_getthreadlocale_test1 -locale_info/GetTimeZoneInformation/test1/paltest_gettimezoneinformation_test1 -locale_info/GetUserDefaultLangID/test1/paltest_getuserdefaultlangid_test1 -locale_info/GetUserDefaultLCID/test1/paltest_getuserdefaultlcid_test1 -locale_info/IsValidCodePage/test2/paltest_isvalidcodepage_test2 -locale_info/IsValidLocale/test1/paltest_isvalidlocale_test1 -locale_info/SetThreadLocale/test1/paltest_setthreadlocale_test1 locale_info/WideCharToMultiByte/test4/paltest_widechartomultibyte_test4 miscellaneous/FormatMessageW/test4/paltest_formatmessagew_test4 miscellaneous/FormatMessageW/test5/paltest_formatmessagew_test5 -- 2.7.4