diff options
author | tijoytk <tijoytk@microsoft.com> | 2016-05-09 16:23:52 -0700 |
---|---|---|
committer | tijoytk <tijoytk@microsoft.com> | 2016-05-09 16:23:52 -0700 |
commit | 515a28b8ab33675011af9923bb5b6dfedf5e3935 (patch) | |
tree | c0bc4a63f1758979d881d344f58419380536dbcb /tests/src/Interop | |
parent | e63ae93ca3fc777ff25930491332e07cf79a9ce3 (diff) | |
download | coreclr-515a28b8ab33675011af9923bb5b6dfedf5e3935.tar.gz coreclr-515a28b8ab33675011af9923bb5b6dfedf5e3935.tar.bz2 coreclr-515a28b8ab33675011af9923bb5b6dfedf5e3935.zip |
Taking care of review comments.
Let out some of the review comments
since they are optimizations.
Diffstat (limited to 'tests/src/Interop')
-rw-r--r-- | tests/src/Interop/StringMarshalling/UTF8/UTF8Test.cs | bin | 17888 -> 9308 bytes | |||
-rw-r--r-- | tests/src/Interop/StringMarshalling/UTF8/UTF8TestNative.cpp | 17 |
2 files changed, 6 insertions, 11 deletions
diff --git a/tests/src/Interop/StringMarshalling/UTF8/UTF8Test.cs b/tests/src/Interop/StringMarshalling/UTF8/UTF8Test.cs Binary files differindex a8f58b3efa..7bfe19fdac 100644 --- a/tests/src/Interop/StringMarshalling/UTF8/UTF8Test.cs +++ b/tests/src/Interop/StringMarshalling/UTF8/UTF8Test.cs diff --git a/tests/src/Interop/StringMarshalling/UTF8/UTF8TestNative.cpp b/tests/src/Interop/StringMarshalling/UTF8/UTF8TestNative.cpp index 9759c1aca7..77e4b9c8cb 100644 --- a/tests/src/Interop/StringMarshalling/UTF8/UTF8TestNative.cpp +++ b/tests/src/Interop/StringMarshalling/UTF8/UTF8TestNative.cpp @@ -99,7 +99,7 @@ LPSTR build_return_string(const char* pReturn) // end up with different byte sequence. const int NSTRINGS = 6; -#ifdef _WIN32 +#ifdef _WIN32 wchar_t *utf8Strings[] = { L"Managed", L"S\x00EEne kl\x00E2wen durh die wolken sint geslagen" , L"\x0915\x093E\x091A\x0902 \x0936\x0915\x094D\x0928\x094B\x092E\x094D\x092F\x0924\x094D\x0924\x0941\x092E\x094D \x0964 \x0928\x094B\x092A\x0939\x093F\x0928\x0938\x094D\x0924\x093F \x092E\x093E\x092E\x094D", @@ -157,7 +157,7 @@ extern "C" DLL_EXPORT void __cdecl StringBuilderParameterInOut(/*[In,Out] String } //out string builder -extern "C" DLL_EXPORT void __cdecl StringBuilderParameterOut(/*[In,Out] StringBuilder*/ char *s, int index) +extern "C" DLL_EXPORT void __cdecl StringBuilderParameterOut(/*[Out] StringBuilder*/ char *s, int index) { #ifdef _WIN32 @@ -284,6 +284,10 @@ extern "C" DLL_EXPORT void __cdecl StringParameterRef(/*ref*/ char **s, int inde } } + if (*s) + { + CoTaskMemFree(*s); + } // overwrite the orginal *s = (LPSTR)(CoTaskMemAlloc(sizeof(char)* (strLength + 1))); memcpy(*s, pszTextutf8, strLength); @@ -293,15 +297,6 @@ extern "C" DLL_EXPORT void __cdecl StringParameterRef(/*ref*/ char **s, int inde #endif } -extern "C" DLL_EXPORT void __cdecl StringParameterLPStr(/*out*/ char **s) -{ - const char *managed = "ManagedString"; - size_t strLength = strlen(managed); - *s = (LPSTR)(CoTaskMemAlloc(sizeof(char)* (strLength + 1))); - memcpy(*s, managed, strLength); - (*s)[strLength] = '\0'; -} - // delegate test typedef void (__cdecl * Callback)(char *text, int index); extern "C" DLL_EXPORT void _cdecl Utf8DelegateAsParameter(Callback managedCallback) |