Bug #669: winebuild DLLName isn't filtered
Vincent Béron
vberon at mecano.gme.usherb.ca
Mon May 13 15:13:15 CDT 2002
After Alexandre's removal of the spec files in programs/, I couldn't
build a little program I use called "GCI-tool", because that name is an
invalid C identifier.
This patch makes sure that DLLName is a legal C identifier. If you'd
prefer to have that only where it's actually used in a function name,
rather than just after DLLName is initialised, I'll modify it
accordingly.
Changelog:
- Filter for illegal C identifier characters in DLLName in winebuild.
Vincent
-------------- next part --------------
diff -urN wine-orig/tools/winebuild/main.c wine/tools/winebuild/main.c
--- wine-orig/tools/winebuild/main.c Sat May 11 20:04:31 2002
+++ wine/tools/winebuild/main.c Mon May 13 15:37:16 2002
@@ -26,6 +26,7 @@
#include "wine/port.h"
#include <assert.h>
+#include <ctype.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
@@ -201,12 +202,17 @@
static void do_exe( const char *arg )
{
const char *p;
+ char *c;
if (exec_mode != MODE_NONE || !arg[0]) do_usage();
exec_mode = MODE_EXE;
if ((p = strrchr( arg, '/' ))) p++;
else p = arg;
strcpy( DLLName, p );
+ /* Make sure that DLLName is a legal C identifier,
+ as it is used later in function names */
+ for(c = DLLName; *c; c++)
+ if (!isalnum(*c) && *c != '_') *c = '_';
strcpy( DLLFileName, p );
if (!strchr( DLLFileName, '.' )) strcat( DLLFileName, ".exe" );
if (SpecMode == SPEC_MODE_DLL) SpecMode = SPEC_MODE_GUIEXE;
diff -urN wine-orig/tools/winebuild/parser.c wine/tools/winebuild/parser.c
--- wine-orig/tools/winebuild/parser.c Sat May 11 20:04:31 2002
+++ wine/tools/winebuild/parser.c Mon May 13 15:36:04 2002
@@ -512,6 +512,7 @@
SPEC_TYPE ParseTopLevel( FILE *file, int def_only )
{
const char *token;
+ char *c;
input_file = file;
current_line = 1;
@@ -614,6 +615,11 @@
sprintf( DLLFileName, "%s.exe", DLLName );
}
+ /* Make sure that DLLName is a legal C identifier,
+ as it is used later in function names */
+ for(c = DLLName; *c; c++)
+ if (!isalnum(*c) && *c != '_') *c = '_';
+
if (SpecType == SPEC_INVALID) fatal_error( "Missing 'type' declaration\n" );
if (SpecType == SPEC_WIN16 && !owner_name[0])
fatal_error( "'owner' not specified for Win16 dll\n" );
More information about the wine-patches
mailing list