You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
committed by
Jo Shields
parent
aa7da660d6
commit
c042cd0c52
@@ -51,7 +51,9 @@ namespace System.Resources {
|
||||
// Don't use Assembly manifest, but grovel on disk for a file.
|
||||
try
|
||||
{
|
||||
#if !DISABLE_CAS_USE
|
||||
new System.Security.Permissions.FileIOPermission(System.Security.Permissions.PermissionState.Unrestricted).Assert();
|
||||
#endif
|
||||
|
||||
// Create new ResourceSet, if a file exists on disk for it.
|
||||
String tempFileName = _mediator.GetResourceFileName(culture);
|
||||
@@ -77,7 +79,9 @@ namespace System.Resources {
|
||||
}
|
||||
finally
|
||||
{
|
||||
#if !DISABLE_CAS_USE
|
||||
System.Security.CodeAccessPermission.RevertAssert();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -468,7 +468,19 @@ namespace System.Resources {
|
||||
}
|
||||
else {
|
||||
#endif //IA64
|
||||
s = new String(charPtr, 0, byteLen/2);
|
||||
if (!BitConverter.IsLittleEndian) {
|
||||
byte* bytePtr = (byte*) charPtr;
|
||||
var dest = new byte[byteLen];
|
||||
for (int i = 0; i < byteLen; i += 2) {
|
||||
dest[i] = *(bytePtr+i+1);
|
||||
dest[i+1] = *(bytePtr+i);
|
||||
}
|
||||
|
||||
fixed(byte *pDest = dest) {
|
||||
s = new String((char *)pDest, 0, byteLen/2);
|
||||
}
|
||||
} else
|
||||
s = new String(charPtr, 0, byteLen/2);
|
||||
#if IA64
|
||||
}
|
||||
#endif //IA64
|
||||
|
||||
@@ -350,12 +350,15 @@ namespace System.Resources {
|
||||
// write to the temp directory (enforced via a Windows ACL). Fall back to a MemoryStream.
|
||||
Stream dataSection = null; // Either a FileStream or a MemoryStream
|
||||
String tempFile = null;
|
||||
|
||||
#if !DISABLE_CAS_USE
|
||||
PermissionSet permSet = new PermissionSet(PermissionState.None);
|
||||
permSet.AddPermission(new EnvironmentPermission(PermissionState.Unrestricted));
|
||||
permSet.AddPermission(new FileIOPermission(PermissionState.Unrestricted));
|
||||
#endif
|
||||
try {
|
||||
#if !DISABLE_CAS_USE
|
||||
permSet.Assert();
|
||||
#endif
|
||||
tempFile = Path.GetTempFileName();
|
||||
File.SetAttributes(tempFile, FileAttributes.Temporary | FileAttributes.NotContentIndexed);
|
||||
// Explicitly opening with FileOptions.DeleteOnClose to avoid complicated File.Delete
|
||||
@@ -372,7 +375,9 @@ namespace System.Resources {
|
||||
dataSection = new MemoryStream();
|
||||
}
|
||||
finally {
|
||||
#if !DISABLE_CAS_USE
|
||||
PermissionSet.RevertAssert();
|
||||
#endif
|
||||
}
|
||||
|
||||
using(dataSection) {
|
||||
|
||||
Reference in New Issue
Block a user