diff --git a/mozilla/xpcom/typelib/xpidl/xpidl.c b/mozilla/xpcom/typelib/xpidl/xpidl.c index 04d2ff20aee..8b99d5624d0 100644 --- a/mozilla/xpcom/typelib/xpidl/xpidl.c +++ b/mozilla/xpcom/typelib/xpidl/xpidl.c @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) { int i, idlfiles; IncludePathEntry *inc, *inc_head, **inc_tail; - char *basename = NULL; + char *file_basename = NULL; ModeData *mode = NULL; /* turn this on for extra checking of our code */ @@ -165,16 +165,9 @@ int main(int argc, char *argv[]) xpidl_usage(argc, argv); return 1; } - basename = argv[i + 1]; + file_basename = argv[i + 1]; i++; break; - case 'h': /* legacy stuff, already! */ - mode = FindMode("header"); - if (!mode) { - xpidl_usage(argc, argv); - return 1; - } - break; case 'm': if (i == argc) { fprintf(stderr, "ERROR: missing modename after -m\n"); @@ -211,7 +204,7 @@ int main(int argc, char *argv[]) } for (idlfiles = 0; i < argc; i++) - idlfiles += xpidl_process_idl(argv[i], inc_head, basename, mode); + idlfiles += xpidl_process_idl(argv[i], inc_head, file_basename, mode); if (!idlfiles) return 1; diff --git a/mozilla/xpcom/typelib/xpidl/xpidl.h b/mozilla/xpcom/typelib/xpidl/xpidl.h index 6750a072ca1..0b9a2b7bc40 100644 --- a/mozilla/xpcom/typelib/xpidl/xpidl.h +++ b/mozilla/xpcom/typelib/xpidl/xpidl.h @@ -28,8 +28,8 @@ #include #include #include -#include #include +#include /* After glib.h to avoid warnings about shadowing 'index'. */ #ifndef XP_MAC #include @@ -89,11 +89,12 @@ struct TreeState { /* * Process an IDL file, generating InterfaceInfo, documentation and headers as - * appropriate. + * appropriate. Use file_basename instead of basename to avoid conflict + * warnings with basename from some versions of string.h. */ int xpidl_process_idl(char *filename, IncludePathEntry *include_path, - char *basename, ModeData *mode); + char *file_basename, ModeData *mode); /* * Iterate over an IDLN_LIST -- why is this not part of libIDL? diff --git a/mozilla/xpcom/typelib/xpidl/xpidl_idl.c b/mozilla/xpcom/typelib/xpidl/xpidl_idl.c index c64823fffbd..aaf4672404f 100644 --- a/mozilla/xpcom/typelib/xpidl/xpidl_idl.c +++ b/mozilla/xpcom/typelib/xpidl/xpidl_idl.c @@ -124,7 +124,7 @@ struct input_callback_data { char *buf; /* buffer for data */ char *point; /* next char to feed to libIDL */ int len; /* amount of data read into the buffer */ - int max; /* size of the buffer */ + unsigned int max; /* size of the buffer */ struct input_callback_data *next; /* file from which we were included */ int f_raw : 2, /* in a raw block when starting next block */ f_comment : 2, /* in a comment when starting next block */ @@ -415,13 +415,14 @@ input_callback(IDL_input_reason reason, union IDL_input_data *cb_data, #endif assert(stack->includes); if (!g_hash_table_lookup(stack->includes, filename)) { - char *basename = filename; + char *file_basename = filename; filename = xpidl_strdup(filename); - ptr = strrchr(basename, '.'); + ptr = strrchr(file_basename, '.'); if (ptr) *ptr = 0; - basename = xpidl_strdup(basename); - g_hash_table_insert(stack->includes, filename, basename); + file_basename = xpidl_strdup(file_basename); + g_hash_table_insert(stack->includes, + filename, file_basename); new_data = new_input_callback_data(filename, stack->include_path); if (!new_data) { @@ -454,6 +455,7 @@ input_callback(IDL_input_reason reason, union IDL_input_data *cb_data, } avail = MIN(data->buf + data->len, end_copy) - data->point; + assert(avail >= 0); #ifdef DEBUG_shaver_bufmgmt fprintf(stderr, "avail[%d] = MIN((data->buf[%x] + data->len[%d])[%x], " @@ -466,7 +468,8 @@ input_callback(IDL_input_reason reason, union IDL_input_data *cb_data, #ifdef DEBUG_shaver_bufmgmt fprintf(stderr, "COPYING->%.*s<-COPYING\n", copy, data->point); #endif - memcpy(cb_data->fill.buffer, data->point, copy); + /* Supress signed->unsigned conversion warning from memcpy prototype. */ + memcpy(cb_data->fill.buffer, data->point, (unsigned int)copy); data->point += copy; return copy; @@ -488,7 +491,7 @@ input_callback(IDL_input_reason reason, union IDL_input_data *cb_data, int xpidl_process_idl(char *filename, IncludePathEntry *include_path, - char *basename, ModeData *mode) + char *file_basename, ModeData *mode) { char *tmp, *outname, *mode_outname; IDL_tree top; @@ -514,18 +517,18 @@ xpidl_process_idl(char *filename, IncludePathEntry *include_path, #ifdef XP_MAC // on the Mac, we let CodeWarrior tell us where to put the output file. - if (!basename) { + if (!file_basename) { outname = xpidl_strdup(filename); tmp = strrchr(outname, '.'); if (tmp != NULL) *tmp = '\0'; } else { - outname = xpidl_strdup(basename); + outname = xpidl_strdup(file_basename); } #else - if (!basename) + if (!file_basename) outname = xpidl_strdup(state.basename); else - outname = xpidl_strdup(basename); + outname = xpidl_strdup(file_basename); #endif /* so we don't include it again! */ diff --git a/mozilla/xpcom/typelib/xpidl/xpidl_typelib.c b/mozilla/xpcom/typelib/xpidl/xpidl_typelib.c index 9d40c11dd39..ebe2b606d4a 100644 --- a/mozilla/xpcom/typelib/xpidl/xpidl_typelib.c +++ b/mozilla/xpcom/typelib/xpidl/xpidl_typelib.c @@ -187,9 +187,9 @@ find_interfaces(IDL_tree_func_data *tfd, gpointer user_data) } if (node && IDL_NODE_TYPE(node) == IDLN_IDENT) { - IDL_tree_func_data tfd; - tfd.tree = node; - add_interface_maybe(&tfd, user_data); + IDL_tree_func_data new_tfd; + new_tfd.tree = node; + add_interface_maybe(&new_tfd, user_data); } return TRUE;