From 901d73cf56c406816555912ab2f089d80bba49db Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 20 Jan 2016 14:26:48 +0800
Subject: widl: Fix generation of resources containing an old typelib.

---
 tools/widl/typelib.c | 2 +-
 tools/widl/widl.c    | 5 +++--
 tools/widl/widl.h    | 1 +
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index aa3305c..3de8691 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -249,7 +249,7 @@ void end_typelib(void)
 {
     if (!typelib) return;
 
-    if (do_typelib == 2)
+    if (do_old_typelib)
         create_sltg_typelib(typelib);
     else
         create_msft_typelib(typelib);
diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index 1180e65..afeea39 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -103,6 +103,7 @@ int do_everything = 1;
 static int preprocess_only = 0;
 int do_header = 0;
 int do_typelib = 0;
+int do_old_typelib = 0;
 int do_proxies = 0;
 int do_client = 0;
 int do_server = 0;
@@ -308,6 +309,7 @@ static void set_everything(int x)
 {
   do_header = x;
   do_typelib = x;
+  do_old_typelib = x;
   do_proxies = x;
   do_client = x;
   do_server = x;
@@ -682,8 +684,7 @@ int main(int argc,char *argv[])
       do_typelib = 1;
       break;
     case OLD_TYPELIB_OPTION:
-      do_everything = 0;
-      do_typelib = 2;
+      do_old_typelib = 1;
       break;
     case 'T':
       typelib_name = xstrdup(optarg);
diff --git a/tools/widl/widl.h b/tools/widl/widl.h
index 09e7871..90b6366 100644
--- a/tools/widl/widl.h
+++ b/tools/widl/widl.h
@@ -38,6 +38,7 @@ extern int pedantic;
 extern int do_everything;
 extern int do_header;
 extern int do_typelib;
+extern int do_old_typelib;
 extern int do_proxies;
 extern int do_client;
 extern int do_server;
-- 
2.6.4

