diff options
author | Jan Kotas <jkotas@microsoft.com> | 2015-12-25 18:16:02 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2015-12-28 18:26:48 +0300 |
commit | 69985cebe4246f1667d96aae778d892298c20376 (patch) | |
tree | 0c9f14fd0215c1754f368797dfe362153bb11a83 /src/Common | |
parent | bf8670422b294df760e54639c68a40b738ab4eda (diff) |
Cleanup and centralize workarounds
Diffstat (limited to 'src/Common')
-rw-r--r-- | src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.Environment.cs | 2 | ||||
-rw-r--r-- | src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.StringHelper.cs | 26 |
2 files changed, 1 insertions, 27 deletions
diff --git a/src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.Environment.cs b/src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.Environment.cs index b429c01c1..b47b4a236 100644 --- a/src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.Environment.cs +++ b/src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.Environment.cs @@ -10,6 +10,6 @@ internal static partial class Interop internal unsafe partial class Sys { [DllImport(Interop.Libraries.SystemPrivateCoreLibNative)] - internal static unsafe extern int GetEnvironmentVariable(byte* name, out IntPtr result); + internal static unsafe extern int GetEnvironmentVariable(string name, out IntPtr result); } } diff --git a/src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.StringHelper.cs b/src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.StringHelper.cs deleted file mode 100644 index a4109e78f..000000000 --- a/src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.StringHelper.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; -using System.Text; - -internal static partial class Interop -{ - internal unsafe partial class StringHelper - { - public static unsafe byte[] GetBytesFromUTF8string(string value) - { - int bytecount = Encoding.UTF8.GetByteCount(value); - - // GetByteCount does not account for the trailing zero that is needed - // Add one to allocate the trailing zero for the string. - // Note: The runtime will zero-initialize the buffer - byte[] result = new byte[bytecount + 1]; - fixed (char* pValue = value) - fixed (byte* pResult = result) - Encoding.UTF8.GetBytes(pValue, value.Length, pResult, bytecount); - - return result; - } - } -} |