Rename internal Utf8String to MdUtf8String (#17856)
authorAtsushi Kanamori <AtsushiKan@users.noreply.github.com>
Wed, 2 May 2018 03:30:22 +0000 (20:30 -0700)
committerJan Kotas <jkotas@microsoft.com>
Wed, 2 May 2018 03:30:22 +0000 (20:30 -0700)
We want to start prototyping Utf8String in CoreFxLab
and for that, we'll need a bare-bones System.Utf8String
class exposed from System.Private.CoreLib.

Unfortunately, CoreLib already has an internal
struct named System.Utf8String. Since it's only
an internal type, we'll exercise eminent domain
on its name now and get these noise changes out of
the way.

src/mscorlib/src/System/Reflection/MdImport.cs
src/mscorlib/src/System/Reflection/RuntimeEventInfo.cs
src/mscorlib/src/System/Reflection/RuntimePropertyInfo.cs
src/mscorlib/src/System/RtType.cs
src/mscorlib/src/System/RuntimeHandles.cs
src/vm/ecalllist.h
src/vm/runtimehandles.cpp
src/vm/runtimehandles.h

index 29a815bbfee8b517e588ac649432a386a27fd182..8589e14d422cbbae1f22a24558c1d6a16d368949 100644 (file)
@@ -412,22 +412,22 @@ namespace System.Reflection
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         private static extern unsafe void _GetName(IntPtr scope, int mdToken, void** name);
-        public unsafe Utf8String GetName(int mdToken)
+        public unsafe MdUtf8String GetName(int mdToken)
         {
             void* name;
             _GetName(m_metadataImport2, mdToken, &name);
 
-            return new Utf8String(name);
+            return new MdUtf8String(name);
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         private static extern unsafe void _GetNamespace(IntPtr scope, int mdToken, void** namesp);
-        public unsafe Utf8String GetNamespace(int mdToken)
+        public unsafe MdUtf8String GetNamespace(int mdToken)
         {
             void* namesp;
             _GetNamespace(m_metadataImport2, mdToken, &namesp);
 
-            return new Utf8String(namesp);
+            return new MdUtf8String(namesp);
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -640,8 +640,8 @@ namespace System.Reflection
             int _attributes;
             void* _importName, _importDll;
             _GetPInvokeMap(m_metadataImport2, token, out _attributes, &_importName, &_importDll);
-            importName = new Utf8String(_importName).ToString();
-            importDll = new Utf8String(_importDll).ToString();
+            importName = new MdUtf8String(_importName).ToString();
+            importDll = new MdUtf8String(_importDll).ToString();
 
             attributes = (PInvokeAttributes)_attributes;
         }
index bd8c451fe7bb02e6857ae1b48aced50324bc083c..4152f2bdd6dfac93f4b93d15cb31d4c6768ad32d 100644 (file)
@@ -124,7 +124,7 @@ namespace System.Reflection
             get
             {
                 if (m_name == null)
-                    m_name = new Utf8String(m_utf8name).ToString();
+                    m_name = new MdUtf8String(m_utf8name).ToString();
 
                 return m_name;
             }
index 2315e425748c09b1639a5568d4f120414b471ade..1e64da21230278ac9265c5737c793e23aa842afb 100644 (file)
@@ -189,7 +189,7 @@ namespace System.Reflection
             get
             {
                 if (m_name == null)
-                    m_name = new Utf8String(m_utf8name).ToString();
+                    m_name = new MdUtf8String(m_utf8name).ToString();
 
                 return m_name;
             }
index f16d198cd3cd2c65bbff5db38021f0e3906959f7..ca25f8531560bc16b10957dc33284dfce2dbebd9 100644 (file)
@@ -188,13 +188,13 @@ namespace System
 
             private struct Filter
             {
-                private Utf8String m_name;
+                private MdUtf8String m_name;
                 private MemberListType m_listType;
                 private uint m_nameHash;
 
                 public unsafe Filter(byte* pUtf8Name, int cUtf8Name, MemberListType listType)
                 {
-                    m_name = new Utf8String((void*)pUtf8Name, cUtf8Name);
+                    m_name = new MdUtf8String((void*)pUtf8Name, cUtf8Name);
                     m_listType = listType;
                     m_nameHash = 0;
 
@@ -204,7 +204,7 @@ namespace System
                     }
                 }
 
-                public bool Match(Utf8String name)
+                public bool Match(MdUtf8String name)
                 {
                     bool retVal = true;
 
@@ -943,7 +943,7 @@ namespace System
 
                             if (filter.RequiresStringComparison())
                             {
-                                Utf8String name;
+                                MdUtf8String name;
                                 name = scope.GetName(tkField);
 
                                 if (!filter.Match(name))
@@ -1179,7 +1179,7 @@ namespace System
 
                         if (filter.RequiresStringComparison())
                         {
-                            Utf8String name;
+                            MdUtf8String name;
                             name = scope.GetName(tkEvent);
 
                             if (!filter.Match(name))
@@ -1296,7 +1296,7 @@ namespace System
                                 continue;
                             }
 
-                            Utf8String name;
+                            MdUtf8String name;
                             name = declaringType.GetRuntimeModule().MetadataImport.GetName(tkProperty);
 
                             if (!filter.Match(name))
@@ -4917,7 +4917,7 @@ namespace System
     }
 
     #region Library
-    internal unsafe struct Utf8String
+    internal unsafe struct MdUtf8String
     {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         private static extern unsafe bool EqualsCaseSensitive(void* szLhs, void* szRhs, int cSz);
@@ -4949,7 +4949,7 @@ namespace System
         private void* m_pStringHeap;        // This is the raw UTF8 string.
         private int m_StringHeapByteLength;
 
-        internal Utf8String(void* pStringHeap)
+        internal MdUtf8String(void* pStringHeap)
         {
             m_pStringHeap = pStringHeap;
             if (pStringHeap != null)
@@ -4962,13 +4962,13 @@ namespace System
             }
         }
 
-        internal unsafe Utf8String(void* pUtf8String, int cUtf8String)
+        internal unsafe MdUtf8String(void* pUtf8String, int cUtf8String)
         {
             m_pStringHeap = pUtf8String;
             m_StringHeapByteLength = cUtf8String;
         }
 
-        internal unsafe bool Equals(Utf8String s)
+        internal unsafe bool Equals(MdUtf8String s)
         {
             if (m_pStringHeap == null)
             {
@@ -4976,12 +4976,12 @@ namespace System
             }
             if ((s.m_StringHeapByteLength == m_StringHeapByteLength) && (m_StringHeapByteLength != 0))
             {
-                return Utf8String.EqualsCaseSensitive(s.m_pStringHeap, m_pStringHeap, m_StringHeapByteLength);
+                return MdUtf8String.EqualsCaseSensitive(s.m_pStringHeap, m_pStringHeap, m_StringHeapByteLength);
             }
             return false;
         }
 
-        internal unsafe bool EqualsCaseInsensitive(Utf8String s)
+        internal unsafe bool EqualsCaseInsensitive(MdUtf8String s)
         {
             if (m_pStringHeap == null)
             {
@@ -4989,14 +4989,14 @@ namespace System
             }
             if ((s.m_StringHeapByteLength == m_StringHeapByteLength) && (m_StringHeapByteLength != 0))
             {
-                return Utf8String.EqualsCaseInsensitive(s.m_pStringHeap, m_pStringHeap, m_StringHeapByteLength);
+                return MdUtf8String.EqualsCaseInsensitive(s.m_pStringHeap, m_pStringHeap, m_StringHeapByteLength);
             }
             return false;
         }
 
         internal unsafe uint HashCaseInsensitive()
         {
-            return Utf8String.HashCaseInsensitive(m_pStringHeap, m_StringHeapByteLength);
+            return MdUtf8String.HashCaseInsensitive(m_pStringHeap, m_StringHeapByteLength);
         }
 
         public override string ToString()
index a4344f3d7137636bccb07fc452450b742dbe777c..dc659e3dee89b7393596a3bf41aa4397d6e67d3d 100644 (file)
@@ -399,9 +399,9 @@ namespace System
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         private static extern void* _GetUtf8Name(RuntimeType type);
 
-        internal static Utf8String GetUtf8Name(RuntimeType type)
+        internal static MdUtf8String GetUtf8Name(RuntimeType type)
         {
-            return new Utf8String(_GetUtf8Name(type));
+            return new MdUtf8String(_GetUtf8Name(type));
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -876,9 +876,9 @@ namespace System
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         private static extern void* _GetUtf8Name(RuntimeMethodHandleInternal method);
 
-        internal static Utf8String GetUtf8Name(RuntimeMethodHandleInternal method)
+        internal static MdUtf8String GetUtf8Name(RuntimeMethodHandleInternal method)
         {
-            return new Utf8String(_GetUtf8Name(method));
+            return new MdUtf8String(_GetUtf8Name(method));
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -1126,7 +1126,7 @@ namespace System
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         private static extern unsafe void* _GetUtf8Name(RuntimeFieldHandleInternal field);
 
-        internal static unsafe Utf8String GetUtf8Name(RuntimeFieldHandleInternal field) { return new Utf8String(_GetUtf8Name(field)); }
+        internal static unsafe MdUtf8String GetUtf8Name(RuntimeFieldHandleInternal field) { return new MdUtf8String(_GetUtf8Name(field)); }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal static extern bool MatchesNameHash(RuntimeFieldHandleInternal handle, uint hash);
index c4f5a0d58621379b7688e0abd285d65df9964b58..9779b8a945b0603d96d31066d635c3c9c15bdc2b 100644 (file)
@@ -474,10 +474,10 @@ FCFuncStart(gAppDomainFuncs)
 FCFuncEnd()
 
 
-FCFuncStart(gUtf8String)
-    FCFuncElement("EqualsCaseSensitive", Utf8String::EqualsCaseSensitive)
-    QCFuncElement("EqualsCaseInsensitive", Utf8String::EqualsCaseInsensitive)
-    QCFuncElement("HashCaseInsensitive", Utf8String::HashCaseInsensitive)
+FCFuncStart(gMdUtf8String)
+    FCFuncElement("EqualsCaseSensitive", MdUtf8String::EqualsCaseSensitive)
+    QCFuncElement("EqualsCaseInsensitive", MdUtf8String::EqualsCaseInsensitive)
+    QCFuncElement("HashCaseInsensitive", MdUtf8String::HashCaseInsensitive)
 FCFuncEnd()
 
 FCFuncStart(gTypeNameBuilder)
@@ -1316,6 +1316,7 @@ FCClassElement("MathF", "System", gMathFFuncs)
 #ifdef MDA_SUPPORTED 
 FCClassElement("Mda", "System", gMda)
 #endif
+FCClassElement("MdUtf8String", "System", gMdUtf8String)
 FCClassElement("MemoryFailPoint", "System.Runtime", gMemoryFailPointFuncs)
 FCClassElement("MetadataImport", "System.Reflection", gMetaDataImport)
 FCClassElement("MissingMemberException", "System",  gMissingMemberExceptionFuncs)
@@ -1383,7 +1384,6 @@ FCClassElement("TypedReference", "System", gTypedReferenceFuncs)
 #ifdef FEATURE_COMINTEROP
 FCClassElement("UriMarshaler", "System.StubHelpers", gUriMarshalerFuncs)
 #endif
-FCClassElement("Utf8String", "System", gUtf8String)
 FCClassElement("ValueClassMarshaler", "System.StubHelpers", gValueClassMarshalerFuncs)
 FCClassElement("ValueType", "System", gValueTypeFuncs)
 #ifdef FEATURE_COMINTEROP
index 2aba21fb74b8027e2bc2210d4e58ce8f5a9520f6..1d0fb955c2dfe5f2177fb26ddb451d0f0d08ca1f 100644 (file)
@@ -32,7 +32,7 @@
 #include "invokeutil.h"
 
 
-FCIMPL3(FC_BOOL_RET, Utf8String::EqualsCaseSensitive, LPCUTF8 szLhs, LPCUTF8 szRhs, INT32 stringNumBytes)
+FCIMPL3(FC_BOOL_RET, MdUtf8String::EqualsCaseSensitive, LPCUTF8 szLhs, LPCUTF8 szRhs, INT32 stringNumBytes)
 {
     CONTRACTL {
         FCALL_CHECK;
@@ -50,7 +50,7 @@ FCIMPL3(FC_BOOL_RET, Utf8String::EqualsCaseSensitive, LPCUTF8 szLhs, LPCUTF8 szR
 }
 FCIMPLEND
 
-BOOL QCALLTYPE Utf8String::EqualsCaseInsensitive(LPCUTF8 szLhs, LPCUTF8 szRhs, INT32 stringNumBytes)
+BOOL QCALLTYPE MdUtf8String::EqualsCaseInsensitive(LPCUTF8 szLhs, LPCUTF8 szRhs, INT32 stringNumBytes)
 {
     QCALL_CONTRACT;
 
@@ -77,7 +77,7 @@ BOOL QCALLTYPE Utf8String::EqualsCaseInsensitive(LPCUTF8 szLhs, LPCUTF8 szRhs, I
     return fStringsEqual;
 }
 
-ULONG QCALLTYPE Utf8String::HashCaseInsensitive(LPCUTF8 sz, INT32 stringNumBytes)
+ULONG QCALLTYPE MdUtf8String::HashCaseInsensitive(LPCUTF8 sz, INT32 stringNumBytes)
 {
     QCALL_CONTRACT;
 
index 7a637e65bcddc7a2b9391eef7ba3db5f8e26f03e..c757f9d8a4fb78ed8d27e55672e4c93404ae00ee 100644 (file)
@@ -104,7 +104,7 @@ public:
     INT32 m_localIndex;
 };
 
-class Utf8String {
+class MdUtf8String {
 public:
     static FCDECL3(FC_BOOL_RET, EqualsCaseSensitive, LPCUTF8 szLhs, LPCUTF8 szRhs, INT32 stringNumBytes);