makedep: Sanitize the module names before turning them into resource ids.

Francois Gouget fgouget at free.fr
Thu Feb 19 12:41:01 CST 2015


Resource ids cannot contain dashes so replace them with underscores.
This makes it possible to build tests for dlls containing dashes into their names like the api-* ones.
---

I propose this patch to fix bug 33375. Note that this bug also contains 
a patch that adds a test to one of the api-xxx dlls to reproduce this 
bug.
https://bugs.winehq.org/show_bug.cgi?id=33375

 tools/makedep.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/makedep.c b/tools/makedep.c
index 54aab45..f8dc6cf 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -2247,6 +2247,7 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
         char *testmodule = replace_extension( make->testdll, ".dll", "_test.exe" );
         char *stripped = replace_extension( make->testdll, ".dll", "_test-stripped.exe" );
         char *testres = replace_extension( make->testdll, ".dll", "_test.res" );
+        char *testid, *c;
         struct strarray all_libs = empty_strarray;
 
         for (i = 0; i < make->imports.count; i++)
@@ -2289,8 +2290,15 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
         output( "all: %s/%s\n", top_obj_dir_path( make, "programs/winetest" ), testres );
         output( "%s/%s: %s%s\n", top_obj_dir_path( make, "programs/winetest" ), testres,
                 obj_dir_path( make, stripped ), dll_ext );
+        testid = c = xstrdup( testmodule );
+        while (*c)
+        {
+            if (*c == '-') *c = '_';
+            c++;
+        }
         output( "\techo \"%s TESTRES \\\"%s%s\\\"\" | %s -o $@\n",
-                testmodule, obj_dir_path( make, stripped ), dll_ext, tools_path( make, "wrc" ));
+                testid, obj_dir_path( make, stripped ), dll_ext, tools_path( make, "wrc" ));
+        free(testid);
 
         if (crosstarget)
         {
-- 
2.1.4



More information about the wine-patches mailing list