summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>2019-01-23 10:34:54 -0800
committerGitHub <noreply@github.com>2019-01-23 10:34:54 -0800
commit5fb8eb38f89a099461db3b5985f281db1b7ae263 (patch)
tree3c918f13e6f4476509d2f5216d98f7ef48988dc6
parent481a99f52bf0516f589368455ab05818d23e051e (diff)
downloadcoreclr-5fb8eb38f89a099461db3b5985f281db1b7ae263.tar.gz
coreclr-5fb8eb38f89a099461db3b5985f281db1b7ae263.tar.bz2
coreclr-5fb8eb38f89a099461db3b5985f281db1b7ae263.zip
Don't redirect stdlib wchar functions to our test platform shims. (#22072)
* Don't redirect stdlib wchar functions to our test platform shims. * Fix bad find-replaces. * Remove unused overload and last wchar shadowing.
-rw-r--r--tests/src/Common/Platform/platformdefines.cpp17
-rw-r--r--tests/src/Common/Platform/platformdefines.h12
-rw-r--r--tests/src/Interop/ArrayMarshalling/SafeArray/RecordNative.cpp4
-rw-r--r--tests/src/Interop/COM/NativeServer/DispatchTesting.h2
-rw-r--r--tests/src/Interop/COM/NativeServer/Servers.cpp4
-rw-r--r--tests/src/Interop/COM/NativeServer/StringTesting.h24
-rw-r--r--tests/src/Interop/PInvoke/DateTime/NativeDateTime.cpp14
-rw-r--r--tests/src/Interop/PInvoke/DllImportPath/DllImportPathNative.cpp6
-rw-r--r--tests/src/Interop/PInvoke/IEnumerator/IEnumeratorNative.h2
-rw-r--r--tests/src/Interop/StringMarshalling/LPSTR/LPSTRTestNative.cpp6
-rw-r--r--tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp48
-rw-r--r--tests/src/Interop/StringMarshalling/UTF8/UTF8TestNative.cpp2
-rw-r--r--tests/src/Interop/StringMarshalling/VBByRefStr/VBByRefStrNative.cpp4
-rw-r--r--tests/src/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h4
-rw-r--r--tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ExpStructAsParamNative.h2
-rw-r--r--tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/SeqStructDelRevPInvokeNative.cpp28
-rw-r--r--tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/SeqStructDelRevPInvokeNative.h6
17 files changed, 84 insertions, 101 deletions
diff --git a/tests/src/Common/Platform/platformdefines.cpp b/tests/src/Common/Platform/platformdefines.cpp
index 0380117640..0ac5c2cb76 100644
--- a/tests/src/Common/Platform/platformdefines.cpp
+++ b/tests/src/Common/Platform/platformdefines.cpp
@@ -34,7 +34,7 @@ LPSTR HackyConvertToSTR(LPWSTR pwszInput)
if (NULL == pwszInput) return NULL;
- cchInput = wcslen(pwszInput);
+ cchInput = TP_slen(pwszInput);
pszOutput = new char[ cchInput + 1];
for(size_t i=0; i<=cchInput; i++)
@@ -170,7 +170,7 @@ error_t TP_putenv_s(LPWSTR name, LPWSTR value)
return 0;
#else
int retVal = 0;
- char *assignment = (char*) malloc(sizeof(char) * (wcslen(name) + wcslen(value) + 1));
+ char *assignment = (char*) malloc(sizeof(char) * (TP_slen(name) + TP_slen(value) + 1));
sprintf(assignment, "%s=%s", HackyConvertToSTR(name), HackyConvertToSTR(value));
if (0 != putenv(assignment))
@@ -322,8 +322,8 @@ DWORD TP_GetFullPathName(LPWSTR fileName, DWORD nBufferLength, LPWSTR lpBuffer)
char nativeFullPath[MAX_PATH];
(void)realpath(HackyConvertToSTR(fileName), nativeFullPath);
LPWSTR fullPathForCLR = HackyConvertToWSTR(nativeFullPath);
- wcscpy_s(lpBuffer, MAX_PATH, fullPathForCLR);
- return wcslen(lpBuffer);
+ TP_scpy_s(lpBuffer, MAX_PATH, fullPathForCLR);
+ return TP_slen(lpBuffer);
#endif
}
DWORD TP_CreateThread(THREAD_ID* tThread, LPTHREAD_START_ROUTINE worker, LPVOID lpParameter)
@@ -445,7 +445,7 @@ BSTR TP_SysAllocString(LPCWSTR psz)
#else
if(psz == NULL)
return NULL;
- return CoreClrBStrAlloc(psz, (DWORD)wcslen(psz));
+ return CoreClrBStrAlloc(psz, (DWORD)TP_slen(psz));
#endif
}
@@ -582,11 +582,6 @@ int TP_wcsncpy_s(LPWSTR strDestination, size_t size1, LPCWSTR strSource, size_t
return 0;
}
-int TP_wcsncpy_s(LPWSTR strDestination, size_t size1, LPCWSTR strSource)
-{
- return wcsncpy_s(strDestination, size1, strSource, 0);
-}
-
int TP_wcsncmp(LPCWSTR str1, LPCWSTR str2,size_t len)
{
// < 0 str1 less than str2
@@ -611,5 +606,5 @@ int TP_wcsncmp(LPCWSTR str1, LPCWSTR str2,size_t len)
int TP_wmemcmp(LPCWSTR str1, LPCWSTR str2,size_t len)
{
- return wcsncmp(str1, str2, len);
+ return TP_wcsncmp(str1, str2, len);
}
diff --git a/tests/src/Common/Platform/platformdefines.h b/tests/src/Common/Platform/platformdefines.h
index 0471ecd062..fe37ec1178 100644
--- a/tests/src/Common/Platform/platformdefines.h
+++ b/tests/src/Common/Platform/platformdefines.h
@@ -168,7 +168,6 @@ DWORD TP_GetFullPathName(LPWSTR fileName, DWORD nBufferLength, LPWSTR lpBuffer);
size_t TP_strncpy_s(char* strDest, size_t numberOfElements, const char *strSource, size_t count);
size_t TP_strcpy_s(char *dest, size_t n, char const *src);
int TP_wcsncpy_s(LPWSTR strDestination, size_t size1, LPCWSTR strSource, size_t size2);
-int TP_wcsncpy_s(LPWSTR strDestination, size_t size1, LPCWSTR strSource);
int TP_wcsncmp(LPCWSTR str1, LPCWSTR str2,size_t len);
int TP_wmemcmp(LPCWSTR str1, LPCWSTR str2,size_t len);
@@ -244,24 +243,13 @@ inline void CoreClrFree(void *p)
#define TP_GetProcAddress(m,e) dlsym(m,e)
#define TP_rand arc4random
#define TP_srand srandom
-#define wcscpy_s TP_scpy_s
-#define wcscat_s TP_scat_s
#define GetFullPathNameW(fname,buflen,buf,filepart) TP_GetFullPathName(fname,buflen,buf)
-#define wcslen TP_slen
-#define _wgetenv_s TP_getenv_s
-#define _wputenv_s TP_putenv_s
#define ZeroMemory TP_ZeroMemory
#define _itow_s TP_itow_s
#define _itoa_s TP_itoa_s
-#define wcsstr TP_sstr
#define strcmp TP_scmp_s
-#define wcscmp TP_wcmp_s
#define strncpy_s TP_strncpy_s
#define strcpy_s TP_strcpy_s
-#define wcsncpy_s TP_wcsncpy_s
-#define wcsncpy_s TP_wcsncpy_s
-#define wcsncmp TP_wcsncmp
-#define wmemcmp TP_wmemcmp
#endif
#endif
diff --git a/tests/src/Interop/ArrayMarshalling/SafeArray/RecordNative.cpp b/tests/src/Interop/ArrayMarshalling/SafeArray/RecordNative.cpp
index 2f379655c6..88caacd244 100644
--- a/tests/src/Interop/ArrayMarshalling/SafeArray/RecordNative.cpp
+++ b/tests/src/Interop/ArrayMarshalling/SafeArray/RecordNative.cpp
@@ -24,7 +24,7 @@ public:
BlittableRecord* pData = (BlittableRecord*)pvData;
- if (wcscmp(szFieldName, W("a")) == 0)
+ if (TP_wcmp_s(szFieldName, W("a")) == 0)
{
VariantClear(pvarField);
V_VT(pvarField) = VT_I4;
@@ -207,7 +207,7 @@ public:
NonBlittableRecord* pData = (NonBlittableRecord*)pvData;
- if (wcscmp(szFieldName, W("b")) == 0)
+ if (TP_wcmp_s(szFieldName, W("b")) == 0)
{
VariantClear(pvarField);
V_VT(pvarField) = VT_BOOL;
diff --git a/tests/src/Interop/COM/NativeServer/DispatchTesting.h b/tests/src/Interop/COM/NativeServer/DispatchTesting.h
index 8ee32a1dae..af9cd6c957 100644
--- a/tests/src/Interop/COM/NativeServer/DispatchTesting.h
+++ b/tests/src/Interop/COM/NativeServer/DispatchTesting.h
@@ -55,7 +55,7 @@ public: // IDispatch
for (int j = 1; j < NamesCount; ++j)
{
const WCHAR *nameMaybe = Names[j];
- if (::wcscmp(name, nameMaybe) == 0)
+ if (::TP_wcmp_s(name, nameMaybe) == 0)
{
*curr = DISPID{ j };
break;
diff --git a/tests/src/Interop/COM/NativeServer/Servers.cpp b/tests/src/Interop/COM/NativeServer/Servers.cpp
index c915dcd5ac..80da1b7bb0 100644
--- a/tests/src/Interop/COM/NativeServer/Servers.cpp
+++ b/tests/src/Interop/COM/NativeServer/Servers.cpp
@@ -134,7 +134,7 @@ namespace
0,
REG_SZ,
reinterpret_cast<const BYTE*>(fullPath),
- static_cast<DWORD>(::wcslen(fullPath) + 1) * sizeof(fullPath[0]));
+ static_cast<DWORD>(::TP_slen(fullPath) + 1) * sizeof(fullPath[0]));
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
@@ -147,7 +147,7 @@ namespace
0,
REG_SZ,
reinterpret_cast<const BYTE*>(threadingModel),
- static_cast<DWORD>(::wcslen(threadingModel) + 1) * sizeof(threadingModel[0]));
+ static_cast<DWORD>(::TP_slen(threadingModel) + 1) * sizeof(threadingModel[0]));
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
}
diff --git a/tests/src/Interop/COM/NativeServer/StringTesting.h b/tests/src/Interop/COM/NativeServer/StringTesting.h
index bf209171d0..06f13db2a4 100644
--- a/tests/src/Interop/COM/NativeServer/StringTesting.h
+++ b/tests/src/Interop/COM/NativeServer/StringTesting.h
@@ -86,12 +86,12 @@ public: // IStringTesting
if (a == nullptr || b == nullptr)
return E_POINTER;
- size_t aLen = ::wcslen(a);
- size_t bLen = ::wcslen(b);
+ size_t aLen = ::TP_slen(a);
+ size_t bLen = ::TP_slen(b);
auto buf = (LPWSTR)::CoTaskMemAlloc((aLen + bLen + 1) * sizeof(*b));
- ::wcscpy_s(buf, aLen + 1, a);
- ::wcscpy_s(buf + aLen, bLen + 1, b);
+ ::TP_scpy_s(buf, aLen + 1, a);
+ ::TP_scpy_s(buf + aLen, bLen + 1, b);
*pRetVal = buf;
return S_OK;
@@ -108,8 +108,8 @@ public: // IStringTesting
UINT bLen = ::SysStringLen(b);
BSTR buf = ::SysAllocStringByteLen(nullptr, (aLen + bLen) * sizeof(a[0]));
- ::wcscpy_s(buf, aLen + 1, a);
- ::wcscpy_s(buf + aLen, bLen + 1, b);
+ ::TP_scpy_s(buf, aLen + 1, a);
+ ::TP_scpy_s(buf + aLen, bLen + 1, b);
*pRetVal = buf;
return S_OK;
@@ -206,7 +206,7 @@ public: // IStringTesting
{
HRESULT hr;
RETURN_IF_FAILED(Reverse(*a, pRetVal));
- ReverseInplace(::wcslen(*a), *a);
+ ReverseInplace(::TP_slen(*a), *a);
return S_OK;
}
DEF_FUNC(Reverse_LPWStr_InRef)(
@@ -237,7 +237,7 @@ public: // IStringTesting
{
HRESULT hr;
RETURN_IF_FAILED(Reverse(a, pRetVal));
- ReverseInplace(::wcslen(a), a);
+ ReverseInplace(::TP_slen(a), a);
return S_OK;
}
DEF_FUNC(Reverse_SB_LPWStr_Ref)(
@@ -246,7 +246,7 @@ public: // IStringTesting
{
HRESULT hr;
RETURN_IF_FAILED(Reverse(*a, pRetVal));
- ReverseInplace(::wcslen(*a), *a);
+ ReverseInplace(::TP_slen(*a), *a);
return S_OK;
}
DEF_FUNC(Reverse_SB_LPWStr_InRef)(
@@ -255,7 +255,7 @@ public: // IStringTesting
{
HRESULT hr;
RETURN_IF_FAILED(Reverse(*a, pRetVal));
- ReverseInplace(::wcslen(*a), *a);
+ ReverseInplace(::TP_slen(*a), *a);
return S_OK;
}
DEF_FUNC(Reverse_SB_LPWStr_Out)(
@@ -264,14 +264,14 @@ public: // IStringTesting
{
HRESULT hr;
RETURN_IF_FAILED(Reverse(a, b));
- ReverseInplace(::wcslen(a), a);
+ ReverseInplace(::TP_slen(a), a);
return S_OK;
}
DEF_FUNC(Reverse_SB_LPWStr_OutAttr)(
/*[in,out]*/ LPWSTR a,
/*[out]*/ LPWSTR b)
{
- size_t len = ::wcslen(a);
+ size_t len = ::TP_slen(a);
ReverseInplace(len, a);
size_t byteLen = (len + 1) * sizeof(*a);
::memcpy_s(b, byteLen, a, byteLen);
diff --git a/tests/src/Interop/PInvoke/DateTime/NativeDateTime.cpp b/tests/src/Interop/PInvoke/DateTime/NativeDateTime.cpp
index 35a9ecc590..6c3b4c72e8 100644
--- a/tests/src/Interop/PInvoke/DateTime/NativeDateTime.cpp
+++ b/tests/src/Interop/PInvoke/DateTime/NativeDateTime.cpp
@@ -37,7 +37,7 @@ extern "C" BOOL VerifySeqStruct(struct Stru_Seq_DateAsStructAsFld* StDate)
{
BSTR str;
VarBstrFromDate(StDate->dt, LCID_ENGLISH, VAR_FOURDIGITYEARS, &str);
- if(wcscmp(L"7/4/2008", (wchar_t *)str) != 0 )
+ if(TP_wcmp_s(L"7/4/2008", (wchar_t *)str) != 0 )
{
wprintf(L"FAILURE! InDATE expected '07/04/2008' but received: %s\n", str);
return FALSE;
@@ -47,7 +47,7 @@ extern "C" BOOL VerifySeqStruct(struct Stru_Seq_DateAsStructAsFld* StDate)
wprintf(L"FAILURE! iInt expected 100 but received: %d\n", StDate->iInt);
return FALSE;
}
- if(wcscmp(L"Managed", (wchar_t *)(StDate->bstr)) != 0 )
+ if(TP_wcmp_s(L"Managed", (wchar_t *)(StDate->bstr)) != 0 )
{
wprintf(L"FAILURE! bstr expected 'Managed' but received: %s\n", StDate->bstr);
return FALSE;
@@ -59,7 +59,7 @@ extern "C" BOOL VerifyExpStruct(struct Stru_Exp_DateAsStructAsFld* StDate)
{
BSTR str;
VarBstrFromDate(StDate->dt, LCID_ENGLISH, VAR_FOURDIGITYEARS, &str);
- if(wcscmp(L"7/4/2008", (wchar_t *)str) != 0 )
+ if(TP_wcmp_s(L"7/4/2008", (wchar_t *)str) != 0 )
{
wprintf(L"FAILURE! InDATE expected '07/04/2008' but received: %s\n", str);
return FALSE;
@@ -92,7 +92,7 @@ extern "C" DLL_EXPORT BOOL __stdcall Marshal_In_stdcall(DATE d)
VarBstrFromDate(d, LCID_ENGLISH, VAR_FOURDIGITYEARS, &str);
- if(wcscmp(L"7/4/2008", (wchar_t *)str) != 0 )
+ if(TP_wcmp_s(L"7/4/2008", (wchar_t *)str) != 0 )
{
wprintf(L"FAILURE! InDATE expected '07/04/2008' but received: %s\n", str);
return FALSE;
@@ -113,7 +113,7 @@ extern "C" DLL_EXPORT BOOL __cdecl Marshal_InOut_cdecl(/*[in,out]*/ DATE* d)
VarBstrFromDate(*d, LCID_ENGLISH, VAR_FOURDIGITYEARS, &str);
- if(wcscmp(L"7/4/2008", (wchar_t *)str) != 0 )
+ if(TP_wcmp_s(L"7/4/2008", (wchar_t *)str) != 0 )
{
wprintf(L"FAILURE! InDATE expected '07/04/2008' but received: %s\n", str);
return FALSE;
@@ -169,7 +169,7 @@ extern "C" DLL_EXPORT BOOL __cdecl RevP_Marshal_InOut_cdecl(Datetime_Del_Marshal
//Verify the changes are visible
VarBstrFromDate(ptoD, LCID_ENGLISH, VAR_FOURDIGITYEARS, &str);
- if(wcscmp(L"8/14/1947", (wchar_t *)str) != 0 )
+ if(TP_wcmp_s(L"8/14/1947", (wchar_t *)str) != 0 )
{
wprintf(L"FAILURE! RevP_Marshal_InOut_cdecl : InDATE expected '8/14/1947' but received: %s\n", str);
return FALSE;
@@ -186,7 +186,7 @@ extern "C" DLL_EXPORT BOOL __stdcall RevP_Marshal_Ret_stdcall(Datetime_Del_Marsh
date = d();
VarBstrFromDate(date, LCID_ENGLISH, VAR_FOURDIGITYEARS, &str);
- if(wcscmp(L"7/4/2008", (wchar_t *)str) != 0 )
+ if(TP_wcmp_s(L"7/4/2008", (wchar_t *)str) != 0 )
{
wprintf(L"FAILURE! RevP_Marshal_Ret_stdcall : InDATE expected '07/04/2008' but received: %s\n", str);
return FALSE;
diff --git a/tests/src/Interop/PInvoke/DllImportPath/DllImportPathNative.cpp b/tests/src/Interop/PInvoke/DllImportPath/DllImportPathNative.cpp
index 113a08254e..911adf4013 100644
--- a/tests/src/Interop/PInvoke/DllImportPath/DllImportPathNative.cpp
+++ b/tests/src/Interop/PInvoke/DllImportPath/DllImportPathNative.cpp
@@ -15,8 +15,8 @@ size_t lenstrNative = 7; //the len of strNative
extern "C" DLL_EXPORT bool STDMETHODCALLTYPE MarshalStringPointer_InOut(/*[in,out]*/LPWSTR *s)
{
//Check the Input
- size_t len = wcslen(*s);
- if((len != lenstrManaged)||(wcsncmp(*s,strManaged, lenstrManaged)!=0))
+ size_t len = TP_slen(*s);
+ if((len != lenstrManaged)||(TP_wcsncmp(*s,strManaged, lenstrManaged)!=0))
{
printf("Error in Function MarshalStringPointer_InOut\n");
@@ -40,7 +40,7 @@ extern "C" DLL_EXPORT bool STDMETHODCALLTYPE MarshalStringPointer_InOut(/*[in,ou
size_t length = lenstrNative + 1;
*s = (LPWSTR)CoreClrAlloc(length * sizeof(WCHAR));
memset(*s,'\0',length * sizeof(WCHAR));
- wcsncpy_s(*s,length,strNative,lenstrNative);
+ TP_wcsncpy_s(*s,length,strNative,lenstrNative);
//Return
return true;
diff --git a/tests/src/Interop/PInvoke/IEnumerator/IEnumeratorNative.h b/tests/src/Interop/PInvoke/IEnumerator/IEnumeratorNative.h
index c51290183e..47456bf988 100644
--- a/tests/src/Interop/PInvoke/IEnumerator/IEnumeratorNative.h
+++ b/tests/src/Interop/PInvoke/IEnumerator/IEnumeratorNative.h
@@ -110,7 +110,7 @@ public:
{
*curr = DISPID_UNKNOWN;
LPOLESTR name = rgszNames[i];
- if(wcscmp(name, W("GetEnumerator")) == 0)
+ if(TP_wcmp_s(name, W("GetEnumerator")) == 0)
{
*curr = DISPID_NEWENUM;
}
diff --git a/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTestNative.cpp b/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTestNative.cpp
index 399db99702..132927d041 100644
--- a/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTestNative.cpp
+++ b/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTestNative.cpp
@@ -131,10 +131,10 @@ extern "C" DLL_EXPORT BOOL __cdecl RPinvoke_DelMarshal_InOut(Test_DelMarshal_InO
LPCWSTR str = d(s);
LPCWSTR ret = W("Return");
- size_t lenstr = wcslen(str);
- size_t lenret = wcslen(ret);
+ size_t lenstr = TP_slen(str);
+ size_t lenret = TP_slen(ret);
- if((lenret != lenstr)||(wcsncmp(str,ret,lenstr)!=0))
+ if((lenret != lenstr)||(TP_wcsncmp(str,ret,lenstr)!=0))
{
printf("Error in RPinvoke_DelMarshal_InOut, Returned value didn't match\n");
return FALSE;
diff --git a/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp b/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp
index 73960006c1..72df3d5bb3 100644
--- a/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp
+++ b/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp
@@ -17,19 +17,19 @@ size_t lenstrNative = 7; //the len of strNative
extern "C" LPWSTR ReturnString()
{
- size_t length = wcslen(strReturn)+1;
+ size_t length = TP_slen(strReturn)+1;
LPWSTR ret = (LPWSTR)CoreClrAlloc(sizeof(WCHAR)*length);
memset(ret,'\0', sizeof(WCHAR)*length);
- wcsncpy_s(ret,length,strReturn,length-1);
+ TP_wcsncpy_s(ret,length,strReturn,length-1);
return ret;
}
extern "C" LPWSTR ReturnErrString()
{
- size_t length = wcslen(strErrReturn)+1;
+ size_t length = TP_slen(strErrReturn)+1;
LPWSTR ret = (LPWSTR)CoreClrAlloc(sizeof(WCHAR)*length);
memset(ret,'\0', sizeof(WCHAR)*length);
- wcsncpy_s(ret,length,strErrReturn,length-1);
+ TP_wcsncpy_s(ret,length,strErrReturn,length-1);
return ret;
}
@@ -40,16 +40,16 @@ extern "C" DLL_EXPORT LPWSTR Marshal_InOut(/*[In,Out]*/LPWSTR s)
{
//Check the Input
- size_t len = wcslen(s);
+ size_t len = TP_slen(s);
- if((len != lenstrManaged)||(wmemcmp(s,(WCHAR*)strManaged,len)!=0))
+ if((len != lenstrManaged)||(TP_wmemcmp(s,(WCHAR*)strManaged,len)!=0))
{
printf("Error in Function Marshal_InOut(Native Client)\n");
return ReturnErrString();
}
//In-Place Change
- wcsncpy_s(s,len+1,strNative,lenstrNative);
+ TP_wcsncpy_s(s,len+1,strNative,lenstrNative);
//Return
return ReturnString();
@@ -61,7 +61,7 @@ extern "C" DLL_EXPORT LPWSTR Marshal_Out(/*[Out]*/LPWSTR s)
memset(s,0, sizeof(WCHAR)*(lenstrNative + 1));
//In-Place Change
- wcsncpy_s(s,lenstrNative+1,strNative,lenstrNative);
+ TP_wcsncpy_s(s,lenstrNative+1,strNative,lenstrNative);
//Return
return ReturnString();
@@ -71,8 +71,8 @@ extern "C" DLL_EXPORT LPWSTR Marshal_Out(/*[Out]*/LPWSTR s)
extern "C" DLL_EXPORT LPWSTR MarshalPointer_InOut(/*[in,out]*/LPWSTR *s)
{
//Check the Input
- size_t len = wcslen(*s);
- if((len != lenstrManaged)||(wmemcmp(*s,(WCHAR*)strManaged,len)!=0))
+ size_t len = TP_slen(*s);
+ if((len != lenstrManaged)||(TP_wmemcmp(*s,(WCHAR*)strManaged,len)!=0))
{
printf("Error in Function MarshalPointer_InOut\n");
return ReturnErrString();
@@ -85,7 +85,7 @@ extern "C" DLL_EXPORT LPWSTR MarshalPointer_InOut(/*[in,out]*/LPWSTR *s)
size_t length = lenstrNative + 1;
*s = (LPWSTR)CoreClrAlloc(length * sizeof(WCHAR));
memset(*s,'\0',length * sizeof(WCHAR));
- wcsncpy_s(*s,length,strNative,lenstrNative);
+ TP_wcsncpy_s(*s,length,strNative,lenstrNative);
//Return
return ReturnString();
@@ -96,7 +96,7 @@ extern "C" DLL_EXPORT LPWSTR MarshalPointer_Out(/*[out]*/ LPWSTR *s)
size_t length = lenstrNative+1;
*s = (LPWSTR)CoreClrAlloc(sizeof(WCHAR)*length);
memset(*s, '\0', length * sizeof(WCHAR));
- wcsncpy_s(*s,length,strNative,lenstrNative);
+ TP_wcsncpy_s(*s,length,strNative,lenstrNative);
return ReturnString();
}
@@ -108,17 +108,17 @@ extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE ReverseP_MarshalStrB_InOut(Test_Del
LPWSTR expectedret =(LPWSTR)W("Native");
LPWSTR expectedstr = (LPWSTR)W("m");
- size_t lenret = wcslen(ret);
- size_t lenexpectedret = wcslen(expectedret);
- if((lenret != lenexpectedret)||(wcsncmp(ret,expectedret,lenret)!=0))
+ size_t lenret = TP_slen(ret);
+ size_t lenexpectedret = TP_slen(expectedret);
+ if((lenret != lenexpectedret)||(TP_wcsncmp(ret,expectedret,lenret)!=0))
{
printf("Error in ReverseP_MarshalStrB_InOut, Returned value didn't match\n");
return FALSE;
}
- size_t lenstr = wcslen(s);
- size_t lenexpectedstr = wcslen(expectedstr);
- if((lenstr != lenexpectedstr)||(wcsncmp(s,expectedstr,lenstr)!=0))
+ size_t lenstr = TP_slen(s);
+ size_t lenexpectedstr = TP_slen(expectedstr);
+ if((lenstr != lenexpectedstr)||(TP_wcsncmp(s,expectedstr,lenstr)!=0))
{
printf("Error in ReverseP_MarshalStrB_InOut, Changed value didn't reflect on native side.\n");
return FALSE;
@@ -135,17 +135,17 @@ extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE ReverseP_MarshalStrB_Out(Test_Del_M
LPWSTR expectedret = (LPWSTR)W("Native");
LPWSTR expectedstr = (LPWSTR)W("Managed");
- size_t lenret = wcslen(ret);
- size_t lenexpectedret = wcslen(expectedret);
- if((lenret != lenexpectedret)||(wcsncmp(ret,expectedret,lenret)!=0))
+ size_t lenret = TP_slen(ret);
+ size_t lenexpectedret = TP_slen(expectedret);
+ if((lenret != lenexpectedret)||(TP_wcsncmp(ret,expectedret,lenret)!=0))
{
printf("Error in ReverseP_MarshalStrB_Out, Returned value didn't match\n");
return FALSE;
}
- size_t lenstr = wcslen(s);
- size_t lenexpectedstr = wcslen(expectedstr);
- if((lenstr != lenexpectedstr)||(wcsncmp(s,expectedstr,lenstr)!=0))
+ size_t lenstr = TP_slen(s);
+ size_t lenexpectedstr = TP_slen(expectedstr);
+ if((lenstr != lenexpectedstr)||(TP_wcsncmp(s,expectedstr,lenstr)!=0))
{
printf("Error in ReverseP_MarshalStrB_Out, Changed value didn't reflect on native side.\n");
return FALSE;
diff --git a/tests/src/Interop/StringMarshalling/UTF8/UTF8TestNative.cpp b/tests/src/Interop/StringMarshalling/UTF8/UTF8TestNative.cpp
index 0192d76e39..e623d2d1d1 100644
--- a/tests/src/Interop/StringMarshalling/UTF8/UTF8TestNative.cpp
+++ b/tests/src/Interop/StringMarshalling/UTF8/UTF8TestNative.cpp
@@ -23,7 +23,7 @@ char* utf16_to_utf8(const wchar_t *srcstring)
if ((srcstring == NULL) || (*srcstring == L'\0')) {
return 0;
}
- size_t cchUTF16 = wcslen(srcstring) + 1;
+ size_t cchUTF16 = TP_slen(srcstring) + 1;
int cbUTF8 = WideCharToMultiByte(CP_UTF8, 0,
srcstring,
(int)cchUTF16,
diff --git a/tests/src/Interop/StringMarshalling/VBByRefStr/VBByRefStrNative.cpp b/tests/src/Interop/StringMarshalling/VBByRefStr/VBByRefStrNative.cpp
index a23fb91a3d..896996f401 100644
--- a/tests/src/Interop/StringMarshalling/VBByRefStr/VBByRefStrNative.cpp
+++ b/tests/src/Interop/StringMarshalling/VBByRefStr/VBByRefStrNative.cpp
@@ -16,9 +16,9 @@ extern "C" DLL_EXPORT BOOL Marshal_Ansi(LPCSTR expected, LPSTR actual, LPCSTR ne
extern "C" DLL_EXPORT BOOL Marshal_Unicode(LPCWSTR expected, LPWSTR actual, LPCWSTR newValue)
{
- bool result = wcscmp(expected, actual) == 0;
+ bool result = TP_wcmp_s(expected, actual) == 0;
- wcscpy_s(actual, wcslen(actual), newValue);
+ TP_scpy_s(actual, TP_slen(actual), newValue);
return result;
}
diff --git a/tests/src/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h b/tests/src/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h
index 4cb49e192a..3d3bc81c0c 100644
--- a/tests/src/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h
+++ b/tests/src/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h
@@ -292,11 +292,11 @@ void ChangeCharSetUnicodeSequential(CharSetUnicodeSequential* p)
#else
LPCWSTR strSource = u"change string";
#endif
- size_t len = wcslen(strSource);
+ size_t len = TP_slen(strSource);
LPCWSTR temp = (LPCWSTR)CoreClrAlloc(sizeof(WCHAR)*(len+1));
if(temp != NULL)
{
- wcscpy_s((WCHAR*)temp, (len+1), strSource);
+ TP_scpy_s((WCHAR*)temp, (len+1), strSource);
p->f1 = temp;
p->f2 = L'n';
}
diff --git a/tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ExpStructAsParamNative.h b/tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ExpStructAsParamNative.h
index 36eb913d02..2f6ebc9d90 100644
--- a/tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ExpStructAsParamNative.h
+++ b/tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ExpStructAsParamNative.h
@@ -329,7 +329,7 @@ void ChangeCharSetUnicodeSequential(CharSetUnicodeSequential* p)
if(temp != NULL)
{
memset((LPWSTR)temp,0,len+1);
- wcsncpy_s((WCHAR*)temp, len, strSource, len);
+ TP_wcsncpy_s((WCHAR*)temp, len, strSource, len);
p->f1 = temp;
p->f2 = L'n';
}
diff --git a/tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/SeqStructDelRevPInvokeNative.cpp b/tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/SeqStructDelRevPInvokeNative.cpp
index 28779a74ae..dcd124a97b 100644
--- a/tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/SeqStructDelRevPInvokeNative.cpp
+++ b/tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/SeqStructDelRevPInvokeNative.cpp
@@ -1030,12 +1030,12 @@ extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalStructCharSetUnicodeSequenti
CharSetUnicodeSequential argstr;
WCHAR* strSource = (WCHAR*)(W("change string"));
- size_t len = wcslen(strSource);
+ size_t len = TP_slen(strSource);
LPCWSTR temp = (LPCWSTR)CoreClrAlloc(sizeof(WCHAR)*(len+1));
if(temp != NULL)
{
//wcscpy((WCHAR*)temp, (len+1)*sizeof(WCHAR), strSource);
- wcscpy_s((WCHAR*)temp,len+1,strSource);
+ TP_scpy_s((WCHAR*)temp,len+1,strSource);
argstr.f1 = temp;
argstr.f2 = 'n';
}
@@ -1065,12 +1065,12 @@ extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalStructCharSetUnicodeSeque
CharSetUnicodeSequential argstr;
WCHAR* strSource = (WCHAR*)(W("change string"));
- size_t len = wcslen(strSource);
+ size_t len = TP_slen(strSource);
LPCWSTR temp = (LPCWSTR)CoreClrAlloc(sizeof(WCHAR)*(len+1));
if(temp != NULL)
{
//wcscpy((WCHAR*)temp, (len+1)*sizeof(WCHAR), strSource);
- wcscpy_s((WCHAR*)temp,len+1,strSource);
+ TP_scpy_s((WCHAR*)temp,len+1,strSource);
argstr.f1 = temp;
argstr.f2 = 'n';
}
@@ -1118,12 +1118,12 @@ extern "C" DLL_EXPORT BOOL _cdecl MarshalStructCharSetUnicodeSequentialByVal_Cde
}
WCHAR* strSource = (WCHAR*)(W("change string"));
- size_t len = wcslen(strSource);
+ size_t len = TP_slen(strSource);
LPCWSTR temp = (LPCWSTR)CoreClrAlloc(sizeof(WCHAR)*(len+1));
if(temp != NULL)
{
//wcscpy((WCHAR*)temp, (len+1)*sizeof(WCHAR), strSource);
- wcscpy_s((WCHAR*)temp,len+1,strSource);
+ TP_scpy_s((WCHAR*)temp,len+1,strSource);
argstr.f1 = temp;
argstr.f2 = 'n';
}
@@ -1145,12 +1145,12 @@ extern "C" DLL_EXPORT BOOL __stdcall MarshalStructCharSetUnicodeSequentialByVal_
}
WCHAR* strSource = (WCHAR*)(W("change string"));
- size_t len = wcslen(strSource);
+ size_t len = TP_slen(strSource);
LPCWSTR temp = (LPCWSTR)CoreClrAlloc(sizeof(WCHAR)*(len+1));
if(temp != NULL)
{
//wcscpy((WCHAR*)temp, (len+1)*sizeof(WCHAR), strSource);
- wcscpy_s((WCHAR*)temp,len+1,strSource);
+ TP_scpy_s((WCHAR*)temp,len+1,strSource);
argstr.f1 = temp;
argstr.f2 = 'n';
}
@@ -1167,12 +1167,12 @@ extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalStructCharSetUnicodeSequenti
//Init
CharSetUnicodeSequential argstr{};
WCHAR* strSource = (WCHAR*)(W("change string"));
- size_t len =wcslen(strSource);
+ size_t len =TP_slen(strSource);
LPCWSTR temp = (LPCWSTR)CoreClrAlloc(sizeof(WCHAR)*(len+1));
if(temp != NULL)
{
//wcscpy((WCHAR*)temp, (len+1)*sizeof(WCHAR), strSource);
- wcscpy_s((WCHAR*)temp,len+1,strSource);
+ TP_scpy_s((WCHAR*)temp,len+1,strSource);
argstr.f1 = temp;
argstr.f2 = 'n';
}
@@ -1188,7 +1188,7 @@ extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalStructCharSetUnicodeSequenti
}
//Verify the value unchanged
- if(0 != wcscmp(const_cast<WCHAR*>(argstr.f1), const_cast<WCHAR*>(W("change string"))) || argstr.f2 != L'n')
+ if(0 != TP_wcmp_s(const_cast<WCHAR*>(argstr.f1), const_cast<WCHAR*>(W("change string"))) || argstr.f2 != L'n')
{
printf("The parameter for DoCallBack_MarshalStructCharSetUnicodeSequentialByVal_Cdecl is wrong\n");
return FALSE;
@@ -1202,12 +1202,12 @@ extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalStructCharSetUnicodeSeque
//Init
CharSetUnicodeSequential argstr{};
WCHAR* strSource = (WCHAR*)(W("change string"));
- size_t len =wcslen(strSource);
+ size_t len =TP_slen(strSource);
LPCWSTR temp = (LPCWSTR)CoreClrAlloc(sizeof(WCHAR)*(len+1));
if(temp != NULL)
{
//wcscpy((WCHAR*)temp, (len+1)*sizeof(WCHAR), strSource);
- wcscpy_s((WCHAR*)temp,len+1,strSource);
+ TP_scpy_s((WCHAR*)temp,len+1,strSource);
argstr.f1 = temp;
argstr.f2 = 'n';
}
@@ -1223,7 +1223,7 @@ extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalStructCharSetUnicodeSeque
}
//Verify the value unchanged
- if(0 != wcscmp(const_cast<WCHAR*>(argstr.f1), const_cast<WCHAR*>(W("change string"))) || argstr.f2 != L'n')
+ if(0 != TP_wcmp_s(const_cast<WCHAR*>(argstr.f1), const_cast<WCHAR*>(W("change string"))) || argstr.f2 != L'n')
{
printf("The parameter for DoCallBack_MarshalStructCharSetUnicodeSequentialByVal_StdCall is wrong\n");
return FALSE;
diff --git a/tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/SeqStructDelRevPInvokeNative.h b/tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/SeqStructDelRevPInvokeNative.h
index 6022d5aeab..43fdb7febb 100644
--- a/tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/SeqStructDelRevPInvokeNative.h
+++ b/tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/SeqStructDelRevPInvokeNative.h
@@ -313,11 +313,11 @@ void PrintCharSetUnicodeSequential(CharSetUnicodeSequential* p, const char* name
void ChangeCharSetUnicodeSequential(CharSetUnicodeSequential* p)
{
LPCWSTR strSource = W("change string");
- size_t len = wcslen(strSource);
+ size_t len = TP_slen(strSource);
LPCWSTR temp = (LPCWSTR)CoreClrAlloc(sizeof(WCHAR)*(len+1));
if(temp != NULL)
{
- wcscpy_s((WCHAR*)temp, (len+1), strSource);
+ TP_scpy_s((WCHAR*)temp, (len+1), strSource);
p->f1 = temp;
p->f2 = L'n';
}
@@ -331,7 +331,7 @@ bool IsCorrectCharSetUnicodeSequential(CharSetUnicodeSequential* p)
{
LPCWSTR expected= W("some string");
LPCWSTR actual = p->f1;
- if(0 != wcscmp(actual, expected))
+ if(0 != TP_wcmp_s(actual, expected))
{
return false;
}