Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/coreclr/dlls/mscordac/mscordac_unixexports.src
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,8 @@ nativeStringResourceTable_mscorrc
#PAL_InitializeDLL
#PAL_TerminateEx
#PAL_ProbeMemory
#PAL__wcstoui64
#PAL_wcstoul
#PAL_wcstod
#PAL_VirtualUnwindOutOfProc
#PAL_wcslen
#PAL_wcsncmp
#PAL_wcsrchr
#PAL_wcscmp
#PAL_wcschr
#PAL_wcscat
#PAL_wcsstr

#_wcsicmp
#sprintf_s
#vsprintf_s
#_snprintf_s
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/ilasm/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ extern "C" int _cdecl wmain(int argc, _In_ WCHAR **argv)
WCHAR wzSubOpt[8];
wcsncpy_s(wzSubOpt,8,pStr,3);
wzSubOpt[3] = 0;
if(0 == _wcsicmp(wzSubOpt,W("OPT")))
if(0 == u16_stricmp(wzSubOpt,W("OPT")))
pAsm->m_dwIncludeDebugInfo = 0x3;
else if(0 == _wcsicmp(wzSubOpt,W("IMP")))
else if(0 == u16_stricmp(wzSubOpt,W("IMP")))
pAsm->m_dwIncludeDebugInfo = 0x103;
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/ildasm/dasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6764,7 +6764,7 @@ void DumpMetaInfo(_In_ __nullterminated const WCHAR* pwzFileName, _In_opt_z_ con

DumpMI((char*)GUICookie); // initialize the print function for DumpMetaInfo

if(pch && (!_wcsicmp(pch+1,W("lib")) || !_wcsicmp(pch+1,W("obj"))))
if(pch && (!u16_stricmp(pch+1,W("lib")) || !u16_stricmp(pch+1,W("obj"))))
{ // This works only when all the rest does not
// Init and run.
if (SUCCEEDED(CreateMetaDataDispenser(IID_IMetaDataDispenserEx, (void **)&g_pDisp)))
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/ildasm/dman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ static BOOL ConvertToLegalFileNameInPlace(__inout LPWSTR wzName)
for (size_t i = 0; i < (sizeof(rwzReserved) / sizeof(WCHAR *)); i++)
{
_ASSERTE(u16_strlen(rwzReserved[i]) == 3);
if (_wcsnicmp(wzName, rwzReserved[i], 3) == 0)
if (u16_strnicmp(wzName, rwzReserved[i], 3) == 0)
{
LPWSTR pwc = wzName + 3;

Expand Down Expand Up @@ -856,7 +856,7 @@ void DumpManifestResources(void* GUICookie)
for (ULONG i = 0; i < (ix + 2); i++)
{
WCHAR *wzPreviousName = (WCHAR *)qbNameArray[i].Ptr();
if (wzPreviousName && _wcsicmp(wzName, wzPreviousName) == 0)
if (wzPreviousName && u16_stricmp(wzName, wzPreviousName) == 0)
{
// resource with the same name as another resource
// or with the same name as the output IL/RES file
Expand Down
72 changes: 24 additions & 48 deletions src/coreclr/inc/corhlprpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#define __CORHLPRPRIV_H__

#include "corhlpr.h"
#include "fstring.h"
#include <errno.h>
#include <minipal/utf8.h>
#include <dn-u16.h>

#if defined(_MSC_VER) && defined(HOST_X86)
#pragma optimize("y", on) // If routines don't get inlined, don't pay the EBP frame penalty
Expand Down Expand Up @@ -274,70 +276,44 @@ class CQuickMemoryBase
}


// Convert UTF8 string to UNICODE string, optimized for speed
HRESULT ConvertUtf8_UnicodeNoThrow(const char * utf8str)
// Convert UTF8 string to UNICODE string
void ConvertUtf8_Unicode(const char * utf8str)
{
bool allAscii;
DWORD length;

HRESULT hr = FString::Utf8_Unicode_Length(utf8str, & allAscii, & length);

if (SUCCEEDED(hr))
size_t sourceLength = strlen(utf8str) + 1;
size_t length = minipal_get_length_utf8_to_utf16(utf8str, sourceLength, 0);
if (length == 0)
{
LPWSTR buffer = (LPWSTR) AllocNoThrow((length + 1) * sizeof(WCHAR));

if (buffer == NULL)
{
hr = E_OUTOFMEMORY;
}
else
{
hr = FString::Utf8_Unicode(utf8str, allAscii, buffer, length);
}
ThrowHR(HRESULT_FROM_WIN32(errno));
}

return hr;
}

// Convert UTF8 string to UNICODE string, optimized for speed
void ConvertUtf8_Unicode(const char * utf8str)
{
bool allAscii;
DWORD length;

HRESULT hr = FString::Utf8_Unicode_Length(utf8str, & allAscii, & length);

if (SUCCEEDED(hr))
if (length > SIZE_MAX / sizeof(WCHAR))
{
LPWSTR buffer = (LPWSTR) AllocThrows((length + 1) * sizeof(WCHAR));

hr = FString::Utf8_Unicode(utf8str, allAscii, buffer, length);
ThrowHR(COR_E_OVERFLOW);
}

if (FAILED(hr))
CHAR16_T* buffer = (CHAR16_T*) AllocThrows(length * sizeof(WCHAR));

if (minipal_convert_utf8_to_utf16(utf8str, sourceLength, buffer, length, 0) == 0)
{
ThrowHR(hr);
ThrowHR(HRESULT_FROM_WIN32(errno));
}
}

// Convert UNICODE string to UTF8 string, optimized for speed
// Convert UNICODE string to UTF8 string
void ConvertUnicode_Utf8(const WCHAR * pString)
{
bool allAscii;
DWORD length;

HRESULT hr = FString::Unicode_Utf8_Length(pString, & allAscii, & length);

if (SUCCEEDED(hr))
size_t sourceLength = u16_strlen(pString) + 1;
size_t length = minipal_get_length_utf16_to_utf8((const CHAR16_T*)pString, sourceLength, 0);
if (length == 0)
{
LPSTR buffer = (LPSTR) AllocThrows((length + 1) * sizeof(char));

hr = FString::Unicode_Utf8(pString, allAscii, buffer, length);
ThrowHR(HRESULT_FROM_WIN32(errno));
}

if (FAILED(hr))
LPSTR buffer = (LPSTR) AllocThrows(length);

if (minipal_convert_utf16_to_utf8((const CHAR16_T*)pString, sourceLength, buffer, length, 0) == 0)
{
ThrowHR(hr);
ThrowHR(HRESULT_FROM_WIN32(errno));
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/inc/eventtracebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,10 @@ class XplatEventLoggerConfiguration

uint32_t ParseLevel(ComponentSpan const & component) const
{
int level = TRACE_LEVEL_VERBOSE; // Verbose
uint32_t level = TRACE_LEVEL_VERBOSE; // Verbose
if ((component.End - component.Start) != 0)
{
level = _wtoi(component.Start);
level = u16_strtoul(component.Start, nullptr, 10);
}
return level;
}
Expand Down Expand Up @@ -423,7 +423,7 @@ class XplatEventLoggerController
auto providerName = config.GetProviderName();
auto enabledKeywordsMask = config.GetEnabledKeywordsMask();
auto level = config.GetLevel();
if (_wcsicmp(providerName, W("*")) == 0 && enabledKeywordsMask == (ULONGLONG)(-1) && level == TRACE_LEVEL_VERBOSE)
if (u16_stricmp(providerName, W("*")) == 0 && enabledKeywordsMask == (ULONGLONG)(-1) && level == TRACE_LEVEL_VERBOSE)
{
ActivateAllKeywordsOfAllProviders();
}
Expand Down Expand Up @@ -461,7 +461,7 @@ class XplatEventLoggerController
auto length = u16_strlen(providerName);
for (auto provider : ALL_LTTNG_PROVIDERS_CONTEXT)
{
if (_wcsicmp(provider->Name, providerName) == 0)
if (u16_stricmp(provider->Name, providerName) == 0)
{
return provider;
}
Expand Down
44 changes: 0 additions & 44 deletions src/coreclr/inc/fstring.h

This file was deleted.

4 changes: 2 additions & 2 deletions src/coreclr/inc/sstring.inl
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ inline int SString::_wcsicmp(const WCHAR *buffer1, const WCHAR *buffer2) {
WRAPPER_NO_CONTRACT;
int returnValue = CaseCompareHelper(buffer1, buffer2, 0, TRUE, FALSE);
#ifdef VERIFY_CRT_EQUIVALNCE
_ASSERTE((returnValue == 0) == (::_wcsicmp(buffer1, buffer2) == 0));
_ASSERTE((returnValue == 0) == (u16_stricmp(buffer1, buffer2) == 0));
#endif
return returnValue;

Expand All @@ -752,7 +752,7 @@ inline int SString::_wcsnicmp(const WCHAR *buffer1, const WCHAR *buffer2, COUNT_
WRAPPER_NO_CONTRACT;
int returnValue = CaseCompareHelper(buffer1, buffer2, count, TRUE, TRUE);
#ifdef VERIFY_CRT_EQUIVALNCE
_ASSERTE((returnValue == 0) == (::_wcsnicmp(buffer1, buffer2, count) == 0));
_ASSERTE((returnValue == 0) == (u16_strnicmp(buffer1, buffer2, count) == 0));
#endif
return returnValue;
}
Expand Down
Loading
Loading