Nikolay Sivov : widl: Write default values for VARIANT arguments.

Alexandre Julliard julliard at winehq.org
Wed Sep 8 15:12:39 CDT 2021


Module: wine
Branch: master
Commit: ec9892585eb36ec62c39458a1ffb0c0bdffef558
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ec9892585eb36ec62c39458a1ffb0c0bdffef558

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Sep  8 13:20:50 2021 +0300

widl: Write default values for VARIANT arguments.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tools/widl/write_msft.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index c39f38249c8..228f58e2649 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -1221,7 +1221,8 @@ static void write_default_value(msft_typelib_t *typelib, type_t *type, expr_t *e
     int vt;
 
     if (expr->type == EXPR_STRLIT || expr->type == EXPR_WSTRLIT) {
-        if (get_type_vt(type) != VT_BSTR)
+        vt = get_type_vt(type);
+        if (vt != VT_BSTR && vt != VT_VARIANT)
             error("string default value applied to non-string type\n");
         chat("default value '%s'\n", expr->u.sval);
         write_string_value(typelib, out, expr->u.sval);
@@ -1251,6 +1252,20 @@ static void write_default_value(msft_typelib_t *typelib, type_t *type, expr_t *e
         case VT_UINT:
         case VT_HRESULT:
             break;
+        case VT_VARIANT: {
+            switch (expr->type) {
+            case EXPR_DOUBLE:
+                vt = VT_R4;
+                break;
+            case EXPR_NUM:
+                vt = VT_I4;
+                break;
+            default:
+                warning("can't write default VT_VARIANT value for expression type %d.\n", expr->type);
+                return;
+            }
+            break;
+        }
         default:
             warning("can't write value of type %d yet\n", vt);
             return;




More information about the wine-cvs mailing list