Bug 1444129, part 5 - Rename fields of XPTTypeDescriptor and XPTConstDescriptor. r=njn draft
authorAndrew McCreight <continuation@gmail.com>
Wed, 07 Mar 2018 14:34:22 -0800
changeset 765076 ed32e8134f3aed2e1ce563d57fb28f9d094b2765
parent 765075 0e712a66f9fabba134e0b955a62031cb81a5442d
child 765077 40beda1ab8c028e2145c4d7bfffa4b9d5d22cfc3
push id101960
push userbmo:continuation@gmail.com
push dateThu, 08 Mar 2018 23:46:50 +0000
reviewersnjn
bugs1444129
milestone60.0a1
Bug 1444129, part 5 - Rename fields of XPTTypeDescriptor and XPTConstDescriptor. r=njn MozReview-Commit-ID: LdDpZwKDxJH
xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
xpcom/reflect/xptinfo/xptinfo.h
xpcom/typelib/xpt/xpt_struct.cpp
xpcom/typelib/xpt/xpt_struct.h
--- a/xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
@@ -240,45 +240,45 @@ xptiInterfaceEntry::GetConstant(uint16_t
         return NS_ERROR_INVALID_ARG;
     }
 
     const auto& c = mDescriptor->mConstDescriptors[index - mConstantBaseIndex];
     AutoJSContext cx;
     JS::Rooted<JS::Value> v(cx);
     v.setUndefined();
 
-    switch (c.type.prefix.mFlags) {
+    switch (c.mType.mPrefix.mFlags) {
       case nsXPTType::T_I16:
       {
-        v.setInt32(c.value.i16);
+        v.setInt32(c.mValue.i16);
         break;
       }
       case nsXPTType::T_U16:
       {
-        v.setInt32(c.value.ui16);
+        v.setInt32(c.mValue.ui16);
         break;
       }
       case nsXPTType::T_I32:
       {
-        v = JS_NumberValue(c.value.i32);
+        v = JS_NumberValue(c.mValue.i32);
         break;
       }
       case nsXPTType::T_U32:
       {
-        v = JS_NumberValue(c.value.ui32);
+        v = JS_NumberValue(c.mValue.ui32);
         break;
       }
       default:
       {
         MOZ_ASSERT(false, "Invalid constant type found in interface");
       }
     }
 
     constant.set(v);
-    *name = ToNewCString(nsDependentCString(c.name));
+    *name = ToNewCString(nsDependentCString(c.mName));
 
     return NS_OK;
 }
 
 // this is a private helper
 
 nsresult
 xptiInterfaceEntry::GetInterfaceIndexForParam(uint16_t methodIndex,
@@ -297,25 +297,25 @@ xptiInterfaceEntry::GetInterfaceIndexFor
     {
         NS_ERROR("bad param");
         return NS_ERROR_INVALID_ARG;
     }
 
     const XPTTypeDescriptor *td = &param->type;
 
     while (td->Tag() == TD_ARRAY) {
-        td = &mDescriptor->mAdditionalTypes[td->u.array.additional_type];
+        td = &mDescriptor->mAdditionalTypes[td->u.mArray.mAdditionalType];
     }
 
     if (td->Tag() != TD_INTERFACE_TYPE) {
         NS_ERROR("not an interface");
         return NS_ERROR_INVALID_ARG;
     }
 
-    *interfaceIndex = (td->u.iface.iface_hi8 << 8) | td->u.iface.iface_lo8;
+    *interfaceIndex = (td->u.mIface.mIfaceHi8 << 8) | td->u.mIface.mIfaceLo8;
     return NS_OK;
 }
 
 nsresult
 xptiInterfaceEntry::GetEntryForParam(uint16_t methodIndex,
                                      const nsXPTParamInfo * param,
                                      xptiInterfaceEntry** entry)
 {
@@ -440,17 +440,17 @@ xptiInterfaceEntry::GetTypeInArray(const
     const XPTTypeDescriptor *additional_types =
                 mDescriptor->mAdditionalTypes;
 
     for (uint16_t i = 0; i < dimension; i++) {
         if (td->Tag() != TD_ARRAY) {
             NS_ERROR("bad dimension");
             return NS_ERROR_INVALID_ARG;
         }
-        td = &additional_types[td->u.array.additional_type];
+        td = &additional_types[td->u.mArray.mAdditionalType];
     }
 
     *type = td;
     return NS_OK;
 }
 
 nsresult
 xptiInterfaceEntry::GetTypeForParam(uint16_t methodIndex,
@@ -477,17 +477,17 @@ xptiInterfaceEntry::GetTypeForParam(uint
     if(dimension) {
         nsresult rv = GetTypeInArray(param, dimension, &td);
         if(NS_FAILED(rv))
             return rv;
     }
     else
         td = &param->type;
 
-    *type = nsXPTType(td->prefix);
+    *type = nsXPTType(td->mPrefix);
     return NS_OK;
 }
 
 nsresult
 xptiInterfaceEntry::GetSizeIsArgNumberForParam(uint16_t methodIndex,
                                                const nsXPTParamInfo* param,
                                                uint16_t dimension,
                                                uint8_t* argnum)
@@ -514,21 +514,21 @@ xptiInterfaceEntry::GetSizeIsArgNumberFo
             return rv;
     }
     else
         td = &param->type;
 
     // verify that this is a type that has size_is
     switch (td->Tag()) {
       case TD_ARRAY:
-        *argnum = td->u.array.argnum;
+        *argnum = td->u.mArray.mArgNum;
         break;
       case TD_PSTRING_SIZE_IS:
       case TD_PWSTRING_SIZE_IS:
-        *argnum = td->u.pstring_is.argnum;
+        *argnum = td->u.mPStringIs.mArgNum;
         break;
       default:
         NS_ERROR("not a size_is");
         return NS_ERROR_INVALID_ARG;
     }
 
     return NS_OK;
 }
@@ -550,25 +550,25 @@ xptiInterfaceEntry::GetInterfaceIsArgNum
     {
         NS_ERROR("bad index");
         return NS_ERROR_INVALID_ARG;
     }
 
     const XPTTypeDescriptor *td = &param->type;
 
     while (td->Tag() == TD_ARRAY) {
-        td = &mDescriptor->mAdditionalTypes[td->u.array.additional_type];
+        td = &mDescriptor->mAdditionalTypes[td->u.mArray.mAdditionalType];
     }
 
     if (td->Tag() != TD_INTERFACE_IS_TYPE) {
         NS_ERROR("not an iid_is");
         return NS_ERROR_INVALID_ARG;
     }
 
-    *argnum = td->u.interface_is.argnum;
+    *argnum = td->u.mInterfaceIs.mArgNum;
     return NS_OK;
 }
 
 nsresult
 xptiInterfaceEntry::IsIID(const nsIID * iid, bool *_retval)
 {
     // It is not necessary to Resolve because this info is read from manifest.
     *_retval = mIID.Equals(*iid);
--- a/xpcom/reflect/xptinfo/xptinfo.h
+++ b/xpcom/reflect/xptinfo/xptinfo.h
@@ -142,17 +142,17 @@ public:
     // When a dipper type is declared as an 'out' parameter, xpidl internally
     // converts it to an 'in', and sets the XPT_PD_DIPPER flag on it. For this
     // reason, dipper types are sometimes referred to as 'out parameters
     // masquerading as in'. The burden of maintaining this illusion falls mostly
     // on XPConnect, which creates the empty containers, and harvest the results
     // after the call.
     bool IsDipper() const {return !!(flags & kDipperMask);}
     bool IsOptional() const {return !!(flags & kOptionalMask);}
-    const nsXPTType GetType() const {return type.prefix;}
+    const nsXPTType GetType() const {return type.mPrefix;}
 
     bool IsStringClass() const {
       switch (GetType().TagPart()) {
         case nsXPTType::T_ASTRING:
         case nsXPTType::T_DOMSTRING:
         case nsXPTType::T_UTF8STRING:
         case nsXPTType::T_CSTRING:
           return true;
--- a/xpcom/typelib/xpt/xpt_struct.cpp
+++ b/xpcom/typelib/xpt/xpt_struct.cpp
@@ -310,34 +310,34 @@ DoInterfaceDescriptor(XPTArena *arena, N
 }
 
 bool
 DoConstDescriptor(XPTArena *arena, NotNull<XPTCursor*> cursor,
                   XPTConstDescriptor *cd, XPTInterfaceDescriptor *id)
 {
     bool ok = false;
 
-    if (!XPT_DoCString(arena, cursor, &cd->name) ||
-        !DoTypeDescriptor(arena, cursor, &cd->type, id)) {
+    if (!XPT_DoCString(arena, cursor, &cd->mName) ||
+        !DoTypeDescriptor(arena, cursor, &cd->mType, id)) {
 
         return false;
     }
 
-    switch (cd->type.Tag()) {
+    switch (cd->mType.Tag()) {
       case TD_INT16:
-        ok = XPT_Do16(cursor, (uint16_t*) &cd->value.i16);
+        ok = XPT_Do16(cursor, (uint16_t*) &cd->mValue.i16);
         break;
       case TD_INT32:
-        ok = XPT_Do32(cursor, (uint32_t*) &cd->value.i32);
+        ok = XPT_Do32(cursor, (uint32_t*) &cd->mValue.i32);
         break;
       case TD_UINT16:
-        ok = XPT_Do16(cursor, &cd->value.ui16);
+        ok = XPT_Do16(cursor, &cd->mValue.ui16);
         break;
       case TD_UINT32:
-        ok = XPT_Do32(cursor, &cd->value.ui32);
+        ok = XPT_Do32(cursor, &cd->mValue.ui32);
         break;
       default:
         MOZ_ASSERT(false, "illegal type");
         break;
     }
 
     return ok;
 }
@@ -397,53 +397,53 @@ DoTypeDescriptorPrefix(XPTArena *arena, 
 {
     return XPT_Do8(cursor, &tdp->mFlags);
 }
 
 bool
 DoTypeDescriptor(XPTArena *arena, NotNull<XPTCursor*> cursor,
                  XPTTypeDescriptor *td, XPTInterfaceDescriptor *id)
 {
-    if (!DoTypeDescriptorPrefix(arena, cursor, &td->prefix)) {
+    if (!DoTypeDescriptorPrefix(arena, cursor, &td->mPrefix)) {
         return false;
     }
 
     switch (td->Tag()) {
       case TD_INTERFACE_TYPE:
         uint16_t iface;
         if (!XPT_Do16(cursor, &iface))
             return false;
-        td->u.iface.iface_hi8 = (iface >> 8) & 0xff;
-        td->u.iface.iface_lo8 = iface & 0xff;
+        td->u.mIface.mIfaceHi8 = (iface >> 8) & 0xff;
+        td->u.mIface.mIfaceLo8 = iface & 0xff;
         break;
       case TD_INTERFACE_IS_TYPE:
-        if (!XPT_Do8(cursor, &td->u.interface_is.argnum))
+        if (!XPT_Do8(cursor, &td->u.mInterfaceIs.mArgNum))
             return false;
         break;
       case TD_ARRAY: {
         // argnum2 appears in the on-disk format but it isn't used.
         uint8_t argnum2 = 0;
-        if (!XPT_Do8(cursor, &td->u.array.argnum) ||
+        if (!XPT_Do8(cursor, &td->u.mArray.mArgNum) ||
             !XPT_Do8(cursor, &argnum2))
             return false;
 
         XPTTypeDescriptor elementTypeDescriptor;
         if (!DoTypeDescriptor(arena, cursor, &elementTypeDescriptor, id))
             return false;
         if (!InterfaceDescriptorAddType(arena, id, &elementTypeDescriptor))
             return false;
-        td->u.array.additional_type = id->mNumAdditionalTypes - 1;
+        td->u.mArray.mAdditionalType = id->mNumAdditionalTypes - 1;
 
         break;
       }
       case TD_PSTRING_SIZE_IS:
       case TD_PWSTRING_SIZE_IS: {
         // argnum2 appears in the on-disk format but it isn't used.
         uint8_t argnum2 = 0;
-        if (!XPT_Do8(cursor, &td->u.pstring_is.argnum) ||
+        if (!XPT_Do8(cursor, &td->u.mPStringIs.mArgNum) ||
             !XPT_Do8(cursor, &argnum2))
             return false;
         break;
       }
       default:
         /* nothing special */
         break;
     }
--- a/xpcom/typelib/xpt/xpt_struct.h
+++ b/xpcom/typelib/xpt/xpt_struct.h
@@ -186,51 +186,51 @@ enum XPTTypeDescriptorTags {
   TD_UTF8STRING        = 23,
   TD_CSTRING           = 24,
   TD_ASTRING           = 25,
   TD_JSVAL             = 26
 };
 
 struct XPTTypeDescriptor {
   uint8_t Tag() const {
-    return prefix.TagPart();
+    return mPrefix.TagPart();
   }
 
-  XPTTypeDescriptorPrefix prefix;
+  XPTTypeDescriptorPrefix mPrefix;
 
   // The memory layout here doesn't exactly match (for the appropriate types)
   // the on-disk format. This is to save memory.
   union {
     // Used for TD_INTERFACE_IS_TYPE.
     struct {
-      uint8_t argnum;
-    } interface_is;
+      uint8_t mArgNum;
+    } mInterfaceIs;
 
     // Used for TD_PSTRING_SIZE_IS, TD_PWSTRING_SIZE_IS.
     struct {
-      uint8_t argnum;
-      //uint8_t argnum2;          // Present on disk, omitted here.
-    } pstring_is;
+      uint8_t mArgNum;
+      //uint8_t mArgNum2;         // Present on disk, omitted here.
+    } mPStringIs;
 
     // Used for TD_ARRAY.
     struct {
-      uint8_t argnum;
-      //uint8_t argnum2;          // Present on disk, omitted here.
-      uint8_t additional_type;    // uint16_t on disk, uint8_t here;
+      uint8_t mArgNum;
+      //uint8_t mArgNum2;         // Present on disk, omitted here.
+      uint8_t mAdditionalType;    // uint16_t on disk, uint8_t here;
                                   // in practice it never exceeds 20.
-    } array;
+    } mArray;
 
     // Used for TD_INTERFACE_TYPE.
     struct {
       // We store the 16-bit iface value as two 8-bit values in order to
       // avoid 16-bit alignment requirements for XPTTypeDescriptor, which
       // reduces its size and also the size of XPTParamDescriptor.
-      uint8_t iface_hi8;
-      uint8_t iface_lo8;
-    } iface;
+      uint8_t mIfaceHi8;
+      uint8_t mIfaceLo8;
+    } mIface;
   } u;
 };
 
 /*
  * A ConstDescriptor is a variable-size record that records the name and
  * value of a scoped interface constant. This is allowed only for a subset
  * of types.
  *
@@ -242,19 +242,19 @@ struct XPTTypeDescriptor {
 union XPTConstValue {
   int16_t i16;
   uint16_t ui16;
   int32_t i32;
   uint32_t ui32;
 }; /* varies according to type */
 
 struct XPTConstDescriptor {
-  const char* name;
-  XPTTypeDescriptor type;
-  union XPTConstValue value;
+  const char* mName;
+  XPTTypeDescriptor mType;
+  union XPTConstValue mValue;
 };
 
 /*
  * A ParamDescriptor is a variable-size record used to describe either a
  * single argument to a method or a method's result.
  */
 struct XPTParamDescriptor {
   uint8_t flags;