Fix many warnings, remove legacy -h option.
git-svn-id: svn://10.0.0.236/trunk@34587 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <string.h> /* After glib.h to avoid warnings about shadowing 'index'. */
|
||||
|
||||
#ifndef XP_MAC
|
||||
#include <libIDL/IDL.h>
|
||||
@@ -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?
|
||||
|
||||
@@ -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! */
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user