diff options
author | Marek Safar <marek.safar@gmail.com> | 2018-06-07 20:07:47 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2018-06-12 09:49:48 +0300 |
commit | 9a3d31fdd87d8e2f6a657279e9bc595b32c15b91 (patch) | |
tree | 5fa6d5557b9acff7b338e76bbf73171ef2d2dcfc | |
parent | 78a03ecb6e44f2e2c1b4a9b9a35be8876db44c98 (diff) |
Guard Windows code under PLATFORM_WINDOWS (dotnet/coreclr#18344)
Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
-rw-r--r-- | src/Common/src/CoreLib/System/String.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Common/src/CoreLib/System/String.cs b/src/Common/src/CoreLib/System/String.cs index 9d230fe3dc..07d65ead43 100644 --- a/src/Common/src/CoreLib/System/String.cs +++ b/src/Common/src/CoreLib/System/String.cs @@ -215,9 +215,7 @@ namespace System if (numBytes == 0) return Empty; -#if PLATFORM_UNIX - return Encoding.UTF8.GetString(pb, numBytes); -#else +#if PLATFORM_WINDOWS int numCharsRequired = Interop.Kernel32.MultiByteToWideChar(Interop.Kernel32.CP_ACP, Interop.Kernel32.MB_PRECOMPOSED, pb, numBytes, (char*)null, 0); if (numCharsRequired == 0) throw new ArgumentException(SR.Arg_InvalidANSIString); @@ -230,6 +228,8 @@ namespace System if (numCharsRequired == 0) throw new ArgumentException(SR.Arg_InvalidANSIString); return newString; +#else + return Encoding.UTF8.GetString(pb, numBytes); #endif } |