mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
don't die on invalid strings
This commit is contained in:
parent
cef0d957e2
commit
8cf5c9a430
1 changed files with 24 additions and 13 deletions
|
@ -55,13 +55,17 @@ dump_methods (progs_t *pr, pr_method_list_t *methods, int class)
|
|||
{
|
||||
int i;
|
||||
char mark = class ? '+' : '-';
|
||||
const char *sel_id;
|
||||
|
||||
while (methods) {
|
||||
pr_method_t *method = methods->method_list;
|
||||
for (i = 0; i < methods->method_count; i++) {
|
||||
printf (" %c%s %d @ %d\n", mark,
|
||||
PR_GetString (pr, method->method_name.sel_id),
|
||||
method->method_imp, POINTER_TO_PROG (pr, method));
|
||||
if (PR_StringValid (pr, method->method_name.sel_id))
|
||||
sel_id = PR_GetString (pr, method->method_name.sel_id);
|
||||
else
|
||||
sel_id = "<invalid string>";
|
||||
printf (" %c%s %d @ %d\n", mark, sel_id, method->method_imp,
|
||||
POINTER_TO_PROG (pr, method));
|
||||
method++;
|
||||
}
|
||||
methods = &G_STRUCT (pr, pr_method_list_t, methods->method_next);
|
||||
|
@ -72,14 +76,18 @@ void
|
|||
dump_class (progs_t *pr, pr_class_t *class)
|
||||
{
|
||||
pr_class_t *meta = &G_STRUCT (pr, pr_class_t, class->class_pointer);
|
||||
const char *class_name = "<invalid string>";
|
||||
const char *super_class_name = "<invalid string>";
|
||||
|
||||
if (PR_StringValid (pr, class->name))
|
||||
class_name = PR_GetString (pr, class->name);
|
||||
if (class->super_class) {
|
||||
printf (" %s @ %d : %s\n", PR_GetString (pr, class->name),
|
||||
POINTER_TO_PROG (pr, class), PR_GetString (pr,
|
||||
class->super_class));
|
||||
if (PR_StringValid (pr, class->super_class))
|
||||
class_name = PR_GetString (pr, class->super_class);
|
||||
printf (" %s @ %d : %s\n", class_name, POINTER_TO_PROG (pr, class),
|
||||
super_class_name);
|
||||
} else {
|
||||
printf (" %s @ %d\n", PR_GetString (pr, class->name),
|
||||
POINTER_TO_PROG (pr, class));
|
||||
printf (" %s @ %d\n", class_name, POINTER_TO_PROG (pr, class));
|
||||
}
|
||||
printf (" %d %d %d %d\n", class->class_pointer, class->version,
|
||||
class->info, class->instance_size);
|
||||
|
@ -98,9 +106,11 @@ dump_module (progs_t *pr, pr_module_t *module)
|
|||
pr_symtab_t *symtab = &G_STRUCT (pr, pr_symtab_t, module->symtab);
|
||||
pointer_t *ptr = symtab->defs;
|
||||
int i;
|
||||
const char *module_name = "<invalid string>";
|
||||
|
||||
printf ("%d %d %s\n", module->version, module->size,
|
||||
PR_GetString (pr, module->name));
|
||||
if (PR_StringValid (pr, module->name))
|
||||
module_name = PR_GetString (pr, module->name);
|
||||
printf ("%d %d %s\n", module->version, module->size, module_name);
|
||||
if (!symtab) {
|
||||
printf (" No symtab!\n");
|
||||
return;
|
||||
|
@ -117,12 +127,13 @@ void
|
|||
dump_modules (progs_t *pr)
|
||||
{
|
||||
int i;
|
||||
const char *name;
|
||||
|
||||
for (i = 0; i < pr->progs->numglobaldefs; i++) {
|
||||
ddef_t *def = &pr->pr_globaldefs[i];
|
||||
ddef_t *def = &pr->pr_globaldefs[i];
|
||||
const char *name = "<invalid_string>";
|
||||
|
||||
name = PR_GetString (pr, def->s_name);
|
||||
if (PR_StringValid (pr, def->s_name))
|
||||
name = PR_GetString (pr, def->s_name);
|
||||
if (strcmp (name, "_OBJ_MODULE") == 0)
|
||||
dump_module (pr, &G_STRUCT (pr, pr_module_t, def->ofs));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue