PATCH: VarAdd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Some things in VarAdd used by yet another Visual Basic program.

Ciao, Marcus

Changelog:
	VarAdd: Added VT_R8, VT_EMPTY, VT_NULL handling.

Index: dlls/oleaut32/variant.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/variant.c,v
retrieving revision 1.64
diff -u -r1.64 variant.c
--- dlls/oleaut32/variant.c	18 Jun 2003 03:30:40 -0000	1.64
+++ dlls/oleaut32/variant.c	24 Jun 2003 12:54:35 -0000
@@ -5405,6 +5405,65 @@
     TRACE("Right Var:\n");
     dump_Variant(right);
 
+    if ((V_VT(left)&VT_TYPEMASK) == VT_EMPTY)
+    	return VariantCopy(result,right);
+
+    if ((V_VT(right)&VT_TYPEMASK) == VT_EMPTY)
+    	return VariantCopy(result,left);
+
+    if (((V_VT(left)&VT_TYPEMASK) == VT_R8) || ((V_VT(right)&VT_TYPEMASK) == VT_R8)) {
+        BOOL         lOk        = TRUE;
+        BOOL         rOk        = TRUE;
+        double       lVal = -1;
+        double       rVal = -1;
+        double       res  = -1;
+
+        lOk = TRUE;
+        switch (V_VT(left)&VT_TYPEMASK) {
+        case VT_I1   : lVal = V_UNION(left,cVal);   break;
+        case VT_I2   : lVal = V_UNION(left,iVal);   break;
+        case VT_I4   : lVal = V_UNION(left,lVal);   break;
+        case VT_INT  : lVal = V_UNION(left,lVal);   break;
+        case VT_UI1  : lVal = V_UNION(left,bVal);   break;
+        case VT_UI2  : lVal = V_UNION(left,uiVal);  break;
+        case VT_UI4  : lVal = V_UNION(left,ulVal);  break;
+        case VT_UINT : lVal = V_UNION(left,ulVal);  break;
+        case VT_R4   : lVal = V_UNION(left,fltVal);  break;
+        case VT_R8   : lVal = V_UNION(left,dblVal);  break;
+	case VT_NULL : lVal = 0.0;  break;
+        default: lOk = FALSE;
+        }
+
+        rOk = TRUE;
+        switch (V_VT(right)&VT_TYPEMASK) {
+        case VT_I1   : rVal = V_UNION(right,cVal);  break;
+        case VT_I2   : rVal = V_UNION(right,iVal);  break;
+        case VT_I4   : rVal = V_UNION(right,lVal);  break;
+        case VT_INT  : rVal = V_UNION(right,lVal);  break;
+        case VT_UI1  : rVal = V_UNION(right,bVal);  break;
+        case VT_UI2  : rVal = V_UNION(right,uiVal); break;
+        case VT_UI4  : rVal = V_UNION(right,ulVal); break;
+        case VT_UINT : rVal = V_UNION(right,ulVal); break;
+        case VT_R4   : rVal = V_UNION(right,fltVal);break;
+        case VT_R8   : rVal = V_UNION(right,dblVal);break;
+	case VT_NULL : rVal = 0.0; break;
+        default: rOk = FALSE;
+        }
+
+        if (lOk && rOk) {
+            res = (lVal + rVal);
+            V_VT(result) = VT_R8;
+            V_UNION(result,dblVal)  = res;
+            rc = S_OK;
+        } else {
+	    FIXME("Unhandled type pair %d / %d in double addition.\n", 
+        	(V_VT(left)&VT_TYPEMASK),
+        	(V_VT(right)&VT_TYPEMASK)
+	    );
+	}
+	return rc;
+    }
+
     /* Handle strings as concat */
     if ((V_VT(left)&VT_TYPEMASK) == VT_BSTR &&
         (V_VT(right)&VT_TYPEMASK) == VT_BSTR) {
@@ -5431,6 +5490,7 @@
         case VT_UI2  : lVal = V_UNION(left,uiVal); resT=VT_I4; break;
         case VT_UI4  : lVal = V_UNION(left,ulVal); resT=VT_I4; break;
         case VT_UINT : lVal = V_UNION(left,ulVal); resT=VT_I4; break;
+	case VT_NULL : lVal = 0; resT = VT_I4; break;
         default: lOk = FALSE;
         }
 
@@ -5444,6 +5504,7 @@
         case VT_UI2  : rVal = V_UNION(right,uiVal); resT=VT_I4; break;
         case VT_UI4  : rVal = V_UNION(right,ulVal); resT=VT_I4; break;
         case VT_UINT : rVal = V_UNION(right,ulVal); resT=VT_I4; break;
+	case VT_NULL : rVal = 0; resT=VT_I4; break;
         default: rOk = FALSE;
         }
 
@@ -5460,7 +5521,7 @@
             rc = S_OK;
 
         } else {
-            FIXME("unimplemented part\n");
+            FIXME("unimplemented part (0x%x + 0x%x)\n",V_VT(left), V_VT(right));
         }
     }
 

Attachment: pgp00153.pgp
Description: PGP signature


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux