File openmotif-uil.diff of Package motif
Index: b/clients/uil/UilDiags.c
===================================================================
--- a/clients/uil/UilDiags.c
+++ b/clients/uil/UilDiags.c
@@ -194,9 +194,9 @@ void diag_issue_diagnostic
va_list ap; /* ptr to variable length parameter */
int severity; /* severity of message */
int message_number; /* message number */
- char msg_buffer[132]; /* buffer to construct message */
+ char *msg_buffer = 0; /* buffer to construct message */
char ptr_buffer[buf_size]; /* buffer to construct pointer */
- char loc_buffer[132]; /* buffer to construct location */
+ char *loc_buffer = 0; /* buffer to construct location */
char src_buffer[buf_size]; /* buffer to hold source line */
/*
@@ -280,19 +280,18 @@ void diag_issue_diagnostic
va_start(ap, l_start_column);
#ifndef NO_MESSAGE_CATALOG
- vsnprintf( msg_buffer, sizeof(msg_buffer),
+ vasprintf(&msg_buffer,
catgets(uil_catd, UIL_SET1, msg_cat_table[ message_number ],
diag_rz_msg_table[ message_number ].ac_text),
ap );
#else
- vsnprintf( msg_buffer, sizeof(msg_buffer),
+ vasprintf(&msg_buffer,
diag_rz_msg_table[ message_number ].ac_text,
ap );
#endif
va_end(ap);
src_buffer[ 0 ] = 0;
- loc_buffer[ 0 ] = 0;
ptr_buffer[ 0 ] = 0;
if (az_src_rec != diag_k_no_source)
@@ -304,13 +303,13 @@ void diag_issue_diagnostic
*/
#ifndef NO_MESSAGE_CATALOG
- sprintf( loc_buffer,
+ asprintf(&loc_buffer,
catgets(uil_catd, UIL_SET_MISC,
UIL_MISC_0, "\t\t line: %d file: %s"),
az_src_rec->w_line_number,
src_get_file_name( az_src_rec ) );
#else
- sprintf( loc_buffer,
+ asprintf(&loc_buffer,
"\t\t line: %d file: %s",
az_src_rec->w_line_number,
src_get_file_name( az_src_rec ) );
@@ -358,7 +357,7 @@ void diag_issue_diagnostic
if (l_start_column != diag_k_no_column)
#ifndef NO_MESSAGE_CATALOG
- sprintf(loc_buffer,
+ asprintf(&loc_buffer,
catgets(uil_catd, UIL_SET_MISC,
UIL_MISC_1,
"\t\t line: %d position: %d file: %s"),
@@ -366,7 +365,7 @@ void diag_issue_diagnostic
l_start_column + 1,
src_get_file_name( az_src_rec ) );
#else
- sprintf(loc_buffer,
+ asprintf(&loc_buffer,
"\t\t line: %d position: %d file: %s",
az_src_rec->w_line_number,
l_start_column + 1,
@@ -374,13 +373,13 @@ void diag_issue_diagnostic
#endif
else
#ifndef NO_MESSAGE_CATALOG
- sprintf( loc_buffer, catgets(uil_catd, UIL_SET_MISC,
+ asprintf(&loc_buffer, catgets(uil_catd, UIL_SET_MISC,
UIL_MISC_0,
"\t\t line: %d file: %s"),
az_src_rec->w_line_number,
src_get_file_name( az_src_rec ) );
#else
- sprintf( loc_buffer,
+ asprintf(&loc_buffer,
"\t\t line: %d file: %s",
az_src_rec->w_line_number,
src_get_file_name( az_src_rec ) );
@@ -393,7 +392,8 @@ void diag_issue_diagnostic
*/
write_msg_to_standard_error
- ( message_number, src_buffer, ptr_buffer, msg_buffer, loc_buffer );
+ ( message_number, src_buffer, ptr_buffer, msg_buffer,
+ loc_buffer ? loc_buffer : "");
/*
** if we have a listing, place message in the source structure
@@ -415,6 +415,8 @@ void diag_issue_diagnostic
uil_exit( uil_k_severe_status );
}
+ free (loc_buffer);
+ free (msg_buffer);
}
/*
Index: b/clients/uil/UilIODef.h
===================================================================
--- a/clients/uil/UilIODef.h
+++ b/clients/uil/UilIODef.h
@@ -62,7 +62,7 @@ typedef struct
char *c_buffer;
boolean v_position_before_get;
z_key last_key;
- char expanded_name[ 256 ];
+ char *expanded_name;
} uil_fcb_type;
#endif /* UilIODef_h */
Index: b/clients/uil/UilSrcSrc.c
===================================================================
--- a/clients/uil/UilSrcSrc.c
+++ b/clients/uil/UilSrcSrc.c
@@ -258,6 +258,7 @@ Uil_src_cleanup_source(void)
diag_k_no_source, diag_k_no_column,
src_az_source_file_table[i]->expanded_name);
}
+ _free_memory (src_az_source_file_table[i]->expanded_name);
_free_memory ((char*)src_az_source_file_table [i]);
src_az_source_file_table[i] = NULL;
}
@@ -613,13 +614,13 @@ open_source_file( XmConst char
static unsigned short main_dir_len = 0;
boolean main_file;
int i; /* loop index through include files */
- char buffer[256];
+ char *buffer;
/* place the file name in the expanded_name buffer */
- strncpy(buffer, c_file_name, sizeof(buffer));
- buffer[sizeof(buffer)-1] = '\0';
+ buffer = _get_memory (strlen (c_file_name) + 1);
+ strcpy (buffer, c_file_name);
/* Determine if this is the main file or an include file. */
@@ -661,11 +662,10 @@ open_source_file( XmConst char
}
if (!specific_directory) {
+ buffer = XtRealloc (buffer, main_dir_len + strlen (c_file_name) + 1);
_move (buffer, main_fcb -> expanded_name, main_dir_len);
_move (& buffer [main_dir_len],
c_file_name, strlen (c_file_name) + 1); /* + NULL */
- } else {
- strcpy (buffer, c_file_name);
}
/* Open the include file. */
@@ -688,6 +688,7 @@ open_source_file( XmConst char
if (inc_dir_len == 0) {
search_user_include = False;
}
+ buffer = XtRealloc (buffer, inc_dir_len + strlen (c_file_name) + 1);
_move (buffer, Uil_cmd_z_command.ac_include_dir[i], inc_dir_len);
/* Add '/' if not specified at end of directory */
@@ -711,6 +712,7 @@ open_source_file( XmConst char
/* Look in the default include directory. */
if (search_user_include) {
+ buffer = XtRealloc (buffer, sizeof c_include_dir - 1 + strlen (c_file_name) + 1);
_move(buffer, c_include_dir, sizeof c_include_dir - 1); /* no NULL */
_move(&buffer[sizeof c_include_dir - 1],
c_file_name, strlen (c_file_name) + 1); /* + NULL */
@@ -724,14 +726,16 @@ open_label:
/* check the open status. */
- if (az_fcb->az_file_ptr == NULL)
+ if (az_fcb->az_file_ptr == NULL) {
+ _free_memory (buffer);
return src_k_open_error;
+ }
/* open succeeded - place buffer address in fcb */
az_fcb->c_buffer = az_source_buffer->c_text;
az_fcb->c_buffer[ src_k_max_source_line_length ] = 0;
- strcpy(az_fcb->expanded_name, buffer);
+ az_fcb->expanded_name = buffer;
return src_k_open_normal;
}
Index: b/tools/wml/Makefile.am
===================================================================
--- a/tools/wml/Makefile.am
+++ b/tools/wml/Makefile.am
@@ -45,10 +45,12 @@ wmlsynbld.c: wmlparse.h
$(srcdir)/wmldbcreate.c: $(WMLTARGETS) UilLexPars.h
-UilLexPars.h: UilLexPars.c
+UilLexPars.h: Uil.h
+ rm -f $@
+ $(LN_S) Uil.h UilLexPars.h
UilLexPars.c: Uil.c
- $(LN_S) Uil.h UilLexPars.h
+ rm -f $@
$(LN_S) Uil.c UilLexPars.c
$(WMLTARGETS): wml-uil.mm
Index: b/tools/wml/Uil.y
===================================================================
--- a/tools/wml/Uil.y
+++ b/tools/wml/Uil.y
@@ -546,7 +546,7 @@ control_object_definition
object_specification
: CLASS_NAME
- { sar_set_object_class (&$1); }
+ { sar_set_object_class (&$1); $$ = gz_yynullval; }
opt_create_proc_ref
opt_variant
object_spec