You've already forked linux-packaging-mono
Imported Upstream version 5.16.0.100
Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
parent
0a9828183b
commit
7d7f676260
@ -5,12 +5,13 @@
|
||||
// Changes to this file must follow the http://aka.ms/api-review process.
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
public sealed partial class CodePagesEncodingProvider
|
||||
public sealed partial class CodePagesEncodingProvider : System.Text.EncodingProvider
|
||||
{
|
||||
internal CodePagesEncodingProvider() { }
|
||||
public static System.Text.EncodingProvider Instance { get { throw null; } }
|
||||
public override System.Text.Encoding GetEncoding(int codepage) { throw null; }
|
||||
public override System.Text.Encoding GetEncoding(string name) { throw null; }
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,7 @@
|
||||
<Reference Include="System.Runtime.Extensions" />
|
||||
<Reference Include="System.Runtime.InteropServices" />
|
||||
<Reference Include="System.Threading" />
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
<!-- Generator for code mapping table, target to invoke is GenerateEncodingSource -->
|
||||
|
@ -82,7 +82,7 @@ namespace System.Text
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
|
||||
// Just a helper as we cannot use 'this' when calling 'base(...)'
|
||||
// Just a helper as we cannot use 'this' when calling 'base(...)'
|
||||
private void SetFallbackEncoding()
|
||||
{
|
||||
(EncoderFallback as InternalEncoderBestFitFallback).encoding = this;
|
||||
@ -330,8 +330,8 @@ namespace System.Text
|
||||
return arrayBytesBestFit;
|
||||
}
|
||||
|
||||
// During the AppDomain shutdown the Encoding class may have already finalized, making the memory section
|
||||
// invalid. We detect that by validating the memory section handle then re-initializing the memory
|
||||
// During the AppDomain shutdown the Encoding class may have already finalized, making the memory section
|
||||
// invalid. We detect that by validating the memory section handle then re-initializing the memory
|
||||
// section by calling LoadManagedCodePage() method and eventually the mapped file handle and
|
||||
// the memory section pointer will get finalized one more time.
|
||||
internal unsafe void CheckMemorySection()
|
||||
|
@ -8,6 +8,7 @@ using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Security;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
@ -106,7 +107,9 @@ namespace System.Text
|
||||
|
||||
// Get our mapped section (bytes to allocate = 2 bytes per 65536 Unicode chars + 2 bytes per 65536 DBCS chars)
|
||||
// Plus 4 byte to remember CP # when done loading it. (Don't want to get IA64 or anything out of alignment)
|
||||
byte* pNativeMemory = GetNativeMemory(65536 * 2 * 2 + 4 + iExtraBytes);
|
||||
int sizeToAllocate = 65536 * 2 * 2 + 4 + iExtraBytes;
|
||||
byte* pNativeMemory = GetNativeMemory(sizeToAllocate);
|
||||
Unsafe.InitBlockUnaligned(pNativeMemory, 0, (uint)sizeToAllocate);
|
||||
|
||||
mapBytesToUnicode = (char*)pNativeMemory;
|
||||
mapUnicodeToBytes = (ushort*)(pNativeMemory + 65536 * 2);
|
||||
|
@ -9,6 +9,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Globalization;
|
||||
using System.Security;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
@ -33,28 +34,6 @@ namespace System.Text
|
||||
{
|
||||
}
|
||||
|
||||
// Method assumes that memory pointer is aligned
|
||||
private static unsafe void ZeroMemAligned(byte* buffer, int count)
|
||||
{
|
||||
long* pLong = (long*)buffer;
|
||||
long* pLongEnd = (long*)(buffer + count - sizeof(long));
|
||||
|
||||
while (pLong < pLongEnd)
|
||||
{
|
||||
*pLong = 0;
|
||||
pLong++;
|
||||
}
|
||||
|
||||
byte* pByte = (byte*)pLong;
|
||||
byte* pEnd = buffer + count;
|
||||
|
||||
while (pByte < pEnd)
|
||||
{
|
||||
*pByte = 0;
|
||||
pByte++;
|
||||
}
|
||||
}
|
||||
|
||||
// We have a managed code page entry, so load our tables
|
||||
// SBCS data section looks like:
|
||||
//
|
||||
@ -93,7 +72,7 @@ namespace System.Text
|
||||
const int CodePageNumberSize = 4;
|
||||
int bytesToAllocate = UnicodeToBytesMappingSize + BytesToUnicodeMappingSize + CodePageNumberSize + iExtraBytes;
|
||||
byte* pNativeMemory = GetNativeMemory(bytesToAllocate);
|
||||
ZeroMemAligned(pNativeMemory, bytesToAllocate);
|
||||
Unsafe.InitBlockUnaligned(pNativeMemory, 0, (uint)bytesToAllocate);
|
||||
|
||||
char* mapBytesToUnicode = (char*)pNativeMemory;
|
||||
byte* mapUnicodeToBytes = (byte*)(pNativeMemory + 256 * 2);
|
||||
@ -131,7 +110,7 @@ namespace System.Text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_mapBytesToUnicode = mapBytesToUnicode;
|
||||
_mapUnicodeToBytes = mapUnicodeToBytes;
|
||||
}
|
||||
|
Reference in New Issue
Block a user