From df77619c4a278d55849bf0d418548e8b51a3c168 Mon Sep 17 00:00:00 2001 From: "shaver%netscape.com" Date: Mon, 8 Mar 1999 21:11:08 +0000 Subject: [PATCH] display method flags, handle bogus indices --- xpcom/libxpt/tools/xpt_dump.c | 13 +++++++++++-- xpcom/typelib/xpt/tools/xpt_dump.c | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/xpcom/libxpt/tools/xpt_dump.c b/xpcom/libxpt/tools/xpt_dump.c index f09e30ce06ab..a96c4fe77819 100644 --- a/xpcom/libxpt/tools/xpt_dump.c +++ b/xpcom/libxpt/tools/xpt_dump.c @@ -487,7 +487,13 @@ XPT_DumpMethodDescriptor(XPTHeader *header, XPTMethodDescriptor *md, if (!XPT_GetStringForType(header, &md->result->type, ¶m_type)) { return PR_FALSE; } - fprintf(stdout, "%*s%s %s(", indent, " ", param_type, md->name); + fprintf(stdout, "%*s%c%c%c%c%c %s %s(", indent - 6, " ", + XPT_MD_IS_GETTER(md->flags) ? 'G' : ' ', + XPT_MD_IS_SETTER(md->flags) ? 'S' : ' ', + XPT_MD_IS_HIDDEN(md->flags) ? 'H' : ' ', + XPT_MD_IS_VARARGS(md->flags) ? 'V' : ' ', + XPT_MD_IS_CTOR(md->flags) ? 'C' : ' ', + param_type, md->name); for (i=0; inum_args; i++) { if (i!=0) { fprintf(stdout, ", "); @@ -535,7 +541,10 @@ XPT_GetStringForType(XPTHeader *header, XPTTypeDescriptor *td, } else { if (tag == TD_INTERFACE_TYPE) { int index = td->type.interface; - *type_string = header->interface_directory[index].name; + if (!index || index > header->num_interfaces) + *type_string = "UNKNOWN_INTERFACE"; + else + *type_string = header->interface_directory[index-1].name; } else { *type_string = type_array[tag]; } diff --git a/xpcom/typelib/xpt/tools/xpt_dump.c b/xpcom/typelib/xpt/tools/xpt_dump.c index f09e30ce06ab..a96c4fe77819 100644 --- a/xpcom/typelib/xpt/tools/xpt_dump.c +++ b/xpcom/typelib/xpt/tools/xpt_dump.c @@ -487,7 +487,13 @@ XPT_DumpMethodDescriptor(XPTHeader *header, XPTMethodDescriptor *md, if (!XPT_GetStringForType(header, &md->result->type, ¶m_type)) { return PR_FALSE; } - fprintf(stdout, "%*s%s %s(", indent, " ", param_type, md->name); + fprintf(stdout, "%*s%c%c%c%c%c %s %s(", indent - 6, " ", + XPT_MD_IS_GETTER(md->flags) ? 'G' : ' ', + XPT_MD_IS_SETTER(md->flags) ? 'S' : ' ', + XPT_MD_IS_HIDDEN(md->flags) ? 'H' : ' ', + XPT_MD_IS_VARARGS(md->flags) ? 'V' : ' ', + XPT_MD_IS_CTOR(md->flags) ? 'C' : ' ', + param_type, md->name); for (i=0; inum_args; i++) { if (i!=0) { fprintf(stdout, ", "); @@ -535,7 +541,10 @@ XPT_GetStringForType(XPTHeader *header, XPTTypeDescriptor *td, } else { if (tag == TD_INTERFACE_TYPE) { int index = td->type.interface; - *type_string = header->interface_directory[index].name; + if (!index || index > header->num_interfaces) + *type_string = "UNKNOWN_INTERFACE"; + else + *type_string = header->interface_directory[index-1].name; } else { *type_string = type_array[tag]; }