widl: Fixup the defaultvalue(BSTR) expression type like midl does.
Dmitry Timoshkov
dmitry at baikal.ru
Fri Nov 27 04:00:27 CST 2015
This patch implements the suggestion to fix widl in preference to fixing up
every .idl file with defaultvalue() while having a BSTR type but using not a
unicode string syntax.
I'd really like to see this fix included in 1.8 to make the generated headers
usable outside of Wine. If this is not a proper fix or a different solution
is preferred please let me know.
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
tools/widl/header.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index cb4601e..7b97158 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -35,6 +35,7 @@
#include "header.h"
#include "expr.h"
#include "typetree.h"
+#include "typelib.h"
static int indentation = 0;
static int is_object_interface = 0;
@@ -1009,6 +1010,16 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
/* Output default value only if all following arguments also have default value. */
LIST_FOR_EACH_ENTRY_REV( tail_arg, args, const var_t, entry ) {
if(tail_arg == arg) {
+ expr_t bstr;
+
+ /* Fixup the expression type for a BSTR like midl does. */
+ if (get_type_vt(arg->type) == VT_BSTR && expr->type == EXPR_STRLIT)
+ {
+ bstr = *expr;
+ bstr.type = EXPR_WSTRLIT;
+ expr = &bstr;
+ }
+
fprintf(h, " = ");
write_expr( h, expr, 0, 1, NULL, NULL, "" );
break;
--
2.6.3
More information about the wine-patches
mailing list