Bug 1442363, part 3 - Constify the strings in xpt_struct.h. r=njn
MozReview-Commit-ID: LBZze0U1jvW
--- 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);