Bug 1442363, part 3 - Constify the strings in xpt_struct.h. r=njn
authorAndrew McCreight <continuation@gmail.com>
Tue, 27 Feb 2018 15:15:05 -0800
changeset 462074 ae8424c2ac777a4a47044be35d73b3dc920dff80
parent 462073 6b7e0ca809e9f414d2832f026512184aa5b96be1
child 462075 4a4ea07f646712675cc96ce5bd123099e2ecde20
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1442363
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1442363, part 3 - Constify the strings in xpt_struct.h. r=njn MozReview-Commit-ID: LBZze0U1jvW
xpcom/typelib/xpt/xpt_struct.cpp
xpcom/typelib/xpt/xpt_struct.h
xpcom/typelib/xpt/xpt_xdr.cpp
xpcom/typelib/xpt/xpt_xdr.h
--- a/xpcom/typelib/xpt/xpt_struct.cpp
+++ b/xpcom/typelib/xpt/xpt_struct.cpp
@@ -181,17 +181,17 @@ XPT_DoHeader(XPTArena *arena, NotNull<XP
     return true;
 }
 
 /* InterfaceDirectoryEntry records go in the header */
 bool
 DoInterfaceDirectoryEntry(XPTArena *arena, NotNull<XPTCursor*> cursor,
                           XPTInterfaceDirectoryEntry *ide)
 {
-    char* dummy_name_space;
+    const char* dummy_name_space;
 
     /* write the IID in our cursor space */
     if (!XPT_DoIID(cursor, &(ide->iid)) ||
 
         /* write the name string in the data pool, and the offset in our
            cursor space */
         !XPT_DoCString(arena, cursor, &(ide->name)) ||
 
--- a/xpcom/typelib/xpt/xpt_struct.h
+++ b/xpcom/typelib/xpt/xpt_struct.h
@@ -67,21 +67,21 @@ struct XPTHeader {
 /*
  * A contiguous array of fixed-size InterfaceDirectoryEntry records begins at
  * the byte offset identified by the interface_directory field in the file
  * header.  The array is used to quickly locate an interface description
  * using its IID.  No interface should appear more than once in the array.
  */
 struct XPTInterfaceDirectoryEntry {
   nsID iid;
-  char* name;
+  const char* name;
 
   // This field exists in the on-disk format. But it isn't used so we don't
   // allocate space for it in memory.
-  //char* name_space;
+  //const char* name_space;
 
   XPTInterfaceDescriptor* interface_descriptor;
 };
 
 /*
  * An InterfaceDescriptor describes a single XPCOM interface, including all of
  * its methods.
  */
@@ -242,17 +242,17 @@ struct XPTTypeDescriptor {
 union XPTConstValue {
   int16_t i16;
   uint16_t ui16;
   int32_t i32;
   uint32_t ui32;
 }; /* varies according to type */
 
 struct XPTConstDescriptor {
-  char* name;
+  const char* name;
   XPTTypeDescriptor type;
   union XPTConstValue value;
 };
 
 /*
  * A ParamDescriptor is a variable-size record used to describe either a
  * single argument to a method or a method's result.
  */
@@ -261,16 +261,16 @@ struct XPTParamDescriptor {
   XPTTypeDescriptor type;
 };
 
 /*
  * A MethodDescriptor is a variable-size record used to describe a single
  * interface method.
  */
 struct XPTMethodDescriptor {
-  char* name;
+  const char* name;
   XPTParamDescriptor* params;
   //XPTParamDescriptor result; // Present on disk, omitted here.
   uint8_t flags;
   uint8_t num_args;
 };
 
 #endif /* xpt_struct_h */
--- a/xpcom/typelib/xpt/xpt_xdr.cpp
+++ b/xpcom/typelib/xpt/xpt_xdr.cpp
@@ -106,17 +106,17 @@ XPT_SkipStringInline(NotNull<XPTCursor*>
     for (uint16_t i = 0; i < length; i++)
         if (!XPT_Do8(cursor, &byte))
             return false;
 
     return true;
 }
 
 bool
-XPT_DoCString(XPTArena *arena, NotNull<XPTCursor*> cursor, char **identp,
+XPT_DoCString(XPTArena *arena, NotNull<XPTCursor*> cursor, const char **identp,
               bool ignore)
 {
     uint32_t offset = 0;
     if (!XPT_Do32(cursor, &offset))
         return false;
 
     if (!offset) {
         *identp = NULL;
--- a/xpcom/typelib/xpt/xpt_xdr.h
+++ b/xpcom/typelib/xpt/xpt_xdr.h
@@ -19,17 +19,17 @@ using mozilla::NotNull;
 struct XPTArena;
 struct XPTCursor;
 struct XPTState;
 
 bool
 XPT_SkipStringInline(NotNull<XPTCursor*> cursor);
 
 bool
-XPT_DoCString(XPTArena *arena, NotNull<XPTCursor*> cursor, char **strp,
+XPT_DoCString(XPTArena *arena, NotNull<XPTCursor*> cursor, const char **strp,
               bool ignore = false);
 
 bool
 XPT_DoIID(NotNull<XPTCursor*> cursor, nsID *iidp);
 
 bool
 XPT_Do64(NotNull<XPTCursor*> cursor, int64_t *u64p);