Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2018-06-07 20:07:47 +0300
committerMarek Safar <marek.safar@gmail.com>2018-06-12 09:49:48 +0300
commit9a3d31fdd87d8e2f6a657279e9bc595b32c15b91 (patch)
tree5fa6d5557b9acff7b338e76bbf73171ef2d2dcfc
parent78a03ecb6e44f2e2c1b4a9b9a35be8876db44c98 (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.cs6
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
}