Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Port https://github.com/dotnet/corert/pull/629 to CoreCLR #2636

Merged
merged 1 commit into from
Jan 13, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/mscorlib/src/System/String.cs
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ public override int GetHashCode() {
#endif // FEATURE_RANDOMIZED_STRING_HASHING

unsafe {
fixed (char *src = this) {
fixed (char* src = &m_firstChar) {
Contract.Assert(src[this.Length] == '\0', "src[this.Length] == '\\0'");
Contract.Assert( ((int)src)%4 == 0, "Managed string should start at 4 bytes boundary");

Expand Down Expand Up @@ -856,7 +856,7 @@ public override int GetHashCode() {
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
internal int GetLegacyNonRandomizedHashCode() {
unsafe {
fixed (char *src = this) {
fixed (char* src = &m_firstChar) {
Contract.Assert(src[this.Length] == '\0', "src[this.Length] == '\\0'");
Contract.Assert( ((int)src)%4 == 0, "Managed string should start at 4 bytes boundary");

Expand Down Expand Up @@ -1537,7 +1537,7 @@ private String CtorCharArray(char [] value)
String result = FastAllocateString(value.Length);

unsafe {
fixed (char * dest = result, source = value) {
fixed (char* dest = &result.m_firstChar, source = value) {
wstrcpy(dest, source, value.Length);
}
}
Expand Down Expand Up @@ -1567,7 +1567,7 @@ private String CtorCharArrayStartLength(char [] value, int startIndex, int lengt
String result = FastAllocateString(length);

unsafe {
fixed (char * dest = result, source = value) {
fixed (char* dest = &result.m_firstChar, source = value) {
wstrcpy(dest, source + startIndex, length);
}
}
Expand All @@ -1585,7 +1585,7 @@ private String CtorCharCount(char c, int count)
if (c != 0)
{
unsafe {
fixed (char *dest = result) {
fixed (char* dest = &result.m_firstChar) {
char *dmem = dest;
while (((uint)dmem & 3) != 0 && count > 0) {
*dmem++ = c;
Expand Down Expand Up @@ -1670,7 +1670,7 @@ private unsafe String CtorCharPtr(char *ptr)
return String.Empty;

String result = FastAllocateString(count);
fixed (char *dest = result)
fixed (char* dest = &result.m_firstChar)
wstrcpy(dest, ptr, count);
return result;
}
Expand Down Expand Up @@ -1704,7 +1704,7 @@ private unsafe String CtorCharPtrStartLength(char *ptr, int startIndex, int leng
String result = FastAllocateString(length);

try {
fixed(char *dest = result)
fixed (char* dest = &result.m_firstChar)
wstrcpy(dest, pFrom, length);
return result;
}
Expand Down