[PATCH] widl: Fix handling of output_name in option parsing

Andrew Boyarshin andrew.boyarshin at gmail.com
Mon Feb 8 09:03:08 CST 2021


Do not overwrite explicitly stated paths, such as header_name or
proxy_name. Instead, use output_name when specified as a fallback.

Drop inferring output_name from input_name which never worked, because
input_name is not yet assigned at the moment of use. This leads to names
like "widl.tab" (dup_basename fallbacks to that when given nullptr).

Signed-off-by: Andrew Boyarshin <andrew.boyarshin at gmail.com>
---
 tools/widl/widl.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index 333351bc11bc..e8240b38584a 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -823,19 +823,20 @@ int main(int argc,char *argv[])
     set_everything(TRUE);
   }
 
-  if (!output_name) output_name = dup_basename(input_name, ".idl");
-
-  if (do_header + do_typelib + do_proxies + do_client +
-      do_server + do_regscript + do_idfile + do_dlldata == 1)
+  if (output_name)
   {
-      if (do_header) header_name = output_name;
-      else if (do_typelib) typelib_name = output_name;
-      else if (do_proxies) proxy_name = output_name;
-      else if (do_client) client_name = output_name;
-      else if (do_server) server_name = output_name;
-      else if (do_regscript) regscript_name = output_name;
-      else if (do_idfile) idfile_name = output_name;
-      else if (do_dlldata) dlldata_name = output_name;
+    if (do_header + do_typelib + do_proxies + do_client +
+        do_server + do_regscript + do_idfile + do_dlldata == 1)
+    {
+        if (do_header && !header_name) header_name = output_name;
+        else if (do_typelib && !typelib_name) typelib_name = output_name;
+        else if (do_proxies && !proxy_name) proxy_name = output_name;
+        else if (do_client && !client_name) client_name = output_name;
+        else if (do_server && !server_name) server_name = output_name;
+        else if (do_regscript && !regscript_name) regscript_name = output_name;
+        else if (do_idfile && !idfile_name) idfile_name = output_name;
+        else if (do_dlldata && !dlldata_name) dlldata_name = output_name;
+    }
   }
 
   if (!dlldata_name && do_dlldata)
-- 
2.30.0.windows.1




More information about the wine-devel mailing list