Skip to content

Commit c867337

Browse files
authored
Delete unused multibyte methods from PAL (#42157)
1 parent 97a841b commit c867337

File tree

78 files changed

+356
-3826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+356
-3826
lines changed

src/coreclr/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,18 @@ bool StartProcess(char* commandLine, HANDLE hStdOutput, HANDLE hStdError, HANDLE
3131

3232
ZeroMemory(&pi, sizeof(pi));
3333

34+
#if TARGET_UNIX
35+
const unsigned cmdLen = (unsigned)strlen(commandLine) + 1;
36+
WCHAR* cmdLineW = new WCHAR[cmdLen];
37+
MultiByteToWideChar(CP_UTF8, 0, commandLine, cmdLen, cmdLineW, cmdLen);
38+
#endif
3439
// Start the child process.
3540
if (!CreateProcess(NULL, // No module name (use command line)
41+
#if TARGET_UNIX
42+
cmdLineW, // Command line
43+
#else
3644
commandLine, // Command line
45+
#endif
3746
NULL, // Process handle not inheritable
3847
NULL, // Thread handle not inheritable
3948
TRUE, // Set handle inheritance to TRUE (required to use STARTF_USESTDHANDLES)
@@ -45,10 +54,17 @@ bool StartProcess(char* commandLine, HANDLE hStdOutput, HANDLE hStdError, HANDLE
4554
{
4655
LogError("CreateProcess failed (%d). CommandLine: %s", GetLastError(), commandLine);
4756
*hProcess = INVALID_HANDLE_VALUE;
57+
#if TARGET_UNIX
58+
delete[] cmdLineW;
59+
#endif
4860
return false;
4961
}
5062

5163
*hProcess = pi.hProcess;
64+
65+
#if TARGET_UNIX
66+
delete[] cmdLineW;
67+
#endif
5268
return true;
5369
}
5470

src/coreclr/src/dlls/mscordac/mscordac_unixexports.src

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ nativeStringResourceTable_mscorrc
8585
#sscanf_s
8686

8787
#CopyFileW
88-
#CreateFileMappingA
8988
#CreateFileMappingW
9089
#CreateFileA
9190
#CreateFileW

src/coreclr/src/pal/inc/pal.h

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,8 @@ PALAPI
498498
PAL_GetPALDirectoryW(
499499
OUT LPWSTR lpDirectoryName,
500500
IN OUT UINT* cchDirectoryName);
501-
#ifdef UNICODE
501+
502502
#define PAL_GetPALDirectory PAL_GetPALDirectoryW
503-
#else
504-
#define PAL_GetPALDirectory PAL_GetPALDirectoryA
505-
#endif
506503

507504
PALIMPORT
508505
VOID
@@ -711,13 +708,8 @@ SearchPathW(
711708
OUT LPWSTR lpBuffer,
712709
OUT LPWSTR *lpFilePart
713710
);
714-
#ifdef UNICODE
715-
#define SearchPath SearchPathW
716-
#else
717-
#define SearchPath SearchPathA
718-
#endif // !UNICODE
719-
720711

712+
#define SearchPath SearchPathW
721713

722714
PALIMPORT
723715
BOOL
@@ -733,7 +725,6 @@ CopyFileW(
733725
#define CopyFile CopyFileA
734726
#endif
735727

736-
737728
PALIMPORT
738729
BOOL
739730
PALAPI
@@ -746,12 +737,9 @@ DeleteFileW(
746737
#define DeleteFile DeleteFileA
747738
#endif
748739

749-
750-
751740
#define MOVEFILE_REPLACE_EXISTING 0x00000001
752741
#define MOVEFILE_COPY_ALLOWED 0x00000002
753742

754-
755743
PALIMPORT
756744
BOOL
757745
PALAPI
@@ -1252,34 +1240,8 @@ typedef struct _STARTUPINFOW {
12521240
HANDLE hStdError;
12531241
} STARTUPINFOW, *LPSTARTUPINFOW;
12541242

1255-
typedef struct _STARTUPINFOA {
1256-
DWORD cb;
1257-
LPSTR lpReserved_PAL_Undefined;
1258-
LPSTR lpDesktop_PAL_Undefined;
1259-
LPSTR lpTitle_PAL_Undefined;
1260-
DWORD dwX_PAL_Undefined;
1261-
DWORD dwY_PAL_Undefined;
1262-
DWORD dwXSize_PAL_Undefined;
1263-
DWORD dwYSize_PAL_Undefined;
1264-
DWORD dwXCountChars_PAL_Undefined;
1265-
DWORD dwYCountChars_PAL_Undefined;
1266-
DWORD dwFillAttribute_PAL_Undefined;
1267-
DWORD dwFlags;
1268-
WORD wShowWindow_PAL_Undefined;
1269-
WORD cbReserved2_PAL_Undefined;
1270-
LPBYTE lpReserved2_PAL_Undefined;
1271-
HANDLE hStdInput;
1272-
HANDLE hStdOutput;
1273-
HANDLE hStdError;
1274-
} STARTUPINFOA, *LPSTARTUPINFOA;
1275-
1276-
#ifdef UNICODE
12771243
typedef STARTUPINFOW STARTUPINFO;
12781244
typedef LPSTARTUPINFOW LPSTARTUPINFO;
1279-
#else
1280-
typedef STARTUPINFOA STARTUPINFO;
1281-
typedef LPSTARTUPINFOW LPSTARTUPINFO;
1282-
#endif
12831245

12841246
#define CREATE_NEW_CONSOLE 0x00000010
12851247

@@ -1307,11 +1269,7 @@ CreateProcessW(
13071269
IN LPSTARTUPINFOW lpStartupInfo,
13081270
OUT LPPROCESS_INFORMATION lpProcessInformation);
13091271

1310-
#ifdef UNICODE
13111272
#define CreateProcess CreateProcessW
1312-
#else
1313-
#define CreateProcess CreateProcessA
1314-
#endif
13151273

13161274
PALIMPORT
13171275
PAL_NORETURN
@@ -2442,11 +2400,7 @@ CreateFileMappingW(
24422400
IN DWORD dwMaximumSizeLow,
24432401
IN LPCWSTR lpName);
24442402

2445-
#ifdef UNICODE
24462403
#define CreateFileMapping CreateFileMappingW
2447-
#else
2448-
#define CreateFileMapping CreateFileMappingA
2449-
#endif
24502404

24512405
#define SECTION_QUERY 0x0001
24522406
#define SECTION_MAP_WRITE 0x0002
@@ -2466,11 +2420,7 @@ OpenFileMappingW(
24662420
IN BOOL bInheritHandle,
24672421
IN LPCWSTR lpName);
24682422

2469-
#ifdef UNICODE
24702423
#define OpenFileMapping OpenFileMappingW
2471-
#else
2472-
#define OpenFileMapping OpenFileMappingA
2473-
#endif
24742424

24752425
typedef INT_PTR (PALAPI_NOEXPORT *FARPROC)();
24762426

@@ -2970,23 +2920,15 @@ LPWSTR
29702920
PALAPI
29712921
GetEnvironmentStringsW();
29722922

2973-
#ifdef UNICODE
29742923
#define GetEnvironmentStrings GetEnvironmentStringsW
2975-
#else
2976-
#define GetEnvironmentStrings GetEnvironmentStringsA
2977-
#endif
29782924

29792925
PALIMPORT
29802926
BOOL
29812927
PALAPI
29822928
FreeEnvironmentStringsW(
29832929
IN LPWSTR);
29842930

2985-
#ifdef UNICODE
29862931
#define FreeEnvironmentStrings FreeEnvironmentStringsW
2987-
#else
2988-
#define FreeEnvironmentStrings FreeEnvironmentStringsA
2989-
#endif
29902932

29912933
PALIMPORT
29922934
BOOL

src/coreclr/src/pal/inc/palprivate.h

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -153,40 +153,6 @@ OpenMutexA(
153153
IN BOOL bInheritHandle,
154154
IN LPCSTR lpName);
155155

156-
PALIMPORT
157-
BOOL
158-
PALAPI
159-
CreateProcessA(
160-
IN LPCSTR lpApplicationName,
161-
IN LPSTR lpCommandLine,
162-
IN LPSECURITY_ATTRIBUTES lpProcessAttributes,
163-
IN LPSECURITY_ATTRIBUTES lpThreadAttributes,
164-
IN BOOL bInheritHandles,
165-
IN DWORD dwCreationFlags,
166-
IN LPVOID lpEnvironment,
167-
IN LPCSTR lpCurrentDirectory,
168-
IN LPSTARTUPINFOA lpStartupInfo,
169-
OUT LPPROCESS_INFORMATION lpProcessInformation);
170-
171-
PALIMPORT
172-
HANDLE
173-
PALAPI
174-
CreateFileMappingA(
175-
IN HANDLE hFile,
176-
IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
177-
IN DWORD flProtect,
178-
IN DWORD dwMaximumSizeHigh,
179-
IN DWORD dwMaximumSizeLow,
180-
IN LPCSTR lpName);
181-
182-
PALIMPORT
183-
HANDLE
184-
PALAPI
185-
OpenFileMappingA(
186-
IN DWORD dwDesiredAccess,
187-
IN BOOL bInheritHandle,
188-
IN LPCSTR lpName);
189-
190156
PALIMPORT
191157
HMODULE
192158
PALAPI
@@ -209,12 +175,6 @@ GetModuleFileNameA(
209175
OUT LPSTR lpFileName,
210176
IN DWORD nSize);
211177

212-
213-
PALIMPORT
214-
LPSTR
215-
PALAPI
216-
GetEnvironmentStringsA();
217-
218178
PALIMPORT
219179
BOOL
220180
PALAPI
@@ -230,31 +190,12 @@ GetEnvironmentVariableA(
230190
OUT LPSTR lpBuffer,
231191
IN DWORD nSize);
232192

233-
PALIMPORT
234-
BOOL
235-
PALAPI
236-
FreeEnvironmentStringsA(
237-
IN LPSTR);
238-
239-
PALIMPORT
240-
BOOL
241-
PALAPI
242-
RemoveDirectoryA(
243-
IN LPCSTR lpPathName);
244-
245193
PALIMPORT
246194
BOOL
247195
PALAPI
248196
RemoveDirectoryW(
249197
IN LPCWSTR lpPathName);
250198

251-
PALIMPORT
252-
BOOL
253-
PALAPI
254-
PAL_GetPALDirectoryA(
255-
OUT LPSTR lpDirectoryName,
256-
IN UINT* cchDirectoryName);
257-
258199
PALIMPORT
259200
LONG
260201
PALAPI

src/coreclr/src/pal/src/file/directory.cpp

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -173,52 +173,6 @@ RemoveDirectoryHelper (
173173
return bRet;
174174
}
175175

176-
/*++
177-
Function:
178-
RemoveDirectoryA
179-
180-
See MSDN doc.
181-
--*/
182-
BOOL
183-
PALAPI
184-
RemoveDirectoryA(
185-
IN LPCSTR lpPathName)
186-
{
187-
DWORD dwLastError = 0;
188-
BOOL bRet = FALSE;
189-
PathCharString mb_dirPathString;
190-
191-
PERF_ENTRY(RemoveDirectoryA);
192-
ENTRY("RemoveDirectoryA(lpPathName=%p (%s))\n",
193-
lpPathName,
194-
lpPathName);
195-
196-
if (lpPathName == NULL)
197-
{
198-
dwLastError = ERROR_PATH_NOT_FOUND;
199-
goto done;
200-
}
201-
202-
if (!mb_dirPathString.Set(lpPathName, strlen(lpPathName)))
203-
{
204-
WARN("Set failed !\n");
205-
dwLastError = ERROR_NOT_ENOUGH_MEMORY;
206-
goto done;
207-
}
208-
209-
bRet = RemoveDirectoryHelper (mb_dirPathString, &dwLastError);
210-
211-
done:
212-
if( dwLastError )
213-
{
214-
SetLastError( dwLastError );
215-
}
216-
217-
LOGEXIT("RemoveDirectoryA returns BOOL %d\n", bRet);
218-
PERF_EXIT(RemoveDirectoryA);
219-
return bRet;
220-
}
221-
222176
/*++
223177
Function:
224178
RemoveDirectoryW

src/coreclr/src/pal/src/include/pal/stackstring.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,7 @@ typedef StackString<MAX_PATH, WCHAR> PathWCharString;
256256
BOOL
257257
PAL_GetPALDirectoryW(
258258
PathWCharString& lpDirectoryName);
259-
BOOL
260-
PAL_GetPALDirectoryA(
261-
PathCharString& lpDirectoryName);
259+
262260
DWORD
263261
GetCurrentDirectoryA(
264262
PathCharString& lpBuffer);

0 commit comments

Comments
 (0)